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
67 changes: 54 additions & 13 deletions data/repo-awareness-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "repo-awareness-snapshot-v1",
"captured_revision": {
"sha": "a4d600782727ffbd4fc0e899a3c502c5a668bf5e",
"committed_at": "2026-09-01T23:34:27+08:00"
"sha": "f159844f1c5e8cf22871479a58f0deea00691a81",
"committed_at": "2026-09-02T00:24:19+08:00"
},
"routes": {
"modes": [
Expand Down Expand Up @@ -78,6 +78,12 @@
"home": "/?mode=services",
"dev_only": false
},
{
"id": "sources",
"label": "Sources",
"home": "/sources",
"dev_only": false
},
{
"id": "specifiers",
"label": "Specifiers",
Expand Down Expand Up @@ -173,11 +179,6 @@
"file": "src/app/(search-app)/dictionary/search/page.tsx",
"area": "product"
},
{
"path": "/dictionary/sources",
"file": "src/app/(search-app)/dictionary/sources/page.tsx",
"area": "product"
},
{
"path": "/dictionary/topics",
"file": "src/app/(search-app)/dictionary/topics/page.tsx",
Expand Down Expand Up @@ -1028,6 +1029,31 @@
"file": "src/app/(search-app)/services/search/page.tsx",
"area": "product"
},
{
"path": "/sources",
"file": "src/app/(search-app)/sources/page.tsx",
"area": "product"
},
{
"path": "/sources/[sourceId]",
"file": "src/app/(search-app)/sources/[sourceId]/page.tsx",
"area": "product"
},
{
"path": "/sources/method",
"file": "src/app/(search-app)/sources/method/page.tsx",
"area": "product"
},
{
"path": "/sources/publishers",
"file": "src/app/(search-app)/sources/publishers/page.tsx",
"area": "product"
},
{
"path": "/sources/topics",
"file": "src/app/(search-app)/sources/topics/page.tsx",
"area": "product"
},
{
"path": "/specifiers/[slug]",
"file": "src/app/(search-app)/specifiers/[slug]/page.tsx",
Expand Down Expand Up @@ -1120,6 +1146,11 @@
"file": "src/app/(search-app)/dictionary/browse/page.tsx",
"target": "/dictionary/search"
},
{
"path": "/dictionary/sources",
"file": "src/app/(search-app)/dictionary/sources/page.tsx",
"target": "/sources?usedBy=dictionary"
},
{
"path": "/differentials",
"file": "src/app/(search-app)/differentials/page.tsx",
Expand Down Expand Up @@ -1429,11 +1460,11 @@
}
],
"counts": {
"modes": 15,
"pages": 200,
"product_pages": 63,
"modes": 16,
"pages": 204,
"product_pages": 67,
"mockup_pages": 137,
"redirects": 17,
"redirects": 18,
"api": 60
}
},
Expand Down Expand Up @@ -3594,6 +3625,11 @@
"section": "superpowers",
"catalogued": false
},
{
"path": "docs/superpowers/plans/2026-09-01-sources-mode.md",
"section": "superpowers",
"catalogued": false
},
{
"path": "docs/superpowers/rag-upgrade/canonical/approval-matrix.md",
"section": "superpowers",
Expand Down Expand Up @@ -3894,6 +3930,11 @@
"section": "superpowers",
"catalogued": false
},
{
"path": "docs/superpowers/specs/2026-09-01-sources-mode-design.md",
"section": "superpowers",
"catalogued": false
},
{
"path": "docs/testing.md",
"section": "root",
Expand Down Expand Up @@ -4326,9 +4367,9 @@
}
],
"counts": {
"documents": 564,
"documents": 566,
"catalogued": 111,
"uncatalogued": 453,
"uncatalogued": 455,
"sections": 21
}
},
Expand Down
19 changes: 11 additions & 8 deletions docs/codebase-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ Smaller top-level directories that are easy to miss:
- **PWA:** `docs/pwa.md` — install assets, privacy-first service worker/offline shell, lifecycle, security, and verification
- **Home:** `src/app/(search-app)/page.tsx` — dashboard rendered by shell
- **Dashboard:** `src/components/ClinicalDashboard.tsx` + `src/components/clinical-dashboard/`
- **Modes (15):** `src/lib/app-modes.ts` — answer, documents, services, forms, favourites, differentials, DSM-5 diagnosis, specifiers, formulation, prescribing, tools, calculators, Therapy, Factsheets, Dictionary
- **Modes (16):** `src/lib/app-modes.ts` — answer, documents, services, forms, favourites, differentials, DSM-5 diagnosis, specifiers, formulation, prescribing, tools, calculators, Therapy, Factsheets, Dictionary, Sources
- **Sources catalogue:** `/sources` provides a read-only, quality-banded catalogue with Topics, Publishers, Method and source-detail traceability; `/dictionary/sources` redirects into its Dictionary-filtered view.
- **Therapy review disclosure.** Therapy was `devOnly` while its 205-record catalogue awaited qualified-clinician sign-off. That hid the mode from production navigation, 404'd `/therapy-compass` in the route layout, and made `therapyRecordsForEnvironment` filter every record out — so all 205 detail/brief/sheet routes and every universal-search therapy hit 404'd for real users while working locally. The owner's decision (2026-08-19) replaced the gate with disclosure: reachability is no longer conditioned on review status anywhere, and the caveat is stated instead — catalogue-wide by `TherapyReviewNotice` above the Therapy home hero (counts from the generated `THERAPY_CATALOGUE_SUMMARY.needsReviewCount`, kept in step by the index generator's check mode), and per record by the `reviewStatus` badge on every card, detail page, brief, sheet, comparison, pathway, and universal-search result. `therapyNeedsReview` survives as the label source only. Pinned by `tests/app-modes.test.ts` (reachability), `tests/therapy-review-regressions.test.ts` (the notice and the per-record badges), and `tests/therapy-pr-unblocking-contract.test.ts` (the retired `PLAYWRIGHT_OFFLINE_MODE` bypass that existed only to reach the gated route).

