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
2 changes: 2 additions & 0 deletions docs/branch-review-ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,5 @@ Use this ledger to prevent repeated branch and PR reviews when the reviewed HEAD
| 2026-07-14 | PR #632 / codex/rag-performance-followups | 07cac8f4e094bf4b5ccd264feb6420fbd4e35e2b | review-followup | CodeRabbit's APP 1/5 governance contradiction was confirmed and corrected; Railway's pending DPA and Singapore processor basis are now explicit checklist/status items. The optional cache-miss granularity suggestion was not adopted because it would undo the reviewed single-read cold-miss design or require a broader schema/RPC change. | GitHub review-thread inspection; focused Prettier and `git diff --check` passed. Local production-readiness inspection reported the expected missing provider env; the Railway production-context check had already passed on this workstream. |
| 2026-07-14 | PR #632 / codex/rag-performance-followups | 0c792b8c10516c85d18832fc96562dd70a671b5f | review-followup | One P1 privacy-disclosure defect was confirmed: OpenAI retrieval embedding can receive query text even when answer synthesis remains source-only. Fixed the PIA and public `/privacy` copy to distinguish retrieval-embedding egress from model-backed synthesis egress, with focused copy coverage. | GitHub connector review-thread inspection; focused privacy UI test, ESLint, TypeScript, Prettier, production-readiness, and `git diff --check`. |
| 2026-07-14 | PR #632 / codex/rag-performance-followups | a2eb6db0efbef983e1b3242261d5cc6b2b9d839d | review-followup | One late P2 rollout-compatibility defect was confirmed: the provider-fallback SLO would omit recent rows written before `provider_generation_degraded` existed. Fixed the count predicate to include the new flag or legacy `generation_fallback:` reasons while continuing to exclude intentional extractive routes. | GitHub connector review-thread inspection; focused answer-SLO test, ESLint, TypeScript, Prettier, and `git diff --check`. |
| 2026-07-14 | codex/specifiers-design | c3e7024e15d2157bbc0b989276324cc6ad3eea5c | Specifiers UI, clinical decision-support, accessibility, and release-readiness review | One P2 WCAG contrast defect was reproduced and fixed across the builder, comparison, and map accent eyebrows. No remaining high-confidence defect was found in the changed scope; residual risk is clinical/manual governance of the original specifier summaries. | Focused Vitest 18/18; focused Chromium desktop/mobile 2/2 with serious/critical axe WCAG A/AA scanning and overflow checks; `npm run check:production-readiness:ci` READY; `npm run verify:cheap` 2,210 passed/1 skipped; `npm run verify:pr-local` 2,213 passed/1 skipped plus production build and client-bundle secret scan; `git diff --check`. Full advisory `verify:ui` exceeded the local 10-minute execution window; provider-backed checks were not run. |
| 2026-07-14 | PR #633 / codex/specifiers-design | 03daca3bfdf86517b9956f3c7d91be27d9f1a751 | Review follow-up and failed UI regression | Eight distinct P2 behaviors across nine review threads were confirmed and fixed: initial selection normalization, duplicate query removal, clinical applicability mapping, canonical Specifiers routing, severity-neutral base wording, diagnostic-section ordering, base/specifier compatibility, and severe psychotic-features wording. The failed app-menu keyboard test was a stale order assertion and now covers the inserted Specifiers item. | Focused Vitest 6/6; focused Chromium 4/4; scoped ESLint and TypeScript; CI-mode production readiness READY; production build and client-bundle secret scan passed. Hosted required checks passed on the refreshed `main` merge before the final compatibility fixes; provider-backed Supabase/OpenAI checks were not run. |
44 changes: 23 additions & 21 deletions docs/codebase-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,23 @@ Structured map for AI agents and onboarding. For live routes, see `docs/site-map
- **App shell:** `src/components/clinical-dashboard/global-search-shell.tsx` — canonical route-aware shell and lazy dashboard dispatch. The mockup-named module is a compatibility re-export used only below `/mockups`.
- **Home:** `src/app/page.tsx` — dashboard rendered by shell
- **Dashboard:** `src/components/ClinicalDashboard.tsx` + `src/components/clinical-dashboard/`
- **Modes (8):** `src/lib/app-modes.ts` — answer, documents, services, forms, favourites, differentials, prescribing, tools
- **Modes (9):** `src/lib/app-modes.ts` — answer, documents, services, forms, favourites, differentials, specifiers, prescribing, tools

### Product pages (`src/app/`)

| Route | File |
| ---------------------------------------------------- | -------------------------------------- |
| `/` | `src/app/page.tsx` |
| `/applications` | `src/app/applications/page.tsx` |
| `/differentials`, `/diagnoses`, `/presentations` | `src/app/differentials/` |
| `/documents/search`, `/source`, `/evidence`, `/[id]` | `src/app/documents/` |
| `/favourites` | `src/app/favourites/page.tsx` |
| `/forms`, `/forms/[slug]` | `src/app/forms/` |
| `/medications`, `/medications/[slug]` | `src/app/medications/` |
| `/services`, `/services/[slug]` | `src/app/services/` |
| `/mockups/*` | `src/app/mockups/` (404 in production) |
| `/auth/callback` | `src/app/auth/callback/route.ts` |
| Route | File |
| ------------------------------------------------------------------- | -------------------------------------- |
| `/` | `src/app/page.tsx` |
| `/applications` | `src/app/applications/page.tsx` |
| `/differentials`, `/diagnoses`, `/presentations` | `src/app/differentials/` |
| `/documents/search`, `/source`, `/evidence`, `/[id]` | `src/app/documents/` |
| `/favourites` | `src/app/favourites/page.tsx` |
| `/forms`, `/forms/[slug]` | `src/app/forms/` |
| `/medications`, `/medications/[slug]` | `src/app/medications/` |
| `/services`, `/services/[slug]` | `src/app/services/` |
| `/specifiers`, `/specifiers/[slug]`, `/builder`, `/compare`, `/map` | `src/app/specifiers/` |
| `/mockups/*` | `src/app/mockups/` (404 in production) |
| `/auth/callback` | `src/app/auth/callback/route.ts` |

### API routes (`src/app/api/`)

Expand Down Expand Up @@ -122,10 +123,11 @@ Structured map for AI agents and onboarding. For live routes, see `docs/site-map

### Clinical product data

| Module | Role |
| -------------------------------------------------------------------- | ------------------------- |
| `differentials.ts`, `forms.ts`, `services.ts`, `registry-records.ts` | Registry-backed content |
| `clinical-safety.ts`, `demo-data.ts`, `ui-copy.ts` | Safety copy and demo mode |
| Module | Role |
| -------------------------------------------------------------------- | ------------------------------------- |
| `differentials.ts`, `forms.ts`, `services.ts`, `registry-records.ts` | Registry-backed content |
| `specifiers.ts` | Local psychiatric specifier catalogue |
| `clinical-safety.ts`, `demo-data.ts`, `ui-copy.ts` | Safety copy and demo mode |

### Infra helpers

Expand Down Expand Up @@ -247,19 +249,19 @@ Golden retrieval fixture: `scripts/fixtures/rag-retrieval-golden.json`

### Clinical KB surface

- 8 app modes with unified search shell
- 9 app modes with unified search shell
- Documents mode: upload/manage private guidelines, search, cited answers
- Answer mode: grounded Q&A with PDF-linked citations
- Registry modes: services, forms, medications, differentials
- Registry modes: services, forms, medications, differentials; Specifiers is a local structured decision-support catalogue
- Demo mode: synthetic data when Supabase unavailable (`demo-data.ts`, `isDemoMode()` in `env.ts`)

### Global search composer placement rules

One shared composer (`master-search-header.tsx`) serves every mode. Placement:

- **Mode homes** (`/services`, `/forms`, `/favourites`, `/differentials`, `/applications`, and dashboard homes): inline in the hero via the `mode-home-composer-slot` portal, on phone and tablet+ alike.
- **Mode homes** (`/services`, `/forms`, `/favourites`, `/differentials`, `/specifiers`, `/applications`, and dashboard homes): inline in the hero via the `mode-home-composer-slot` portal, on phone and tablet+ alike.
- **Result and detail views**: fixed bottom dock on phone (compact variant on submitted searches), sticky top from `sm` up.
- **Results routing**: standalone routes own their submitted searches via `?q=…&run=1` (`/services` → `ServicesNavigatorPage`, `/forms` → `FormsSearchResultsPage`, `/differentials` → `DifferentialsHome` results view, `/favourites` filters the command library in place). Answer, Documents, and Prescribing submitted searches render inside `ClinicalDashboard` — intentional, since they need retrieval/answer state. `/?mode=favourites` redirects to `/favourites`; `/?mode=differentials` redirects to `/differentials`.
- **Results routing**: standalone routes own their submitted searches via `?q=…&run=1` (`/services` → `ServicesNavigatorPage`, `/forms` → `FormsSearchResultsPage`, `/differentials` → `DifferentialsHome` results view, `/specifiers` → local structured results, `/favourites` filters the command library in place). Answer, Documents, and Prescribing submitted searches render inside `ClinicalDashboard` — intentional, since they need retrieval/answer state. `/?mode=favourites` redirects to `/favourites`; `/?mode=differentials` redirects to `/differentials`.
- **Intentionally composer-free routes**: `/differentials/presentations/*` (comparison workflow owns its chrome), `/documents/[id]` viewer (has its own in-document ask composer), `/documents/source/*` (document flow owns mobile chrome). Do not re-flag these in search-consistency audits.
- **Local filter fields** (sidebar "Search chats", document drawer "Find a document"/"Find a source PDF") are scoped filters, not global search; they share the `fieldControlWithIcon`/`fieldIcon` primitives.

Expand Down
23 changes: 23 additions & 0 deletions docs/site-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check`
- `/privacy` - Privacy and data-processing governance draft. Source: `src/app/privacy/page.tsx`.
- `/reference/colour-coding` - Route discovered from app directory Source: `src/app/reference/colour-coding/page.tsx`.
- `/services` - Services home and search surface. Source: `src/app/services/page.tsx`.
- `/specifiers` - Psychiatric specifier home and local search surface. Source: `src/app/specifiers/page.tsx`.
- `/specifiers/builder` - Structured diagnostic wording builder. Source: `src/app/specifiers/builder/page.tsx`.
- `/specifiers/compare` - Side-by-side psychiatric specifier comparison. Source: `src/app/specifiers/compare/page.tsx`.
- `/specifiers/map` - Psychiatric specifier family map. Source: `src/app/specifiers/map/page.tsx`.
- `/tools` - Route discovered from app directory Source: `src/app/tools/page.tsx`.

## Mode/query routes
Expand All @@ -29,6 +33,7 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check`
- `/forms` - Forms mode. Search kind: `forms`. Query example: `/forms?q=transport+forms&focus=1&run=1`.
- `/favourites` - Favourites mode. Search kind: `favourites`. Query example: `/favourites?q=clozapine+set&focus=1&run=1`.
- `/differentials` - Differentials mode. Search kind: `differentials`. Query example: `/differentials?q=acute+confusion&focus=1&run=1`.
- `/specifiers` - Specifiers mode. Search kind: `specifiers`. Query example: `/specifiers?q=depressed+but+racing+thoughts&focus=1&run=1`.
- `/?mode=prescribing` - Medication mode. Search kind: `documents`. Query example: `/?mode=prescribing&q=acamprosate+renal+dose&focus=1&run=1`.
- `/?mode=tools` - Tools mode. Search kind: `tools`. Query example: `/?mode=tools&q=medications&focus=1&run=1`.

Expand All @@ -42,6 +47,7 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check`
| Forms | `/forms` | `/forms?q=transport+forms&focus=1&run=1` | `/forms/[slug]` form record pages. |
| Favourites | `/favourites` | `/favourites?q=clozapine+set&focus=1&run=1` | Saved set and saved item detail render inside the favourites page surface. |
| Differentials | `/differentials` | `/differentials?q=acute+confusion&focus=1&run=1` | `/differentials/diagnoses`, `/differentials/diagnoses/[slug]`, and `/differentials/presentations`. |
| Specifiers | `/specifiers` | `/specifiers?q=depressed+but+racing+thoughts&focus=1&run=1` | `/specifiers/[slug]`, `/specifiers/builder`, `/specifiers/compare`, and `/specifiers/map`. |
| Medication | `/?mode=prescribing` | `/?mode=prescribing&q=acamprosate+renal+dose&focus=1&run=1` | `/medications/[slug]`; `/medications` redirects to medication mode. |
| Tools | `/?mode=tools` | `/?mode=tools&q=medications&focus=1&run=1` | Tool launcher and detail panels inside dashboard tools mode (`/?mode=tools`). |

Expand Down Expand Up @@ -499,6 +505,22 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check`
- `very-late-onset-schizophrenia-like-psychosis-delusional-disorder`
- `wernicke-encephalopathy`

### Psychiatric specifier slugs

- `/specifiers/[slug]` - Dynamic route family.
- `in-full-remission`
- `in-partial-remission`
- `mild-severity`
- `with-anxious-distress`
- `with-atypical-features`
- `with-catatonia`
- `with-melancholic-features`
- `with-mixed-features`
- `with-peripartum-onset`
- `with-psychotic-features`
- `with-rapid-cycling`
- `with-seasonal-pattern`

### Medication slugs

- `/medications/[slug]` - Dynamic route family.
Expand Down Expand Up @@ -609,6 +631,7 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check`
| Forms | `src/app/forms, src/lib/forms.ts, src/app/api/registry/records` |
| Favourites | `src/app/favourites, src/components/clinical-dashboard/favourites-command-library-page.tsx` |
| Differentials | `src/app/differentials, src/lib/differentials.ts` |
| Specifiers | `src/app/specifiers, src/components/specifiers, src/lib/specifiers.ts` |
| Medications | `src/app/medications, src/components/clinical-dashboard/medication-prescribing-workspace.tsx` |
| Documents | `src/app/documents, src/lib/document-flow-routes.ts` |
| Tools | `src/components/applications-launcher-page.tsx` |
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const chromiumExecutablePath = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH;
// mockup can never mask a production-journey regression (PT-05). The two
// Tag-level filters keep production and prototype journeys disjoint even when
// they share a spec file; firefox/webkit retain the legacy full testMatch.
const productionSpecPattern = /.*ui-(smoke|stress|accessibility|tools|overlap|universal-search)\.spec\.ts/;
const productionSpecPattern = /.*ui-(smoke|stress|accessibility|tools|overlap|universal-search|specifiers)\.spec\.ts/;
const mockupSpecPattern = /.*ui-(tools|tools-collapse|tools-task-directory)\.spec\.ts/;
const mockupTag = /@mockup/;

export default defineConfig({
testDir: "./tests",
testMatch:
/.*ui-(smoke|stress|accessibility|tools|tools-collapse|tools-task-directory|overlap|universal-search)\.spec\.ts/,
/.*ui-(smoke|stress|accessibility|tools|tools-collapse|tools-task-directory|overlap|universal-search|specifiers)\.spec\.ts/,
timeout: 60_000,
retries: process.env.CI ? 1 : 0,
expect: {
Expand Down
Loading