Skip to content

fix(rag): preserve registry route metadata during normalization - #442

Merged
BigSimmo merged 1 commit into
mainfrom
fix/registry-metadata-normalization
Jul 9, 2026
Merged

fix(rag): preserve registry route metadata during normalization#442
BigSimmo merged 1 commit into
mainfrom
fix/registry-metadata-normalization

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Keep registry_record_kind, registry_record_slug, registry_record_subkind, and registry_record_id when normalizing search result metadata so registry citations resolve to native detail pages instead of falling back to /documents/.

Summary

Verification

  • npm run verify:cheap
  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
  • npm run verify:release before release or handoff confidence claims
  • npm run format:check
  • npm run eval:retrieval:quality (must stay 36/36) when retrieval, ranking, selection, chunking, or scoring behavior changed — CI cannot run it (needs live keys), so run it locally and paste the summary. A metadata/governance-weighting change once buried correct docs (recall 1.0→0.76) and only this eval caught it.
  • npm run eval:rag -- --limit 15 + npm run eval:quality -- --rag-only when answer generation, the synthesis prompt, or answer post-processing changed (grounded-supported must not drop; citation-failure 0)
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed
  • npm run check:deployment-readiness when deployment startup, hosting, or rollout behavior changed

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • 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 Clinical KB Database (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

Notes

Keep registry_record_kind, registry_record_slug, registry_record_subkind, and registry_record_id when normalizing search result metadata so registry citations resolve to native detail pages instead of falling back to /documents/<uuid>.

Co-authored-by: Cursor <cursoragent@cursor.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) July 9, 2026 10:51
@supabase

supabase Bot commented Jul 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a84670f1-4784-4cf4-8085-6e01652b79b9

📥 Commits

Reviewing files that changed from the base of the PR and between b037757 and 39d26b0.

📒 Files selected for processing (2)
  • src/lib/source-metadata.ts
  • tests/source-metadata.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved metadata handling for registry-related records, so more registry details are now preserved during normalization.
    • Registry entries now retain their kind, subkind, ID, and slug information more reliably, including cases where some values are unset.

Walkthrough

The normalizeSourceMetadata function now normalizes four additional registry record fields (kind, subkind, id, slug) using stringOrNull. A corresponding unit test verifies these fields are preserved correctly for registry_record source kind inputs.

Changes

Registry record metadata normalization

Layer / File(s) Summary
Registry field normalization
src/lib/source-metadata.ts
Adds normalization of registry_record_kind, registry_record_subkind, registry_record_id, and registry_record_slug fields via stringOrNull.
Test coverage
tests/source-metadata.test.ts
Adds a test verifying registry route metadata is preserved for source_kind: "registry_record" inputs.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 6

❌ Failed checks (6 inconclusive)

Check name Status Explanation Resolution
Generated And Sensitive Files ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Verification Claims ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Risky Git Or Deployment Actions ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Supabase Project And Schema Safety ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Runtime And Package Manager Integrity ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Api Route Failure Handling ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving registry route metadata during normalization.
Description check ✅ Passed The description directly matches the change by explaining that registry_record fields are retained during metadata normalization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/registry-metadata-normalization
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/registry-metadata-normalization

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Comment @coderabbitai help to get the list of available commands.

@BigSimmo
BigSimmo merged commit ac5a6e1 into main Jul 9, 2026
9 checks passed
@BigSimmo
BigSimmo deleted the fix/registry-metadata-normalization branch July 9, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant