Show Therapy in the production mode switcher#827
Conversation
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
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesTherapy Compass visibility
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/app-modes.test.ts (1)
230-291: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
therapy-compassto the existing comprehensive mode-visibility assertions.Now that Therapy Compass is a first-class production mode, the tests at lines 233–246 (
arrayContaininglist) and 275–288 (developmentModeslist) should also include"therapy-compass". Similarly, the production-visibility test at lines 251–264 could assertisAppModeVisible("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
developmentModesarrayContaining:"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
📒 Files selected for processing (2)
src/lib/app-modes.tstests/app-modes.test.ts
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
Summary
therapy-compass) was gateddevOnly: trueinsrc/lib/app-modes.ts, sovisibleAppModeDefinitions()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.devOnlygate 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.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 passnpm run sitemap:check— in sync (generator already enumerates all modes unfiltered, so output is unchanged)tsc --noEmittypecheck — cleannpm run verify:pr-localVerification not run: full
verify:pr-localnot completed. Ranverify:cheapinstead — the full unit suite passes (2756 passed) except one pre-existing, unrelated failure intests/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).Risk and rollout
/therapy-compassroute + 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.devOnly: trueto thetherapy-compassmode definition and revert the guard-test assertions.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy) — unchangedNotes
therapy-compassentry insrc/lib/app-modes.tskeeps 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