docs(rag): fix buildRagSourceBlock & applyNumericVerification citations after the src/lib/rag extraction#998
Conversation
…ations after #994/#997 PR #994 extracted the rag cluster into src/lib/rag/ and did a mechanical `src/lib/rag.ts` -> `src/lib/rag/rag.ts` path bump on the two safety docs, but several symbols do not live in rag.ts at all — leaving the citations pointing at the wrong file/line (flagged in the #994 review). #997 then shifted rag.ts line numbers again. This re-verifies every affected citation against the current code. - rag-injection-threat-model.md: all `buildRagSourceBlock` field/assembly citations now point at `src/lib/rag/rag-source-block.ts` (the extracted module, as §6 already noted); `answerInstructions`/`buildAnswerInput` remain in `rag.ts` with corrected line numbers; numeric-verification helpers point at `answer-verification.ts` with the renamed `sourceClinicalValueAtomSet`. - clinical-hazard-analysis.md: `applyNumericVerification` and its helpers (`hasActionableNumericContext`, blank-to-gap, per-section scoping, `verifyAnswerNumbers`, token patterns, union scoping) now cite their real definition in `answer-verification.ts` plus the call site `rag.ts:4753`; the H6b RAW-field refs point at `rag-source-block.ts`. Every cited file:line was verified against HEAD; docs pass `prettier --check`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHShvB83oyi7sLUFRvnYB
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated two safety documents with current code references and revised descriptions of numeric verification, prompt-field handling, fencing, injection vectors, mitigations, and citation-scoping behavior. No exported or public entities were changed. ChangesSafety documentation updates
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
PR #998 (merged) already refreshed the file:line citations after the rag.ts decomposition, so this trims the parallel #1000 down to the one durable complement #998 left untouched: line 14 still claimed each control is "cited at its present location" — an absolute-currency claim that re-stales on every refactor. Replace it with an as-of-#998 note plus guidance to search by the named symbol when a line has drifted (docs:check-links validates the path, not the line). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Jc1ZYHFjXjn6mE6U6riVU
Summary
Follow-up to the merged #994 review. #994 extracted the rag cluster into
src/lib/rag/and did a mechanicalsrc/lib/rag.ts→src/lib/rag/rag.tspath bump on the two safety docs. But several cited symbols do not live inrag.tsat all, so the citations ended up pointing at the wrong file/line — exactly what the CodeRabbit review flagged. #997 (rag-evidence-gatesextraction) then shiftedrag.tsline numbers again by −129. This PR re-verifies every affected citation against currentHEADso both documents are reproducible again.Resolves the two review comments on #994:
buildRagSourceBlockcitations (docs/rag-injection-threat-model.md): the prompt-assembly and per-field render sites (title/file_name/caption/tableTitle/tableLabel/tableTextSnippet/memory_cards/retrieval_synopsis/adjacent_context/section_path/table_facts/indexing_quality/fenced content/id lines) now point at the extracted modulesrc/lib/rag/rag-source-block.ts(lines 112–185), as §6 already noted.answerInstructions(rag.ts:3884) andbuildAnswerInput/answer-input assembly (rag.ts:3938, cross-doc briefrag.ts:3998) are retained inrag.tswith corrected line numbers.applyNumericVerificationcitations (docs/clinical-hazard-analysis.md): the helper and its internals (hasActionableNumericContext, blank-to-gap, per-section scoping,verifyAnswerNumbers,NUMERIC_TOKEN_PATTERN, and the union set — renamedsourceNumericTokenSet→sourceClinicalValueAtomSet) now cite their real definition insrc/lib/answer-verification.tsplus the call siterag.ts:4753. The companion H6b RAW-field refs also move torag-source-block.ts.Scope is limited to these two flagged citation groups across both companion docs. Other pre-existing stale
rag.tsreferences from the same refactor (e.g.sanitizeCitations,deriveConfidence,evaluateEvidenceCoverageGate) were not in scope of these comments and are left for a separate sweep — noted here for visibility.Verification
prettier --checkpasses on both files (table alignment preserved — replacements are equal-width)file:lineverified bysed/grepagainst the rebasedHEAD(4a72c93)Risk and rollout
Clinical Governance Preflight
N/A — this change edits only two analysis documents' internal code cross-references. No ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output behavior is modified.
Notes
Rebased onto the current
origin/main(4a72c93, includes #997) before verifying, so the line numbers reflect post-#997rag.ts.Generated by Claude Code
Summary by CodeRabbit