Skip to content

Show Therapy in the production mode switcher#827

Merged
BigSimmo merged 4 commits into
mainfrom
claude/therapy-mode-switcher-8a7d68
Jul 18, 2026
Merged

Show Therapy in the production mode switcher#827
BigSimmo merged 4 commits into
mainfrom
claude/therapy-mode-switcher-8a7d68

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause: The "Therapy" mode (therapy-compass) was gated devOnly: true in src/lib/app-modes.ts, so visibleAppModeDefinitions() filtered it out of the production sidebar and MODE dropdown. It only appeared in the dev switcher (NODE_ENV === "development"); in a production build it was intentionally hidden.
  • Fix: Removed the devOnly gate so Therapy is a first-class production mode. The gate was documented to stay until the re-curated therapy pathways received qualified-clinician sign-off; that sign-off is confirmed, so the flag is removed.
  • Updated the guard test in tests/app-modes.test.ts (surfaces Therapy Compass in production discovery after clinician sign-off) to assert Therapy is now visible in production instead of held out.

No routing, search, or answer-generation logic changed — only the mode's discoverability flag.

Verification

  • tests/app-modes.test.ts — 18/18 pass
  • npm run sitemap:check — in sync (generator already enumerates all modes unfiltered, so output is unchanged)
  • tsc --noEmit typecheck — clean
  • npm run verify:pr-local

Verification not run: full verify:pr-local not completed. Ran verify:cheap instead — the full unit suite passes (2756 passed) except one pre-existing, unrelated failure in tests/pdf-extraction-budget.test.ts (Python child-process teardown timing; fails in isolation on this branch and is untouched by this change, which only edits app-mode visibility).

  • UI verification not run: no UI/component/styling/routing code changed — this is a single boolean-flag removal plus a test assertion flip.

Risk and rollout

  • Risk: Low and self-contained. Makes the existing /therapy-compass route + Therapy mode discoverable in the production sidebar and MODE dropdown. The route, its content, and its data were already shipped and reachable directly; this only surfaces the entry point.
  • Rollback: Re-add devOnly: true to the therapy-compass mode definition and revert the guard-test assertions.
  • Provider or production effects: None.

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use — unchanged
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval — unchanged
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy) — unchanged
  • Service-role keys and private document access remain server-only — unchanged
  • Demo/synthetic content remains clearly separated from real clinical sources — unchanged
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative — unchanged
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed — this exposes a clinical decision-support surface to production; per the removed code comment, the required qualified-clinician sign-off for the re-curated therapy pathways is the documented precondition and was confirmed for this change.

Notes

  • The therapy-compass entry in src/lib/app-modes.ts keeps its own in-tool search config (the benign "tools" search kind that suppresses the universal composer on its route) — that behavior is unchanged.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Therapy mode is now available in production mode lists and selection menus.
  • Bug Fixes
    • Corrected production visibility so the Therapy mode appears as intended after approval.

The "Therapy" mode (therapy-compass) was gated devOnly, so
visibleAppModeDefinitions() filtered it out of the production sidebar
and MODE dropdown, leaving it available only in the dev switcher.

The re-curated therapy pathways now have qualified-clinician sign-off,
so remove the devOnly gate and make Therapy a first-class production
mode. Update the guard test in tests/app-modes.test.ts to assert it is
now visible in production.

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

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 17 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: ecbbd8cf-27cb-4f19-a61b-c41ecc64267e

📥 Commits

Reviewing files that changed from the base of the PR and between 899dab3 and c0d562b.

📒 Files selected for processing (1)
  • tests/app-modes.test.ts
📝 Walkthrough

Walkthrough

The therapy-compass app mode is no longer development-only. Its production visibility and discovery tests now expect the mode to be available.

Changes

Therapy Compass visibility

Layer / File(s) Summary
Enable and validate production discovery
src/lib/app-modes.ts, tests/app-modes.test.ts
Removes the devOnly gate from therapy-compass and updates production visibility assertions to expect inclusion.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: making Therapy visible in the production mode switcher.
Description check ✅ Passed The description follows the template with Summary, Verification, Risk and rollout, Clinical Governance Preflight, and Notes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/therapy-mode-switcher-8a7d68

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

@supabase

supabase Bot commented Jul 18, 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 July 18, 2026 07:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/app-modes.test.ts (1)

230-291: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add therapy-compass to the existing comprehensive mode-visibility assertions.

Now that Therapy Compass is a first-class production mode, the tests at lines 233–246 (arrayContaining list) and 275–288 (developmentModes list) should also include "therapy-compass". Similarly, the production-visibility test at lines 251–264 could assert isAppModeVisible("therapy-compass", "production"). These existing tests currently don't verify therapy-compass presence, leaving a gap in the contract coverage.

♻️ Suggested additions
     expect(appModeDefinitions.map((mode) => mode.id)).toEqual(
       expect.arrayContaining([
         "answer",
         "documents",
         "services",
         "forms",
         "favourites",
         "differentials",
         "dsm",
         "specifiers",
         "formulation",
         "prescribing",
         "tools",
+        "therapy-compass",
       ]),
     );

And in the production-visibility test:

     expect(isAppModeVisible("tools", "production")).toBe(true);
+    expect(isAppModeVisible("therapy-compass", "production")).toBe(true);
     expect(productionModes).not.toContain("evidence");

And in the developmentModes arrayContaining:

         "prescribing",
         "tools",
+        "therapy-compass",
       ]),
     );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/app-modes.test.ts` around lines 230 - 291, Update the comprehensive
mode-visibility assertions in the tests covering appModeDefinitions and
developmentModes to include "therapy-compass" in their expected mode lists. In
the production visibility test, add an assertion that
isAppModeVisible("therapy-compass", "production") is true and verify
productionModes contains it, preserving the existing coverage style.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/app-modes.test.ts`:
- Around line 230-291: Update the comprehensive mode-visibility assertions in
the tests covering appModeDefinitions and developmentModes to include
"therapy-compass" in their expected mode lists. In the production visibility
test, add an assertion that isAppModeVisible("therapy-compass", "production") is
true and verify productionModes contains it, preserving the existing coverage
style.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 03b83ddd-9ab4-4e0e-a8ab-df54e7fd4baa

📥 Commits

Reviewing files that changed from the base of the PR and between bf9534c and 899dab3.

📒 Files selected for processing (2)
  • src/lib/app-modes.ts
  • tests/app-modes.test.ts

claude and others added 2 commits July 18, 2026 07:42
Now that therapy-compass is a first-class production mode, add it to the
canonical mode-enumeration tests so the contract coverage is complete:
the appModeDefinitions and developmentModes arrayContaining lists, plus
production-visibility assertions (isAppModeVisible + productionModes).

Addresses CodeRabbit review nitpick on PR #827.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gQuUbbqi3TBvFHs3wzVFG
@BigSimmo
BigSimmo enabled auto-merge July 18, 2026 08:09
@BigSimmo
BigSimmo merged commit 3facf60 into main Jul 18, 2026
15 checks passed
@BigSimmo
BigSimmo deleted the claude/therapy-mode-switcher-8a7d68 branch July 18, 2026 08:11
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