Forms: publish complete WA MHA catalog for shared access#712
Conversation
Import the reviewed WA forms catalog and current public PDFs, wire the Forms UI and registry payloads, and make the shared Forms/Services baseline available without per-user seed writes. Preserve private owner overrides and governance.
…rt-6914 # Conflicts: # docs/branch-review-ledger.md
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThe PR adds a complete Forms catalogue and PDF manifest, generates catalogue-backed records and search metadata, changes registry reads to merge shared defaults with private overrides without auto-seeding, and updates Forms UI, documentation, and tests. ChangesForms catalogue and shared registry
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant FormsClient
participant RegistryRecordsRoute
participant RegistrySeed
participant SharedFormRecords
FormsClient->>RegistryRecordsRoute: request registry records
RegistryRecordsRoute->>RegistrySeed: fetchOwnerRegistryRows
RegistrySeed-->>RegistryRecordsRoute: private owner rows
RegistryRecordsRoute->>RegistrySeed: mergeRegistryRecordsWithDefaults
RegistrySeed->>SharedFormRecords: read shared defaults
SharedFormRecords-->>RegistrySeed: shared catalogue records
RegistrySeed-->>RegistryRecordsRoute: merged records and governance
RegistryRecordsRoute-->>FormsClient: shared catalogue with owner overrides
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Database/src/app/api/registry/records/[slug]/route.ts
Lines 131 to 134 in 80594de
For any authenticated user who already has a legacy seeded row for a baseline form (for example transport-crisis-form), this detail route returns that raw pre-catalogue row instead of the baseline-plus-override record used by the list and universal-search paths. Navigating from the new catalogue to such a form therefore drops the newly published official-source/PDF metadata and can display the old, less reliable legal guidance; merge this row with the matching default before returning it, while keeping its owner governance and linked documents.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
CI triageCI failed on this PR. Automated classification of the 3 failed job(s):
Heuristic only — a main-side or flake label is a starting point, not a verdict. |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
src/lib/form-catalog.ts (1)
138-140: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueNo-op transform in
formSlug.
.replace(/attachment/g, "attachment")replaces the token with itself and does nothing — slugging already works via the subsequent[^a-z0-9]+ → "-"(e.g."6b attachment"→form-6b-attachment). Please confirm this wasn't meant to be a different transformation (e.g. special-casing attachments) and drop it if not.♻️ Suggested cleanup
return ( legacySlugs[code] ?? `form-${normalizeCode(code) - .replace(/attachment/g, "attachment") .replace(/[^a-z0-9]+/g, "-")}` );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/form-catalog.ts` around lines 138 - 140, Remove the no-op replace(/attachment/g, "attachment") call from formSlug’s slug construction after confirming no attachment-specific transformation is required; retain normalizeCode and the subsequent non-alphanumeric replacement so values like “6b attachment” still produce the expected slug.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/forms/form-detail-page.tsx`:
- Around line 614-617: Update the source button in the form detail component to
be disabled whenever form.source?.url is absent, while preserving the existing
window.open behavior for available URLs. Ensure its accessible state reflects
the nullable source and the button no longer appears actionable for contact-only
forms.
In `@src/components/forms/forms-home-page.tsx`:
- Around line 128-129: Update the label near the “Official-source MHA 2014
forms” body to avoid claiming governance review is complete; use wording that
accurately indicates the forms are pending or subject to clinical/legal review,
while preserving the existing body text.
In `@src/lib/registry-seed.ts`:
- Around line 43-67: Update src/lib/registry-seed.ts lines 43-67 to merge owner
fields using raw row null semantics, ensuring only explicitly populated values
override baseline defaults rather than relying on rowToServiceRecord’s []
conversions; preserve catalogPayload merging. Update
src/app/api/registry/records/[slug]/route.ts lines 105-109 to merge an existing
owner row over the shared baseline record using the same logic instead of
returning the mapped owner record directly.
In `@tests/forms.test.ts`:
- Around line 1-2: Update the PDF validation logic around the test at lines
52–57 to read each stored PDF’s bytes, compute its SHA-256 digest, and compare
that digest with the declared localPdfSha256 value. Keep the existing existence,
checksum-format, and minimum-size checks, but ensure validation fails when the
file contents do not match the declared hash.
---
Nitpick comments:
In `@src/lib/form-catalog.ts`:
- Around line 138-140: Remove the no-op replace(/attachment/g, "attachment")
call from formSlug’s slug construction after confirming no attachment-specific
transformation is required; retain normalizeCode and the subsequent
non-alphanumeric replacement so values like “6b attachment” still produce the
expected slug.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 42d65178-7c1e-4387-83b0-0daf835b5020
⛔ Files ignored due to path filters (51)
public/forms-pdf/form-10a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10d.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10e.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10f.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10g.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10h.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-10i.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11d.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11e.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11f.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-11g.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-12a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-12b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-12c-attachment.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-12c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-1a-attachment.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-1a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-1b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-2.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-3a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-3b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-3c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-3d.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-3e.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-4a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-4b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-4c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-5a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-5b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-5c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-5d.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-5e.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-5f.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-6a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-6b-attachment.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-6b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-6c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-6d.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-7a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-7b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-7c.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-7d.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-8a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-8b.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-9a.pdfis excluded by!**/*.pdfpublic/forms-pdf/form-9b.pdfis excluded by!**/*.pdf
📒 Files selected for processing (24)
.env.exampledata/forms-catalog.jsondata/forms-page-snapshot.jsondata/forms-pdf-manifest.jsondocs/branch-review-ledger.mddocs/codebase-index.mddocs/multi-user-auth-setup.mddocs/site-map.mdsrc/app/api/registry/records/[slug]/route.tssrc/app/api/registry/records/route.tssrc/components/forms/form-detail-page.tsxsrc/components/forms/forms-home-page.tsxsrc/components/forms/forms-search-results-page.tsxsrc/lib/env.tssrc/lib/form-catalog.tssrc/lib/forms.tssrc/lib/registry-records.tssrc/lib/registry-seed.tssrc/lib/services.tssrc/lib/universal-search.tstests/forms.test.tstests/registry-records-route.test.tstests/ui-tools.spec.tstests/worker-safe-logging.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dcb2468db2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
Summary
Why
The forms experience previously depended on owner-scoped seed records and did not expose the imported WA MHA catalog consistently to all users. This change establishes an application-owned baseline catalog that is available immediately, with private user overrides remaining isolated.
Areas touched
Verification
Clinical and production governance
Known risks and follow-up
Summary by CodeRabbit