fix(admin,studio,docs): Sections 9-14 UAT — Add Mapping UI, packet format, demo reset gate (#30)#45
Conversation
…rmat, demo reset gate (#30) Address all reported Section 9, 11, and 14 UAT bugs from issue #30 plus walkthrough-guide inaccuracies for Sections 9–14. S9-4: Local code mappings panel now exposes a toggleable "Add Mapping" inline form that POSTs to /api/admin/terminology-mappings with client- side validation for required fields and confidence range. S11: Studio Release & Approval tab now uses the shared AuditPacketExportButton so the JSON/HTML format dropdown is consistent across all three packet entry points (case detail, run detail, Studio). S14-1: The Reset Demo Data card is gated on NEXT_PUBLIC_DEMO_MODE === "true" so the card is structurally absent in production Vercel builds. next.config.ts already fails fast if a prod build is configured with that flag enabled, so this guarantees the section never renders in production. Walkthrough guide: corrected Section 9 (panel heading + Reviewed By / Notes columns + Validate Mappings location), Section 10 (button labels + audit CSV on Cases page), Section 11 (consistent format dropdown across all three entry points), Section 12 (Claude Desktop config and JWT acquisition), Section 13 (Bug 4 cross-reference for /login redirect), Section 14 (inline confirmation, visibility gate, post-reset catalog). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Taleef7
left a comment
There was a problem hiding this comment.
I found a couple of blockers before merge. The new Add Mapping UI turns terminology mapping creation into a normal admin workflow, but the underlying create path does not write an audit event, which violates the repo rule that every state change is audited. Also, the form/status documentation currently undercuts the claimed review workflow by allowing direct APPROVED/REVIEWED/REJECTED creation while the guide says promotion happens through API calls that do not actually update existing mappings. I would fix these before merging.
| setSavingMapping(true); | ||
| setMappingError(null); | ||
| try { | ||
| await api.post("/api/admin/terminology-mappings", { |
There was a problem hiding this comment.
This newly exposed admin workflow creates a terminology mapping, but the backend path it calls (AdminController#createTerminologyMapping -> ValueSetGovernanceService#createTerminologyMapping) only inserts into terminology_mappings; it does not write an audit_events row. The repo hard rule says every state change writes audit_event, and this PR makes the state change reachable from the UI. Please add an audited event for mapping creation (including actor, local/standard codes, status/confidence) and regression coverage before merge.
| </label> | ||
| <label className="text-xs font-medium text-slate-700"> | ||
| Status | ||
| <select |
There was a problem hiding this comment.
This selector lets an admin create a brand-new mapping directly as APPROVED, REVIEWED, or REJECTED, but the form text says new mappings default to PROPOSED and require review before promotion. Since the create endpoint does not populate reviewed_by/reviewed_at, an APPROVED row created here looks approved with no reviewer metadata. Either constrain this UI to create PROPOSED mappings only, or implement a real reviewed/promotion path that records reviewer metadata and audit history.
… status to PROPOSED - Backend: emit TERMINOLOGY_MAPPING_CREATED audit event from ValueSetGovernanceService.createTerminologyMapping (actor, local/standard codes, status, confidence) — satisfies the hard rule that every state change writes audit_event - Frontend: remove status selector from Add Mapping form; new mappings are always PROPOSED — prevents creating APPROVED/REVIEWED rows with no reviewed_by/reviewed_at metadata - Tests: add createsTerminologyMappingWithProposedStatus and rejectsTerminologyMappingMissingRequiredFields to AdminControllerTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The JOURNAL.md conflict resolution in the GitHub PR UI dropped the Sections 6-8 entry from main. Reinsert it between the Sections 9-14 and Section 5 entries so all three daily log entries are present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…L conflict Both branches added entries at the top of docs/JOURNAL.md. Kept both: Sections 9-14 entry (branch) followed by Sections 6-8 entry (main). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eation Adds regression coverage for the hard rule that every state change writes audit_event. The createTerminologyMappingPersists integration test now queries audit_events by entity_id and asserts a TERMINOLOGY_MAPPING_CREATED row exists with the correct event_type, entity_type, local code, and status. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Closes #30. Addresses all reported Section 9, 11, and 14 UAT bugs plus walkthrough-guide inaccuracies for Sections 9–14.
/api/admin/terminology-mappingsendpoint. The table auto-refreshes and the form auto-closes on success.AuditPacketExportButton, so case detail, run detail panel, and Studio Release & Approval tab (and the Studio header) all expose the same JSON/HTML format dropdown./adminis now gated onprocess.env.NEXT_PUBLIC_DEMO_MODE === "true". Becausefrontend/next.config.tsalready fails fast if a production build is configured withNEXT_PUBLIC_DEMO_MODE=true, the card is structurally absent in production Vercel builds, not merely hidden via CSS. The backend@Profile("!prod")403 remains the second line of defence.docs/WALKTHROUGH_GUIDE.md:Reviewed By+Notescolumns, clarified that Validate Mappings lives on the Source mappings panel (not the terminology panel), and documented the new Add Mapping inline form.Authorization: Bearer <JWT>, and instructions for acquiring a WorkWell JWT./loginredirect on session expiry so it's not mistaken for an RBAC denial.Acceptance criteria
docs/WALKTHROUGH_GUIDE.mdTest plan
frontend/npm run lint— passed (only the pre-existingtest/mocks/next-font.tsanonymous-default-export warning)frontend/npm test— 40/40 passedfrontend/npx tsc --noEmit— cleanadmin@workwell.dev, opened Add Mapping form on/admin, submittedANNUAL-FIT-TEST→ SNOMED415070008, observed the new row in the table and the form auto-closing.NEXT_PUBLIC_DEMO_MODE=true: Reset demo data card renders on/admin.NEXT_PUBLIC_DEMO_MODE=false: Reset demo data card does not render on/admin; Admin page (including the Local code mappings panel + Add Mapping button) still renders normally.Notes for reviewer
main(post-merge of PR fix: address Section 5 case detail UAT issues #43) and does not depend on the still-openfix/sprint-1-uat-sections-6-8branch.🤖 Generated with Claude Code