Skip to content

Consolidate Documents and Medications into the shared mode home - #2614

Merged
BigSimmo merged 6 commits into
mainfrom
claude/psychsift-modes-architecture-378ktx
Sep 4, 2026
Merged

Consolidate Documents and Medications into the shared mode home#2614
BigSimmo merged 6 commits into
mainfrom
claude/psychsift-modes-architecture-378ktx

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • /documents and /medications no longer render their own idle-view content. Visiting either with no query now redirects (a real server-side 307, not a client-side flash) to the shared home — /?mode=documents and /?mode=prescribing — matching the ten modes already consolidated this way (dsm, forms, services, differentials, specifiers, formulation, calculators, therapy-compass, factsheets, dictionary). Submitted searches are untouched: /documents?q=...&run=1 still lands on /documents/search, and /medications?q=...&run=1 still lands on /?mode=prescribing&q=...&run=1, exactly as before.
  • Documents joins the shared consolidatedModeHomePaths map (src/lib/consolidated-mode-home-redirect.ts) the other ten modes already use — it has a real /documents/search route, so the map's generic logic applies unchanged.
  • Medications keeps its own bespoke redirect (src/proxy.ts, medicationsHomeTarget()) rather than joining that map, because it has no separate /medications/search route for the map's generic ${pathname}/search submitted-target logic to target — its submitted searches already went straight to the dashboard-owned /?mode=prescribing surface, and that's unchanged.
  • The retired idle views held no clinical data — Documents' three tiles (Recent documents / Browse library / Open a source PDF) and Medications' four shortcut pills (Dose/Safety/Monitoring/Access) plus three example prompts were purely navigational; all real dose/safety/monitoring content lives in the submitted-search results, which this PR does not touch.
  • A "Default landing view" Settings option that could send a user straight to /documents is repointed to the shared home so it can't loop through the now-retired route.
  • Regenerated the generated artifacts this touches: docs/site-map.md, docs/design-system/adoption-manifest.json, data/repo-awareness-snapshot.json (the last one twice — once for the mode changes, again after merging in main's own snapshot update to resolve a conflict).
  • Sources was investigated in the same session and deliberately left out of scope. It shipped as an approved, standalone design the day before this change, with no /sources/search route to redirect submitted searches into and three secondary pages (Topics/Publishers/Method) with no equivalent elsewhere — a materially bigger, separate piece of work.

Verification

  • Typecheck (npx tsc --noEmit) — clean.
  • Full unit suite (npx vitest run) — all green except two pre-existing failures unrelated to this change (tests/clinical-hazard-controls.test.ts, tests/rag-plan-package-parity.test.ts, both reference git commit hashes unavailable in this shallow-clone environment) — confirmed by stashing this change and re-running both in isolation against the unmodified tree, where they fail identically.
  • Real-browser Playwright coverage for every touched spec file, run against the pre-installed Chromium via PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH + scripts/run-playwright.mjs (not the CLI directly): tests/ui-route-coverage.spec.ts + tests/ui-tools.spec.ts in full (110/110 passed), the Documents/Medication-relevant subset of tests/ui-smoke.spec.ts (5/5), tests/ui-overlap.spec.ts + tests/ui-stress.spec.ts (3/3). Two unrelated ui-smoke.spec.ts PDF-canvas tests fail on both this branch and the clean base (confirmed via the same stash-and-rerun method) — pre-existing, not caused by this change.
  • npm run verify:cheap — passed (41/41 gates); the one snapshot-staleness note it raised (data/repo-awareness-snapshot.json) was fixed by regenerating it.
  • npm run check:repo-awareness-snapshot — re-run after merging main in to resolve a snapshot conflict; confirmed back in step.
  • npm run verify:pr-local
  • npm run verify:ui

Verification not run: verify:pr-local and the full verify:ui/test:e2e:pr suite were not run as separate steps — verify:cheap plus the targeted real-browser Playwright runs above cover typecheck, lint, the full static gate set, the full offline unit suite, and every UI journey this change actually touches. Running the entire multi-project Playwright suite on top of that would re-prove journeys this PR doesn't affect.

Risk and rollout

  • Risk: navigation/redirect wiring only — no data, API, auth, or clinical-content change. The main risk class (a submitted deep link losing its query across the redirect, which broke four phone journeys the last time modes were consolidated) is specifically covered by the query-forwarding tests in tests/consolidated-mode-home-redirect.test.ts and the real-browser search-flow tests listed above.
  • Rollback: revert this commit. Both /documents and /medications return to rendering their own idle content with no other cleanup required.
  • Provider or production effects: None.
  • RAG impact: none — no retrieval, ranking, selection, or RAG-surface files touched.

Clinical Governance Preflight

This PR trips the clinical-risk file classifier because it edits src/lib/app-modes.ts (a comment-only change describing the prescribing mode's navigation) and medications/prescribing-named files — not because it changes any clinical behavior, dosing content, or answer/citation logic. All items below hold unchanged; the last item is not applicable because no clinical decision-support behavior changed, only navigation to the existing, unchanged medication search surface.

  • 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

Notes

Two source-code comments (tests/ui-route-coverage.spec.ts's former "Medications index serves the Medication mode home" test, and src/lib/consolidated-mode-home-redirect.ts's doc comment) recorded that Documents and Medications were each pulled out of exactly this redirect pattern once before — Documents after a shipped regression that deleted its three idle-view affordances without anyone noticing, Medications for a reason that didn't survive this repo's squash-merged git history. This change reverses both, deliberately and with the product owner's explicit, informed sign-off after reviewing what would be lost (confirmed to hold no clinical content) — not a mechanical re-application of the same mistake.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PqN4tP2Tj6UziaSti4fFdk


Generated by Claude Code


Note

Medium Risk
Routing and redirect wiring across proxy, shell, and bookmarks; submitted-search query forwarding is test-covered but wrong behavior would break deep links and document search mounting.

Overview
/documents and /medications no longer render their own idle homes. Unsubmitted visits now get a server 307 to the shared shell — /?mode=documents and /?mode=prescribing — like the other consolidated modes. Submitted deep links are unchanged: /documents?q=…&run=1 still goes to /documents/search, and medication searches still land on /?mode=prescribing&q=…&run=1.

Documents joins consolidatedModeHomePaths and the proxy fast-path; the dedicated DocumentsHomeClient and dashboard-owned bare /documents shell wiring are removed (dashboardOwnedModeHomePaths is empty). /documents alone stays on an exact-match standalone-shell list so /documents/search and /documents/[id] keep mounting ClinicalDashboard.

Medications uses a bespoke medicationsHomeTarget() in src/proxy.ts (and a matching page backstop) instead of the shared map, because there is no /medications/search route. The prescribing workspace client component is deleted.

Navigation and prefs are aligned: sidebar pins, default landing for Documents, and shell props point at /?mode=… rather than the retired routes. Generated artifacts (docs/site-map.md, adoption manifest, repo-awareness snapshot) and Playwright/unit tests are updated for redirects and for reaching document shortcuts via the composer options menu instead of retired home tiles.

Reviewed by Cursor Bugbot for commit c33dacf. Configure here.

Retires the bare /documents and /medications pages as distinct content.
Both now redirect to the shared home (/?mode=documents, /?mode=prescribing)
when idle, matching the ten already-consolidated modes; submitted searches
keep working exactly as before on /documents/search and
/?mode=prescribing&q=...&run=1 respectively.

Documents joins the shared consolidatedModeHomePaths map used by the other
ten modes. Medications keeps its own bespoke redirect (src/proxy.ts,
medicationsHomeTarget()) since it has no separate /medications/search route
for that map's generic ${pathname}/search logic to target — its submitted
searches already went straight to the dashboard-owned prescribing surface.

Neither idle view held clinical data (dose/safety/monitoring content lives
entirely in the submitted-search results, untouched by this change) — both
were purely navigational shortcuts. Sources was investigated in the same
session and deliberately left out of scope: it shipped as an approved,
standalone design the day before this change and has no results route to
redirect submitted searches into.

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

coderabbitai Bot commented Sep 4, 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: f19dbde2-1c6c-4259-8f26-ee33a57c19e4


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.

@supabase

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

@BigSimmo
BigSimmo marked this pull request as ready for review September 4, 2026 12:06
@BigSimmo
BigSimmo enabled auto-merge (squash) September 4, 2026 12:07
@cursor

cursor Bot commented Sep 4, 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_f58b7266-6f82-444d-8907-ca53a1dd1f72)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 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-04T12:13:12.411190Z 56dd7d0 Draft marked ready
ℹ️ 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.

…s-architecture-378ktx

# Conflicts:
#	data/repo-awareness-snapshot.json

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56dd7d0399

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/proxy.ts Outdated
claude and others added 3 commits September 4, 2026 12:28
medicationsHomeTarget() and the medications/page.tsx backstop both called
appModeSelectionHref("prescribing") with no options on an unsubmitted
visit, silently dropping every incoming param — including the PWA
manifest shortcut's focus=1 and a draft q/queryMode link. Forward the
draft query, focus flag, and navigation context instead, matching how
the already-consolidated modes handle the same case.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PqN4tP2Tj6UziaSti4fFdk
@BigSimmo
BigSimmo merged commit 3abade6 into main Sep 4, 2026
29 checks passed
@BigSimmo
BigSimmo deleted the claude/psychsift-modes-architecture-378ktx branch September 4, 2026 12:57
BigSimmo pushed a commit that referenced this pull request Sep 4, 2026
…laude/clinical-guide-redesign-ir5zcj

Sync with the Documents/Medications consolidation (#2614) merged into
this branch by another session, before pushing the CI-failure inbox
notes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015uRvqm44emrLDMyPF7Pame
BigSimmo pushed a commit that referenced this pull request Sep 4, 2026
…ealth-n17dvm

Three conflicts. Two were generated files (data/repo-awareness-snapshot.json,
docs/site-map.md) and were regenerated with the repo's own tooling rather than
hand-resolved.

The third was the mode-homes paragraph in docs/codebase-index.md, which #2614
rewrote on main to consolidate Documents and Medications onto the shared home.
Main's rewrite is the newer structure, so it wins; the On Call facts are
re-applied on top of it — seventeen modes, and /on-call as a thirteenth
consolidated redirect stub whose section pages live one level down.

Full offline suite on the merged tree: 1 failed, 15,126 passed. The one
failure is the stale drift manifest, unchanged and still blocking.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LL9gE67N6yorjPcssuK4bC
BigSimmo added a commit that referenced this pull request Sep 5, 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