Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
📝 WalkthroughWalkthroughThis refactoring replaces a static FIELD_NAME_LABELS lookup map with a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR introduces a small
Confidence Score: 5/5
Last reviewed commit: 5e5b6d7 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
clients/admin-ui/src/features/common/utils.ts (1)
319-332: Add a small test matrix forformatFieldName.This helper now drives both evidence rendering and filtering, so a few focused cases for bare keys and dotted paths would make future label changes much safer.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@clients/admin-ui/src/features/common/utils.ts` around lines 319 - 332, Add a small unit test suite for the formatFieldName function that verifies behavior for bare keys and dotted paths: test that "legal_basis" → "Legal basis", "privacy_declaration.legal_basis" → "Legal basis", a multi-segment path like "a.b.c_field" → "C field", and that multiple underscores are converted ("user_full_name" → "User full name"); import formatFieldName and assert exact output strings to catch regressions in label rendering and filtering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@clients/admin-ui/src/features/common/utils.ts`:
- Around line 319-332: Add a small unit test suite for the formatFieldName
function that verifies behavior for bare keys and dotted paths: test that
"legal_basis" → "Legal basis", "privacy_declaration.legal_basis" → "Legal
basis", a multi-segment path like "a.b.c_field" → "C field", and that multiple
underscores are converted ("user_full_name" → "User full name"); import
formatFieldName and assert exact output strings to catch regressions in label
rendering and filtering.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d391e464-0659-4ea9-bcf8-3bafc784bee4
📒 Files selected for processing (4)
clients/admin-ui/src/features/common/utils.tsclients/admin-ui/src/features/privacy-assessments/EvidenceCardGroup.tsxclients/admin-ui/src/features/privacy-assessments/constants.tsclients/admin-ui/src/features/privacy-assessments/utils.ts
Ticket ENG-2748
Description Of Changes
Evidence items in the assessment detail view display a
field_namelabel derived from the backend. The backend emits this value in two different formats depending on whether the evidence was generated by the AI path or the non-AI (template) path:"legal_basis","retention_period""privacy_declaration.legal_basis_for_processing","system.data_security_practices"Our normal pattern for this kind of display mapping is a static
Record<string, string>constant (e.g.ANSWER_SOURCE_LABELS,ASSESSMENT_STATUS_LABELS).That approach doesn't work here because the set of possible
field_namevalues is open-ended — the non-AI path reflects whatever fields are defined onPrivacyDeclarationSummaryandSystemSummary, and the AI path is LLM-generated free text. A static map would silently miss new fields or any unexpected LLM output.Instead, we introduce a small
formatFieldNameutility in~/features/common/utilsthat:sentenceCaseThis handles both path formats and degrades gracefully for any unseen value. Examples:
field_namelegal_basisLegal basisretention_periodRetention perioddata_categoriesData categoriesprivacy_declaration.legal_basis_for_processingLegal basis for processingprivacy_declaration.data_useData useprivacy_declaration.processes_special_category_dataProcesses special category datasystem.data_security_practicesData security practicessystem.does_international_transfersDoes international transfersAlso, it updates the label "Privacy declaration" to "Data uses" after product feedback.
Code Changes
formatFieldName(raw: string): stringtoclients/admin-ui/src/features/common/utils.tsFIELD_NAME_LABELSconstant fromclients/admin-ui/src/features/privacy-assessments/constants.tsEvidenceCardGroup.tsxto useformatFieldNamefilterEvidenceinclients/admin-ui/src/features/privacy-assessments/utils.tsto useformatFieldNameSteps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedSummary by CodeRabbit