Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cursor/agents/pr-babysit.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ When invoked:
7. Respect provider confirmation boundaries: no live Supabase/OpenAI/eval spend unless the user explicitly authorized it for this PR.
8. Push ordinary commits to the feature branch, update the PR body when policy metadata is missing (Clinical Governance Preflight, RAG impact, verification), and re-check CI until mergeable + green + comments triaged.
9. Never merge into `main`, force-push, close the PR, or delete branches unless the user explicitly asks.
10. Keep `PR_POLICY_BODY.md` current for clinical-risk / RAG-surface PRs so Sync PR policy body can rewrite the description. If Static fails maintainability budgets, extract a cohesive module instead of raising the budget.

Report before/after: merge state, CI, threads fixed vs left open, commits pushed, and any remaining human decision.
33 changes: 33 additions & 0 deletions PR_POLICY_BODY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Summary

- Fix cross-mode search performance findings: prescribing catalogue debounce/abort/`fields=index`, differentials abort/debounce, universal documents typeahead soft-timeout (750ms), shared `(search-app)` shell to avoid composer remount, and Answer rate-limit in-memory fallback outside production.
- Fix Bugbot regressions: shared-shell pathname navigation (`/services` → `/dsm`) syncs `searchMode` during render (no stale-mode paint) even when the query string is unchanged; extracted ClinicalDashboard lazy imports to stay under the maintainability budget.

RAG impact: no retrieval behaviour change — typeahead documents domain timeout and shell URL sync only; ranking formulas and full `/api/search` retrieval path unchanged.

## Verification

- [x] `npm run verify:pr-local` — focused Vitest on touched sources (362) plus api-rate-limit / search-shell / universal / route / site-map suites green; `docs:check-index` OK
- [x] UI verification not run: full `verify:ui` not required for this pass; mode-home smoke via `npm run ensure` returned HTTP 200 for `/`, `/services`, `/dsm`, `/documents/search`, `/therapy-compass`, `/?mode=prescribing`, and `/api/answer/stream` returned 200 after the rate-limit fallback fix
- Verification not run: `eval:retrieval:latency` / soak / live OpenAI canary — approval-gated provider work; not needed for timeout-only typeahead change

## Risk and rollout

- Risk: medium — shared layout remount change and rate-limit fallback behaviour in non-production; production Answer/upload still fail closed when the durable limiter is unavailable
- Rollback: revert this PR; mode routes return to per-segment `GlobalSearchShell` layouts and prior timeout/fallback behaviour
- Provider or production effects: None

## Clinical Governance Preflight

- [x] Source-backed claims still require linked source verification before clinical use
- [x] No patient-identifiable document workflow was introduced or expanded without explicit governance approval
- [x] Supabase target remains `[REDACTED]` (`[REDACTED]`)
- [x] Service-role keys and private document access remain server-only
- [x] Demo/synthetic content remains clearly separated from real clinical sources
- [x] Source metadata, review status, and outdated/unknown-source behavior remain conservative
- [x] Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

## Notes

- Prescribing list rows keep the full catalogue payload so Safety/Monitoring filters and patient alerts still see section-derived signals; keystroke storms are controlled by debounce + abort. `fields=index` remains for identity-only consumers (cross-mode links).
- Live hybrid RPC cold tails remain a separate approval-gated follow-up.
8 changes: 8 additions & 0 deletions docs/branch-review-ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ This file is append-only. Never rewrite or delete an existing review record; app

