From df1266970dc7ba056142b6c39b8311c1914e473d Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Tue, 18 Aug 2026 12:16:11 +0800 Subject: [PATCH 1/2] Revert "Merge pull request #2065 from BigSimmo/claude/s1c-trigger-condition-first-4pb1at" This reverts commit 964869fc36aa97a4951e31ea26855dde043c26dc, reversing changes made to aade20abaaff3d09166f23ba478eb1bb530d496f. --- src/lib/rag/rag-claim-support.ts | 5 ---- tests/rag-claim-support.test.ts | 48 -------------------------------- 2 files changed, 53 deletions(-) diff --git a/src/lib/rag/rag-claim-support.ts b/src/lib/rag/rag-claim-support.ts index ad521cf044..b4df666079 100644 --- a/src/lib/rag/rag-claim-support.ts +++ b/src/lib/rag/rag-claim-support.ts @@ -166,11 +166,6 @@ function highRiskTriggerTokens(value: string) { const triggerPatterns = [ /\b(?:when|whenever|if|unless|during|after|before)\b\s*([^,;.!?]+?)(?=\s*,|\s+\b(?:administer|avoid|cease|continue|discontinue|escalate|give|prescribe|start|stop|use|withhold)\b|[;.!?]|$)/gi, /\b(?:administer|avoid|cease|continue|discontinue|escalate|give|prescribe|start|stop|use|withhold)\b[^,;.!?]{0,80}?\bfor\b\s*([^,;.!?]+?)(?=\s+\bfor\b|\s*,|[;.!?]|$)/gi, - // Condition-first phrasing: a claim-leading "For , …" - // or "In , …" binds its condition exactly like when/if phrasing — - // previously this shape extracted no tokens, so the condition never had to - // appear in the supporting segment (S1c follow-up). - /^\s*(?:for|in)\s+([^,;.!?]{1,60}?)\s*,/gi, ]; for (const pattern of triggerPatterns) { for (const match of value.matchAll(pattern)) { diff --git a/tests/rag-claim-support.test.ts b/tests/rag-claim-support.test.ts index 886b98b825..426cb2e76a 100644 --- a/tests/rag-claim-support.test.ts +++ b/tests/rag-claim-support.test.ts @@ -285,54 +285,6 @@ describe("deterministic claim support", () => { ).toBe(false); }); - it("binds a claim-leading population condition to the supporting segment (condition-first trigger)", () => { - // "For elderly patients, …" previously extracted no trigger tokens, so an - // atom-free neighbouring bullet that merely mentions the population could - // lend its topics and let the adult dose be mis-bound to the elderly claim. - // (A digit-bearing population phrase like "over 65 years" is already caught - // by the atom-free-neighbour rule; this pins the digit-free phrasing.) - const adultDoseWithPopulationProse = source( - "adult-dose-population-prose", - [ - "• The usual oral starting dose for adults is 500 mg nocte.", - "• Elderly patients require cautious dose titration.", - ].join("\n"), - { title: "Lithium Clinical Guideline(EMHS)", file_name: "Lithium Clinical Guideline(EMHS).pdf" }, - ); - - expect( - sourceDirectlySupportsAnswerText( - "For elderly patients, start lithium at 500 mg nocte.", - adultDoseWithPopulationProse, - ), - ).toBe(false); - }); - - it("keeps supporting a faithful condition-first restatement whose segment covers the condition", () => { - const emhs = source( - "emhs-lithium-condition-first", - [ - "• The usual oral starting dose for adults is 500 mg nocte and for patients over 65 years it", - "is 250 mg nocte.", - ].join("\n"), - { title: "Lithium Clinical Guideline(EMHS)", file_name: "Lithium Clinical Guideline(EMHS).pdf" }, - ); - - expect(sourceDirectlySupportsAnswerText("For patients over 65 years, start lithium at 250 mg nocte.", emhs)).toBe( - true, - ); - }); - - it("binds a claim-leading in-condition the same way", () => { - const renal = source("renal-monitoring", "Monitor lithium levels closely in renal impairment."); - const hepatic = source("hepatic-monitoring", "Monitor lithium levels closely in hepatic impairment."); - - expect(sourceDirectlySupportsAnswerText("In renal impairment, monitor lithium levels closely.", renal)).toBe(true); - expect(sourceDirectlySupportsAnswerText("In renal impairment, monitor lithium levels closely.", hepatic)).toBe( - false, - ); - }); - it("keeps a wrapped escalation recipient in the directly supporting source segment", () => { const wrappedRule = source( "wrapped-escalation-rule", From fa87b775380302d0d9d0089fb1942e61201c69ea Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Tue, 18 Aug 2026 12:17:08 +0800 Subject: [PATCH 2/2] docs(ledger): record the #2065 revert review Co-Authored-By: Claude Fable 5 --- ...c65ae47bc683f553fb5e5726f2fe111fb3f93fa9386e7b46b20.record.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/branch-review-records/a843a22bab4d2c65ae47bc683f553fb5e5726f2fe111fb3f93fa9386e7b46b20.record.md diff --git a/docs/branch-review-records/a843a22bab4d2c65ae47bc683f553fb5e5726f2fe111fb3f93fa9386e7b46b20.record.md b/docs/branch-review-records/a843a22bab4d2c65ae47bc683f553fb5e5726f2fe111fb3f93fa9386e7b46b20.record.md new file mode 100644 index 0000000000..e9c6015a57 --- /dev/null +++ b/docs/branch-review-records/a843a22bab4d2c65ae47bc683f553fb5e5726f2fe111fb3f93fa9386e7b46b20.record.md @@ -0,0 +1 @@ +| 2026-08-18 | claude/revert-2065-claim-condition-regression | df1266970dc7ba056142b6c39b8311c1914e473d | revert PR #2065 (claim-leading for/in condition binding) after live canary 32097916649 regressed agitation-im-po-route-short-terms to 0 citations; deterministic extractive path bisected to 964869fc3 | single-commit revert; probe restores 5 citations; offline 614/614; confirmation canary owed post-merge | vitest rag-claim-support 157/157; eval:rag:offline 614/614; check:rag:fixtures 36 golden; live probe x2 |