Skip to content

Drop seven unreachable alternatives from the Smart search rules - #2716

Closed
BigSimmo wants to merge 1 commit into
mainfrom
claude/optimistic-goldberg-bq6wku
Closed

Drop seven unreachable alternatives from the Smart search rules#2716
BigSimmo wants to merge 1 commit into
mainfrom
claude/optimistic-goldberg-bq6wku

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Seven modeExpansionRules patterns in src/lib/smart-search-intent.ts listed a long phrase alongside a shorter phrase that the long one always contains. Alternation tries the shorter branch first and it always wins, so the longer branch could never be reached. Two are in Prescribing, one in Tools, and four in Calculators.
  • Each pattern now carries only the reachable phrase. Nothing is added, removed, or retargeted, and no rule changes which queries it fires on.
Mode Was Now
Prescribing medicine that needs regular blood tests|regular blood tests regular blood tests
Prescribing medicine for alcohol dependence|alcohol dependence alcohol dependence
Tools check medication interactions|medication interactions medication interactions
Calculators screen depression severity|depression severity depression severity
Calculators measure anxiety symptoms|anxiety symptoms anxiety symptoms
Calculators screen hazardous drinking|hazardous drinking hazardous drinking
Calculators rate obsessive compulsive symptoms|obsessive compulsive symptoms obsessive compulsive symptoms

Why this is behaviour-identical: in every pair the surviving phrase is a suffix of the deleted one and is preceded there by a space, so the \b boundaries land in the same places. Any string the old pattern matched, the new one matches. This was checked over 126 framed strings per-pattern (prefixes medicine that needs, check, screen, measure, rate, adjacent-character, hyphenation, case and whitespace variants) with zero differences, and the existing unit tests already assert three of these rules using the long phrasing and pass unchanged.

RAG impact: no retrieval behaviour change — src/lib/smart-search-intent.ts is offline catalogue vocabulary expansion for the Smart modes, not a document retrieval or ranking surface, and this change is a proven no-op within it. No file under src/lib/rag/, no retrieval RPC, no golden fixture, and no ranking contract test is touched.

Verification

  • npm run test:focused -- --files src/lib/smart-search-intent.ts — 113 test files, 1225 tests passed
  • npm run lint — clean, --max-warnings 0
  • npm run typecheck — clean
  • npm run format — whole-tree, committed

Verification not run: npm run verify:pr-local — its dry run selects full heavy scope including npm run build, deferred to CI, which runs the same required gates on this head.

UI verification not run: no UI, routing, or styling file changed, so npm run verify:ui does not apply.

npm run eval:retrieval:quality does not apply. This is catalogue term expansion, not document retrieval, ranking, selection, chunking, or scoring.

No tests were added or changed. The equivalence proof is that the existing tests, which use the long phrasing this PR deletes, still pass against the trimmed patterns.

Risk and rollout

  • Risk: very low. Seven lines changed, no lines added, and the change is a proven no-op on a pure offline module.
  • Rollback: revert the single commit.
  • Provider or production effects: None. No provider call, no network access, and no schema change.

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 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

Basis for the seven items above: the diff deletes unreachable regex alternatives in one pure, offline module. It makes no provider call, no network request, and no schema or Supabase change, and it neither reads nor writes document content, source metadata, review status, or credentials. Deployment classification was considered and is unchanged, because the change is behaviour-identical and produces no clinical recommendation.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_012j3M3zd5PkGfN5vJe3BiSU


Generated by Claude Code


Note

Low Risk
Offline catalogue vocabulary expansion only; seven regex simplifications with no intended change to which queries match or which terms expand.

Overview
Removes seven dead regex alternates in modeExpansionRules inside smart-search-intent.ts. Each pattern previously listed a longer phrase and a shorter substring; matching always hit the shorter branch first, so the longer arm was unreachable.

Prescribing (regular blood tests, alcohol dependence), Tools (medication interactions), and Calculators (four severity/symptom phrases) now use only the surviving substring. Associated terms and which queries trigger expansion are unchanged—this is a readability/cleanup pass, not a retargeting of rules.

Reviewed by Cursor Bugbot for commit fef557b. Configure here.

Seven expansion patterns listed a long phrase alongside a shorter one that the
long phrase always contains, so the shorter alternative matched first and the
longer one could never be reached. Two are in Prescribing, one in Tools, and
four in Calculators.

The trimmed patterns are behaviour-identical: in each pair the surviving phrase
is a suffix of the deleted one and carries the same word boundaries, so every
string the old pattern matched the new one matches too. The existing unit tests
already exercise three of these rules using the long phrasing and still pass
unchanged, which is the proof that nothing moved.

No rule is added, removed, or retargeted. This deletes dead text only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012j3M3zd5PkGfN5vJe3BiSU
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 9471c6c2-45e6-47aa-a88c-523e5fe9432b


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T09:31:32.846472Z fef557b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@supabase

supabase Bot commented Sep 7, 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 ↗︎.

@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5df8c4af-ce19-4dd1-914b-31ce64c07e18)

@BigSimmo

Copy link
Copy Markdown
Owner Author

Consolidated into #2736 at db6376e. The complete original head fef557b is retained as an ancestor, including its code, tests and audit requests. Closing this duplicate review/CI stream under the authorised consolidation; source branch retained. Current verification and remaining merge prerequisites are recorded on #2736. This closure does not claim that the successor is merged or that its required CI is green.

@BigSimmo BigSimmo closed this Sep 10, 2026
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.

2 participants