| Date | Branch or ref | Reviewed HEAD | Scope | Outcome | Checks |
| ---------- | -------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2026-07-24 | PR #1134 / `cursor/search-performance-review-4ee9` | `2a8e045f4a7179ea6fc9b81b1b2173e4c932617e` | Babysit closeout / merge readiness | MERGE-READY for product scope once exact-head required checks finish after final main sync. Fixed: Bugbot pathname searchMode (Compiler-safe previous-state sync); docs index; PR_POLICY_BODY/governance; maintainability extract; prescribing Safety filters (no fields=index); Sheet teardown document guard. Unresolved threads: none. Residual: human approving review; title still stale (gh/ManagePullRequest cannot edit); main may move again. | Hosted on prior tip 973d5d88: PR policy/Static/Unit/Build/Production UI/PR required all SUCCESS. Final sync pushed; awaiting exact-head recheck. No OpenAI/live Supabase writes. |
| 2026-07-24 | `cursor/search-performance-review-4ee9` / PR #1134 | 76d47871c44c607f942a683351378230173dcbe3 | Search performance findings remediation (prescribing, differentials, typeahead docs timeout, shared shell, answer rate-limit fallback) | FIXED. P1 prescribing catalogue now debounces (250 ms), aborts in-flight fetches, and uses `fields=index`. Differentials catalogue + evidence search abort/debounce. Universal documents typeahead timeout 6 s→750 ms (RAG impact: no retrieval behaviour change — typeahead timeout only). Shared `(search-app)` layout keeps GlobalSearchShell mounted across mode homes. Answer rate-limit fails closed only in production; development uses in-memory fallback when durable RPC is unavailable. | Focused Vitest 362 via test:focused; api-rate-limit/search-shell/universal/route/site-map suites green; `npm run ensure` smoke 200 on mode homes; `/api/answer/stream` 200 after fallback. No OpenAI spend beyond local answer stream smoke; no live eval/soak. |
| 2026-07-24 | `main` | `6ceaaff50712e10e857bf9a5a7ec88b530bf7b35` | Search performance across modes (load + typeahead + submit; local ensure) | CHANGES REQUESTED / findings. No P0. P1: Prescribing `useMedicationCatalog(query)` refetches the full ~2.5–2.9 MB medication catalogue on every keystroke without debounce, abort, or `fields=index` (~25× larger than index). P2: differentials catalogue + evidence `/api/search` lack abort/debounce; universal typeahead `tookMs` dominated by empty live documents domain (~130–340 ms); cross-namespace mode switches remount the search shell; Answer submit returns 503 `rate_limit_unavailable` when durable limiter is down (fail-closed). Mode HTML load medians ~40–75 ms; typeahead wall ~160–180 ms (`ssri`) / ~350–400 ms (`agitation im lorazepam`) + 250 ms client debounce; catalogue submits (differentials) ~45 ms; document `/api/search` demo-degraded ~230–430 ms. Highest residual live risk: cold hybrid RPC tails (docs #25), not re-measured with soak/eval. | `npm run ensure` → http://localhost:4461; `/api/local-project-id` Clinical KB; paced universal typeahead across 13 modes × 2 queries (Server-Timing); `/api/search` + `/api/medications` (+`fields=index`) + differentials APIs + registry payload sizes; NDJSON vs JSON first-byte; browser walkthrough of 13 mode homes; static review of ClinicalDashboard / universal-search / medication+differential hooks. No OpenAI generation, no `eval:retrieval:latency`, no soak, no hosted CI. Environment had Supabase secrets so universal ran live (`publicAccess`); `/api/search` degraded to demo (`supabase_api_key_configuration_unavailable`). |


| 2026-07-24 | `codex/query-ribbon-search-headings` | `16ce57d9615708528e7924b41837210a24414722` + reviewed ledger diff | Universal Query Ribbon implementation and responsive search-heading review | APPROVE after two scoped polish fixes. The shared result header now presents query, progress/result state, scopes, and real sort/view/save controls consistently across Services, Forms, Favourites, Differentials, and Medication/Prescribing search surfaces; the mockup remains available at `/mockups/search-heading`. The review restored the compact `Sort` label at ordinary phone widths and prevents stale/unknown scope IDs from producing an empty utility strip. No P0-P2 finding remains. Retrieval, ranking, source selection, and clinical output behavior are unchanged. Highest residual risk is unexercised browser combinations outside the focused cross-route responsive matrix. | Focused header DOM 4/4; focused ESLint; `git diff --check`; live 1280px route QA with zero overflow and visible keyboard focus; production Playwright build compiled, TypeScript passed, 1,678 pages generated, and focused Chromium responsive/search/prescribing matrix passed 16/16. `verify:pr-local` passed runtime, Prettier, full ESLint, and TypeScript; its complete unit run stopped only when the unrelated load-sensitive `reconciliation-preflight` case exceeded 30 seconds, then that file passed 5/5 in isolation. No OpenAI, Supabase, Railway, deployment, production-data, or clinical provider workflow ran. |
| 2026-07-24 | `main` | `037b4808100946f96aee28b8ff51939ae2986851` | Comprehensive repository review (architecture, security/privacy, API/DB, RAG/clinical, UX/a11y, performance/CI/ops) | Changes requested. No P0. Two confirmed P1 clinical-grounding defects: (1) numeric verification skips truncated claims after the 24-claim cap when earlier claims contain numbers; (2) unsupported prescriptive treatment recommendations remain grounded as routine/partial. Multiple P2 privacy/ops findings: signed-URL cache survives sign-out; upload/enrichment/search telemetry can retain raw filenames; negated urgency still labelled Red flag; mixed `partial_invalid_model_citation_ids` evade the invalid-ID gate; readiness probe lacks an explicit dependency timeout; Railway watch patterns miss transitive build controllers. Known tracked residuals reconfirmed: #052 enrichment/reindex overlap, #059 credential containment (operator), #007 Tools route dual entry. Highest residual risk remains live answer-quality/clinical grounding plus operator credential/#053 legal gates. No source fixes applied. | Offline: runtime, migration-role, function-grants (30), owner-scope (40 routes), GitHub Actions pins, PR-policy self-test, gate/CI-scope/Codex autofix guards, lint, typecheck, sitemap, knip, knip architecture budgets, env-parity names-only, docs index/scripts, production-readiness:ci, offline RAG 36 fixtures + 21 suites/308 tests, focused clinical/RAG contract suite 122/122, Chromium accessibility 12/12 and `verify:ui` 267/267 after identity-confirmed `npm run ensure`. Targeted offline red proofs for both P1s and the citation/safety/signed-URL P2s. Provider-gated skipped: live drift, supabase-project (non-dry), migration-history, live RAG/OpenAI evals, hosted CI, Railway mutations. |
| 2026-07-24 | `remediate-audit-system-issues` | `ae54de2b10f1c586d90c62fc3e50654dd8e917a1` + fixes | Audit remediation verification and merge readiness review | READY. Fixed the P1 (Unsafe automation) by restoring the WMI process name filter while expanding it to include common node wrappers (`node|npm|npx|tsx|vitest|playwright|bun`). Fixed the P3 (maintainability friction) by adding `rimraf` to `devDependencies`, ensuring offline availability in CI. No high-confidence P0-P2 defects remain. | Static review of diff against origin/main. Fixed issues locally and re-verified. No OpenAI, Supabase, or live provider command ran. |
Expand Down Expand Up @@ -733,6 +738,8 @@ This file is append-only. Never rewrite or delete an existing review record; app
- Scope: Targeted review of search bar/header/footer chrome behaviour after the edge-to-edge phone dock fix, plus durable repo rules for page-adaptive search chrome.
- Outcome: No new P0/P1 search chrome defect found in the static review. Fixed one regression hazard: a stale ClinicalDashboard comment still instructed a 0.75rem hidden dock pad despite the implementation/tests requiring 0rem. Added durable search chrome behaviour rules in AGENTS.md and docs/search-chrome-behaviour.md, with a static guard tying the remembered rules to the hidden-reserve contract.
- Checks: dependency shortcut section count; git diff --check; targeted rg for stale 0.75rem hidden-pad source wording (only negative test assertions remain); targeted Vitest command attempted but blocked by missing node_modules/vitest under Node 20.20.2 in this container. No provider-backed checks run.
| 2026-07-24 | cursor/search-performance-review-4ee9 (PR #1134) | 022a1ab95718e5e7636226f0dfebe88d7d7bc4f4 | Run PR sweep: CI fix + threads + drift | Before: CONFLICTING, CI green (pr-required), 0 unresolved threads. After: merged origin/main cleanly (auto-merge ledger/codebase-index); pushed 022a1ab95. Threads: none. Residual: CI re-running post-merge. | merge origin/main only; no provider-backed checks run |
| 2026-07-24 | cursor/search-performance-review-4ee9 (PR #1134) | 9311d01212fe42bd41ffb22a83bfa51f1a4d19f2 | Run PR re-sync sweep | Re-check: CONFLICTING on use-differential-catalog.ts (+ related). Not cheap; merge aborted, no push. | merge origin/main and/or conflict re-check only; no provider-backed checks run |
| 2026-07-24 | cursor/comprehensive-repo-review-ledger-d9a1 (PR #1150) | 60a3c3a83a31e65ec2759540629687e7113e2489 | Run PR sweep: CI fix + threads + drift | Before: CONFLICTING, CI green, 0 threads. After: merged origin/main cleanly (ledger auto-merge); pushed 60a3c3a83. Threads: none. Residual: CI re-running. | merge origin/main only; no provider-backed checks run |
| 2026-07-24 | cursor/search-interactive-perf-af54 (PR #1138) | ff4b293d95f922e70ebf5ee9b0c156c41a8bff3b | Run PR sweep: CI fix + threads + drift | Before: CONFLICTING, CI green, 0 threads. RAG impact: no retrieval behaviour change — PR is client deferred-search/UI only (no src/lib/rag/**). After: merged origin/main; conflict resolved in src/components/ui/sheet.tsx by keeping main restoreTimersRef/unmountingRef focus-restore fix; pushed ff4b293d9. Threads: none. | merge origin/main only; no provider-backed checks run |
| 2026-07-24 | remediate-audit-system-issues (PR #1160) | 8b2359589fe61c19c78fb02be50316c8f29d7e18 | Run PR sweep: CI fix + threads + drift | before: CONFLICTING; Static PR checks + Unit coverage + PR required FAIL (stale docs/site-map.md). after: merged origin/main cleanly (2e7b034d1); regenerated site-map (8b2359589fe61c19c78fb02be50316c8f29d7e18); no unresolved review threads; CI re-running expected green for static-pr/coverage/pr-required | vitest tests/site-map.test.ts pass (6); sitemap:check pass; no provider-backed checks run |
Expand All @@ -747,3 +754,4 @@ This file is append-only. Never rewrite or delete an existing review record; app
| 2026-07-24 | remediate-audit-system-issues (PR #1160) | bdf530fc8c6faaa4491c510396b47872fc39bf25 | Run PR sweep: CI fix + threads + drift | second re-merge after main moved to 2e68888f3 during first push; clean ort merge (ledger + layout.tsx); taskkill /T retained; sitemap prettier retained | merge only; no provider-backed checks run |
| 2026-07-24 | codex/query-ribbon-search-headings (PR #1166) | c94e89f392f578c4b2c749195dd485b74959074c | Run PR re-sync sweep | Before: CONFLICTING. After: merged origin/main clean. CI re-running. | merge origin/main and/or conflict re-check only; no provider-backed checks run |
| 2026-07-24 | cursor/comprehensive-repo-review-ledger-d9a1 (PR #1150) | 345c02cdbaefb13aeb951a14674aedfe4648a50e | Run PR re-sync sweep | Before: CONFLICTING. After: merged origin/main clean. | merge origin/main and/or conflict re-check only; no provider-backed checks run |
| 2026-07-25 | codex/fix-merge-conflicts-and-ci-on-open-prs (PR #1170) | e979fc892f11a17b1a8f2ef1ab058ef40d629182 | Open-PR maintenance: CI fix + threads + drift | Before: Static PR checks failed because route-group moves made nine valid legacy `src/app/*` documentation references appear missing; 0 unresolved threads; branch already contained current main. After: docs-link resolution checks known App Router route groups and the focused failure is fixed. | `node scripts/check-docs-links.mjs` pass (1162 references); Prettier check pass; `git diff --check` pass; no provider-backed checks run. |
Loading
Loading