### Product pages (`src/app/`)
Expand All @@ -89,7 +90,8 @@ Smaller top-level directories that are easy to miss:
| `/dsm`, `/dsm/search`, `/dsm/compare`, `/dsm/diagnoses/[slug]` | `src/app/(search-app)/dsm/` |
| `/documents/search`, `/source`, `/evidence`, `/[id]` | `src/app/(search-app)/documents/` |
| `/factsheets`, `/factsheets/search`, `/factsheets/topics`, `/factsheets/[slug]` | `src/app/(search-app)/factsheets/` |
| `/dictionary`, Terms (`/search`, one catalogue — `/browse` redirects to it), Topics, Definition, Compare, Sources | `src/app/(search-app)/dictionary/` |
| `/dictionary`, Terms (`/search`, one catalogue — `/browse` redirects to it), Topics, Definition, Compare | `src/app/(search-app)/dictionary/` |
| `/sources`, `/sources/topics`, `/sources/publishers`, `/sources/method`, `/sources/[sourceId]` | `src/app/(search-app)/sources/` |
| `/favourites` | `src/app/(search-app)/favourites/page.tsx` |
| `/forms`, `/forms/[slug]` | `src/app/(search-app)/forms/` |
| `/medications`, `/medications/[slug]` | `src/app/(search-app)/medications/` |
Expand Down Expand Up @@ -166,11 +168,12 @@ domain-extracted directory; imported as `@/lib/rag/rag*`). Other modules below r

### Source governance and metadata

