feat(cme,teaching,rag): wire claim-pack surface, registrar milestones, durable dual-sign-off, bookings, and chunking regex hoist (#GR72PF, #XNAHY2, #AD9JC6, #AW8SRK, #54N8ZN, #YETFBJ, #BGDVPD)
User description
Summary
- CME Claim-Pack Surface (
#GR72PF— follow-up to#G20QE6): Wire<CmeClaimPackButton />(src/components/cme/cme-claim-pack.tsx) onto the CME Annual Summary print/export controls (src/components/cme/cme-annual-summary.tsx) withguardExampleAction(example, "export")protection so example-data mode blocks exports cleanly while normal mode exports and downloads the claim pack. Verified intests/cme-claim-pack-surface.dom.test.tsx. - CME Training Milestones Storage (
#XNAHY2— follow-up to#T983N9): Connectsrc/lib/cme/training-repository.ts,src/lib/cme/training-assessments.ts,src/lib/cme/training-page-data.ts,src/app/(search-app)/cme/training/page.tsx,src/components/cme/cme-training-page.tsx, andsrc/app/api/cme/training/route.tsto owner-scopedpublic.registrar_training_milestonesCRUD and sync (fetchOwnerRegistrarMilestones,createOwnerRegistrarMilestone,updateOwnerRegistrarMilestone,deleteOwnerRegistrarMilestone,syncOwnerMilestoneToRegistrarTable,buildOwnerTrainingAssessments), replacing the hard-coded{ status: "not-recorded" }fallback when recorded owner milestones exist. Verified intests/cme-training-registrar-milestones.test.ts. - Teaching Assessments Durable Storage & Supervisor Bookings (
#AD9JC6&#AW8SRK— follow-up to#4KQGXZ): WireDurableClinicalAssessmentRepository(resolveAssessmentStore) backed bypublic.registrar_assessmentsintosrc/lib/teaching/assessments/dual-sign-off.tsandsrc/app/api/teaching/assessments/dual-sign-off/route.ts(preservingconsumeSubjectApiRateLimitand413readBoundedJsonhandling and pre-approval supervisor redaction), and add authenticated supervisor availability slots and bookings insrc/lib/teaching/assessments/supervisor-bookings.tsandsrc/app/api/teaching/assessments/bookings/route.ts(category = 'supervisor_review'with collision guards in both repositories). Verified intests/teaching-dual-sign-off-durable.test.ts. - XLSX Per-Sheet Dictionary Projection & Admin Pilot Accessibility Verification (
#54N8ZN— follow-up to PR #3546): Add multi-sheet row/column style (<row s="...">,<col style="...">) and shared-string provenance budget tests intests/xlsx-sheet-dictionary-projection.test.ts, and add dark mode, forced-colors,320pxnarrow-viewport, and QR enrollment alt/warning checks intests/admin-pilot-client-accessibility.dom.test.tsx. - Script Entrypoint Guard & Chunking Regex Hoisting (
#YETFBJ&#BGDVPD): Switchscripts/eval-retrieval.tsandscripts/build-ranking-snapshot.tstoisDirectEntrypoint(import.meta.url)fromscripts/lib/is-entrypoint.mjs(removing both fromALLOWED_RAWintests/script-entrypoint-guard.test.ts), and hoist 19 pre-compiled boundary, heading, metadata-noise, boilerplate, dose-unit, prohibition, and table regexes to module scope insrc/lib/chunking.tswith identical chunk output (tests/chunking-regex-hoist.test.ts). - Ledger & Inbox Hygiene: Queue
done/updateinbox requests for#GR72PF,#XNAHY2,#AD9JC6,#AW8SRK,#YETFBJ,#BGDVPD, and#54N8ZN, queue the 4 follow-upaddinbox requests from PR #3609 review (#08216B,#WFYDV6,#WMGPSG,#1WAA0Z), and record theprlandedentry for PR #3609 (679d2bfeb8fb2082a09ae75009bc07d454731276).
RAG impact: none — scripts/eval-retrieval.ts and scripts/build-ranking-snapshot.ts only change their CLI entrypoint guard (isDirectEntrypoint(import.meta.url)), and src/lib/chunking.ts hoists identical regex literals to module scope with zero change to chunk text, boundaries, keys, source spans, or synopses (tests/chunking-regex-hoist.test.ts 4/4 and 135/135 existing chunking tests pass).
Clinical Governance Preflight
- Source-backed claims still require linked source verification before clinical use
- No patient-identifiable document workflow was introduced or expanded without explicit governance approval
- Supabase target remains
PsychSift Production(sjrfecxgysukkwxsowpy) - Service-role keys and private document access remain server-only
- Demo/synthetic content remains clearly separated from real clinical sources
- Source metadata, review status, and outdated/unknown-source behavior remain conservative
- Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed
Verification
- Checks run:
npx vitest run tests/admin-pilot-client-accessibility.dom.test.tsx tests/chunking-regex-hoist.test.ts tests/cme-claim-pack-surface.dom.test.tsx tests/cme-training-registrar-milestones.test.ts tests/script-entrypoint-guard.test.ts tests/teaching-dual-sign-off-durable.test.ts tests/xlsx-sheet-dictionary-projection.test.ts->Test Files 7 passed (7), Tests 32 passed (32)npm run typecheck->[gate-receipts] recorded a pass for "typecheck:internal" (10364 input files).node scripts/check-owner-scope-api.mjs->✓ owner-scope phase 1: 127 src/app/api files clean against 56 owner-scoped tables. ✓ owner-scope phase 2: 173 direct, 32 user-keyed, 29 derived-tier, 2 untiered-table and 1 dynamic-table-dispatch queries scoped on their chain or declared; 8 versioned-RPC call sites, all literal.node scripts/check-diff-integrity.mjs->[diff-integrity] PASS — 7 changed test file(s), 13 -> 32 test case(s)node scripts/check-ledger-write-discipline.mjs->Ledger write discipline passed for 679d2bfeb8fb..HEAD.npx eslint --max-warnings=0 ...->0 errors, 0 warnings
Risk and rollout
- Risk: Low — all database tables (
registrar_training_milestonesandregistrar_assessments) and RLS policies already exist onmain; zero database migrations or paid provider calls are introduced. - Rollback: Standard
git revertof the squash commit. - Provider or production effects: None (zero migrations, zero paid provider calls).
Notes
- Includes the 4 follow-up
issues:addinbox records requested during PR #3609 review (38224881,ca717f00,ed0b610a,ec2c7d1d) and theprlandedrecord for PR #3609.
Summary by cubic
Moves CME training milestones and teaching dual-sign-off assessments from stubs to durable, owner-scoped Postgres storage and adds the claim-pack export surface. Recorded registrar milestones now drive training progress (no more fixed not-recorded state), and draft assessments survive restarts instead of a production 503, with review findings folded in: milestones deduplicated by stable identity, no invented rotation deadlines or WBA totals, and bookings that authorize both roles, scope availability to the caller, guard cancellation against stale state, and always enforce rate limits.
What changed
- Claim-pack export button on the CME Annual Summary, blocked in example-data mode.
- Registrar milestone CRUD merges
registrar_training_milestoneswith existing training milestones; deduplication and current-rotation FTE/deadline fixes apply, registrar fetch failures are preserved, and write mirroring checks every sync result. - Supervisor availability slots and bookings via
registrar_assessmentswith optimistic concurrency, an overlap re-check after insert, and authorization viawork_can('assessments.review')plus trainee-membership checks; rate limiting and 413 handling preserved. scripts/eval-retrieval.tsandscripts/build-ranking-snapshot.tsuseisDirectEntrypoint; RAG output unchanged.- 19 chunking regexes hoisted to module scope with identical chunk output.
- XLSX per-sheet dictionary projection and admin-pilot accessibility tests extended; issue-inbox records for the seven tracked issues and PR #3609 follow-ups updated.
- Merged latest
mainand refreshed the repo-awareness snapshot.
Rollout
- No migrations; both tables and RLS policies already exist on
main. - Rollback is a standard revert of the squash commit.
CodeAnt-AI Description
Add CME exports and recorded training milestones, with persistent teaching assessments and supervisor bookings
What Changed
- Add a claim-pack export to the CME Annual Summary; exports are blocked when example data is active.
- Show recorded registrar milestones in training progress instead of always showing “not recorded”; keep the no-records state when none exist.
- Save teaching assessments across sessions so trainees and supervisors can complete drafts, revisions, and sign-off in production.
- Let supervisors publish supervision slots and trainees book or cancel them; prevent self-booking and double-booking.
Impact
✅ Claim-pack exports from the CME Annual Summary
✅ Recorded milestones reflected in training progress
✅ Teaching assessments and bookings persist across restarts
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
@codeant-ai ask: Can you suggest a safer alternative to storing this secret?
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
@codeant-ai: Your feedback here
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
@codeant-ai: Do not flag unused imports.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
-
New Features
- Added CME claim-pack downloads to annual summaries; exports are blocked while example data is active.
- Training assessments now reflect saved registrar milestones, with sample and recorded views handled separately.
- Added supervision booking options for viewing availability, creating slots, booking, and cancelling.
- Teaching assessments now support durable storage and improved access controls.
-
Bug Fixes
- Improved document text chunking for headings, tables, and sentence boundaries.
-
Documentation
- Updated the design-system adoption snapshot and API route inventory.