Skip to content

fix(pr-policy): stop over-flagging presentation-only UI PRs as clinical-risk#965

Merged
BigSimmo merged 2 commits into
mainfrom
claude/pr-policy-tests-failing-5sejm2
Jul 20, 2026
Merged

fix(pr-policy): stop over-flagging presentation-only UI PRs as clinical-risk#965
BigSimmo merged 2 commits into
mainfrom
claude/pr-policy-tests-failing-5sejm2

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • The PR Policy check kept failing on nearly every PR because the clinical-risk classifier in scripts/pr-policy.mjs matched any file under src/{lib,app,components} whose path contained a generic token (clinical, search, answer, source, document, rank, citation, …). Since the whole main UI lives under src/components/clinical-dashboard/ (path contains "clinical"), plus many *search*/*answer*/*document* files, 255 of 584 src/** files (44%) auto-tripped "clinical risk" — including pure spacing/colour changes — and were then forced to complete the full 7-item Clinical Governance Preflight.
  • Narrowed classification: presentation surfaces (src/app pages + src/components) are now clinical-risk only for access/privacy tokens (auth|permission|privacy|security|upload|download|patient). Clinical behaviorsrc/app/api/**, src/lib/** (retrieval/answer/ingestion/governance/privacy), supabase/, and ingestion/governance scripts — stays fully gated.
  • Tolerant governance matching: instead of requiring the exact required item strings, a clinical-risk PR must have the section present, every box checked (no - [ ]), and at least the required item count — tolerating light rewording/reformatting that previously failed (e.g. feat(ui): compact bottom search dock on phones everywhere except the home hero #964, fix(db): restore orphan migration versions for Supabase Preview #952).
  • Observed failures fixed: Remove home-page quick actions row and tidy spacing #963 (home-page spacing under clinical-dashboard/"requires the section"), feat(ui): compact bottom search dock on phones everywhere except the home hero #964 (search-bar restyle → "missing 4 items").

Verification

  • npm run check:pr-policy — runs node scripts/pr-policy.mjs --self-test (updated for narrowed classification + tolerant matching) and scripts/check-pr-policy-workflow.mjs (workflow contract unchanged). Both pass.
  • npx eslint scripts/pr-policy.mjs — clean; npx prettier --check scripts/pr-policy.mjs — clean.
  • Replayed real failing inputs offline: Remove home-page quick actions row and tidy spacing #963's file set + body → ok: true; a genuine clinical-behavior change (src/lib/answer-synthesis.ts) with no governance section → still fails.
  • Verification not run: full npm run verify:pr-local / verify:ui — this change is a CI metadata-policy script only (no app runtime, UI, or provider surface); the targeted self-test + lint above are the relevant gate.

Risk and rollout

  • Risk: low–medium. Deliberately reduces the clinical-governance gate's breadth so a presentation change to genuinely clinical UI (e.g. citation/source rendering components) no longer auto-requires the preflight. Access-control, privacy, auth, upload/download surfaces and all clinical behavior code remain gated. Single-file, self-tested change.
  • Rollback: revert this commit; classification returns to the prior broad behavior.
  • Provider or production effects: None. pr-policy.yml runs the trusted script from github.workflow_sha (base/main), so the relaxed rules take effect for open PRs only after this merges to main; re-running the check then re-evaluates them.

Notes

  • No workflow-file edits, so scripts/check-pr-policy-workflow.mjs and the workflow-contract self-tests stay green. The requiredClinicalGovernanceItems export is preserved (the dormant sync-pr-policy-body job in ci.yml imports it).
  • Not clinical-risk under the new (or old) rules — scripts/pr-policy.mjs matches no clinical token — so the Clinical Governance Preflight section does not apply to this PR.

🤖 Generated with Claude Code


Generated by Claude Code

The PR Policy check failed on nearly every PR because the clinical-risk
classifier matched any src/{lib,app,components} file whose path contained a
generic token (clinical, search, answer, source, document, ...). The main UI
lives under src/components/clinical-dashboard/, so ~44% of src files auto-tripped
"clinical risk" and were forced through the full 7-item Clinical Governance
Preflight, which then failed whenever the section was missing or reworded.

- Narrow classification: presentation surfaces (src/app pages, src/components)
  are clinical-risk only for access/privacy/patient/upload/download tokens.
  Clinical behavior in src/lib, API routes, supabase/, and scripts stays gated.
- Tolerate governance rewording: require the section present, every box checked,
  and at least the required item count — instead of exact-string matching.
- Update self-tests to cover the narrowed classification and tolerant matching.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014MG846R4YM51NojUf9XthF
@supabase

supabase Bot commented Jul 20, 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 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@BigSimmo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ce84f82-b4f3-47bc-a17f-fbd884b21ef4

📥 Commits

Reviewing files that changed from the base of the PR and between 8096d17 and ddb65c4.

📒 Files selected for processing (1)
  • scripts/pr-policy.mjs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/pr-policy-tests-failing-5sejm2

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

@BigSimmo
BigSimmo marked this pull request as ready for review July 20, 2026 07:57
@BigSimmo
BigSimmo enabled auto-merge (squash) July 20, 2026 07:57
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@BigSimmo
BigSimmo merged commit 8fdf7fb into main Jul 20, 2026
16 checks passed
@BigSimmo
BigSimmo deleted the claude/pr-policy-tests-failing-5sejm2 branch July 20, 2026 08:00
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