| Module | Role |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `source-metadata.ts`, `source-governance.ts`, `source-text-sanitizer.ts` | Source provenance and governance |
| `documents/` (`is-public-document.ts`), `document-label-governance.ts`, `document-tags.ts`, `document-organization.ts` | Labels, organization, and public boundary checks |
| `table-review.ts`, `accessible-table-normalization.ts` | Table facts |
| Module | Role |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `source-metadata.ts`, `source-governance.ts`, `source-text-sanitizer.ts` | Source provenance and governance |
| `sources/` | Client-safe catalogue contracts, deterministic ratings, provider adapters and loader |
| `documents/` (`is-public-document.ts`), `document-label-governance.ts`, `document-tags.ts`, `document-organization.ts` | Labels, organization, and public boundary checks |
| `table-review.ts`, `accessible-table-normalization.ts` | Table facts |

### Supabase, auth, env

Expand Down Expand Up @@ -707,7 +710,7 @@ terminology: `docs/care-plan-context.md`; build history and rulings: `docs/care-

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

- **Mode homes**: all 15 modes use the one shared home at `/?mode=<id>` (including Answer at `/`), while four routes still own a functional home of their own — `/medications` (the Prescribing workspace, with dose/safety/monitoring checks), `/favourites` (a hub), `/tools` (a launcher) and `/documents` (dashboard-owned: browse, recent documents and the document-search empty state). None of those four is a duplicate of the shared home; each is its mode’s only functional surface. Composer inline in the hero via the `mode-home-composer-slot` portal, on phone and tablet+ alike. The other ten modes were consolidated onto the shared home: `/services`, `/forms`, `/differentials`, `/dsm`, `/specifiers`, `/formulation`, `/calculators`, `/factsheets`, `/dictionary` and `/therapy-compass` are now `redirect()` stubs (`src/lib/consolidated-mode-home-redirect.ts`, resolved in `src/proxy.ts` so they emit a real 307 rather than a streamed meta-refresh). Calculators and Dictionary are full modes in this inventory, not route aliases. Their per-mode copy is `sharedHomePresentation` in `src/lib/ui-copy.ts`. (`/applications` is a redirect to `/tools`, not a mode or composer surface.)
- **Mode homes**: all 16 modes use the one shared home at `/?mode=<id>` (including Answer at `/`), while five routes still own a functional home of their own — `/medications` (the Prescribing workspace, with dose/safety/monitoring checks), `/favourites` (a hub), `/tools` (a launcher), `/documents` (dashboard-owned: browse, recent documents and the document-search empty state) and `/sources` (the source catalogue). None of those five is a duplicate of the shared home; each is its mode’s only functional surface. Composer inline in the hero via the `mode-home-composer-slot` portal, on phone and tablet+ alike. The other ten modes were consolidated onto the shared home: `/services`, `/forms`, `/differentials`, `/dsm`, `/specifiers`, `/formulation`, `/calculators`, `/factsheets`, `/dictionary` and `/therapy-compass` are now `redirect()` stubs (`src/lib/consolidated-mode-home-redirect.ts`, resolved in `src/proxy.ts` so they emit a real 307 rather than a streamed meta-refresh). Calculators and Dictionary are full modes in this inventory, not route aliases. Their per-mode copy is `sharedHomePresentation` in `src/lib/ui-copy.ts`. (`/applications` is a redirect to `/tools`, not a mode or composer surface.)
- **Information (detail) pages**: catalogue/record routes under each mode (`/services/[slug]`, `/forms/[slug]`, `/medications/[slug]`, `/specifiers/[slug]`, `/formulation/[slug]`, `/factsheets/[slug]`, `/dictionary/[slug]`, `/dictionary/topics/[slug]`, `/therapy-compass/[slug]`, `/dsm/diagnoses/[slug]`, …). Route detection: `src/lib/information-pages.ts` (`isInformationPage`). Shared outer chrome: `src/components/information-page-shell.tsx` (`InformationPageShell`, breadcrumbs, optional footer). Specifier/formulation mode shells re-export that primitive. Intentional opt-outs: document viewer and the differentials presentation workflow.
- **Result and detail views**: fixed bottom dock on phone (compact variant on submitted searches), sticky top from `sm` up.
- **Results routing**: each consolidated mode owns its submitted searches at `<mode>/search` (`/services/search` → `ServicesNavigatorPage`, `/forms/search` → `FormsSearchResultsPage`, `/differentials/search` → `DifferentialsHome` results view, `/formulation/search` → local mechanism results, and the same shape for dsm, dictionary, factsheets, specifiers, calculators, therapy-compass and documents). That split is not cosmetic: the bare path redirects to the shared home, so routing a submitted query back at it would loop — `consolidatedModeHomeModeIds` drives both halves from one list, and `tests/consolidated-mode-home-redirect.test.ts` pins the no-loop property. `/favourites` and `/tools` keep filtering in place on their own routes. Answer, Documents, and Prescribing submitted searches render inside `ClinicalDashboard` — intentional, since they need retrieval/answer state. Bare `/?mode=<id>` always renders the shared home with that mode preselected; only a submitted deep link (`q` plus `run=1`) resolves onward to the mode's own search surface.
Expand Down
8 changes: 4 additions & 4 deletions docs/design-system/ADOPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,12 @@ product exclusions; the only route-only dispositions are the documented legacy-r
surfaces. Shared shell/component roots carry their own explicit `shared-shell` disposition.

Registered public components: 55
Declared product roots: 84
Declared product roots: 89
Roots with a literal `.ckb-v2` opt-in: 1
Roots inheriting `.ckb-v2` from the global `<html>`: 83
Roots inheriting `.ckb-v2` from the global `<html>`: 88
Production surfaces observed under v2: 15/15
Dynamic `ckb-v2` constructions: 0
Declared production page routes: 76/76
Declared production page routes: 81/81

Source observation and contract declaration are independent. A literal `ckb-v2` on the global `<html>` makes every production surface inherit v2, but it does not approve that adoption.
The Proof column summarizes each surface's dark, forced-colours, 320px, print and browser declarations; exact statuses and evidence paths live in the manifest.
Expand All @@ -371,7 +371,7 @@ Observed v2 under a compatibility declaration fails closed. A declared v2 shell
| Surface | Disposition | Routes | Roots | Declared shell | Observed shell (mount) | Proof | Baseline |
| ---------------------------------- | --------------- | -----: | ----: | -------------- | -------------------------- | -------------- | -------------- |
| `root-shell-and-settings` | shared-shell | 3 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed |
| `catalogues-forms-and-info` | owned | 24 | 24 | v2 | v2 (inherited-global-root) | passed | not-committed |
| `catalogues-forms-and-info` | owned | 29 | 29 | v2 | v2 (inherited-global-root) | passed | not-committed |
| `differentials` | owned | 7 | 7 | v2 | v2 (inherited-global-root) | passed | not-committed |
| `formulation` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed |
| `specifiers` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed |
Expand Down
9 changes: 7 additions & 2 deletions docs/design-system/adoption-contract.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@
"src/app/(search-app)/medications/[slug]/page.tsx",
"src/app/(search-app)/services/[slug]/page.tsx",
"src/app/(search-app)/services/page.tsx",
"src/app/(search-app)/services/search/page.tsx"
"src/app/(search-app)/services/search/page.tsx",
"src/app/(search-app)/sources/[sourceId]/page.tsx",
"src/app/(search-app)/sources/method/page.tsx",
"src/app/(search-app)/sources/page.tsx",
"src/app/(search-app)/sources/publishers/page.tsx",
"src/app/(search-app)/sources/topics/page.tsx"
],
"routeRoots": true,
"roots": [],
Expand All @@ -166,7 +171,7 @@
},
"browser": {
"status": "passed",
"evidence": ["tests/ui-visual-baseline.spec.ts"]
"evidence": ["tests/ui-sources.spec.ts", "tests/ui-visual-baseline.spec.ts"]
}
},
"baseline": {
Expand Down
Loading
Loading