Skip to content

feat(therapy-compass): converge filter sheet onto the shared contract - #1885

Merged
BigSimmo merged 11 commits into
mainfrom
claude/prompt-e-completion-review-rk38cm
Aug 13, 2026
Merged

feat(therapy-compass): converge filter sheet onto the shared contract#1885
BigSimmo merged 11 commits into
mainfrom
claude/prompt-e-completion-review-rk38cm

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • Retires the bespoke TherapyFilterTrigger/TherapyFilterSheet (src/components/therapy-compass/filter-sheet.tsx, now deleted) in favour of the shared ResultFilterTrigger/ResultFilterSheet/ResultFilterFacetChips (src/components/clinical-dashboard/result-filter-control.tsx) that every other converged mode already uses — the last unclosed item in /issues #170.
  • Two resultFilterFacetGroup() groups (Topics — 6 tags, Availability — reviewed/brief) now feed both the desktop rail and the phone sheet from one source, following the pattern formulation-home-page.tsx established, so the two breakpoints cannot drift.
  • Regenerates docs/design-system/adoption-manifest.json/COMPONENTS.md (the deleted file was a tracked consumer) and updates the Playwright/vitest coverage that pinned the retired component's exact shape.

Two decisions this PR resolves (not silently changes)

Per docs/filter-contract.md's own rollout convention, each mode PR states any conflict between the contract and a local decision, rather than resolving it quietly:

  1. onClearAll vs the query. The old sheet's Clear all wiped the search query too, on phone only, deliberately — the code carried a comment explaining it was the phone's only route to clear the query. That contradicted docs/filter-contract.md §6: "onClearAll never touches the query." I verified the phone-only justification no longer holds: the shared global composer (GlobalSearchShellMasterSearchHeader) already renders its own always-visible "×" clear-query button at every viewport (master-search-header.tsx:1911-1920, wired via onClearQueryglobal-search-shell.tsx:851-854), and this same file already treats "clear search" as distinct from "clear filters" elsewhere (SearchResultsEmptyState's onClearSearch prop). Resolution:onClearAll now wires to clearSearchFilters (filters only), matching the invariant. No contract change needed — the sheet's double-duty clear was redundant, not load-bearing.

  2. AND-within-group tags. Therapy's Topics predicate (select.ts's wantTags.every(...)) narrows as more tags are selected (a therapy must carry every selected tag), not the contract's default OR-within-group (§3: adding an option widens). This is mode-owned filtering logic the shared component's kind: "facet" type doesn't dictate — it only governs selection cardinality and rendering, not AND/OR combination. Resolution: left select.ts unchanged; only the UI layer converges. Hint counts are computed by re-running the real predicate with each candidate added (same technique formulation-home-page.tsx uses), which stays honest whether the underlying combination is AND or OR.

Verification

  • npm run verify:pr-local — full run (executable/UI scope): check:runtime, check:installed-lock-parity, format:changed, sitemap:check, docs:check-index, docs:check-inventory, docs:check-scripts, docs:check-links, check:branch-review-ledger, check:outstanding-issues, lint, typecheck, test, build, check:rag:fixtures — all completed, none failed.
  • npm run test (full suite, read the summary line, not exit code): Test Files 563 passed (563) / Tests 6144 passed | 4 skipped (6148).
  • npm run check:bundle-budget after a fresh rm -rf .next && npm run build: production 1304.1 KiB gzip (baseline 1279.1 KiB, within tolerance), mockups 294.5 KiB gzip (baseline 267.5 KiB, within tolerance).
  • npm run format — no changes (already clean via format:changed inside the gate).
  • UI verification not run via npm run verify:ui: known-blocked in this environment (/issues #255 — Playwright wants chromium-1234, only chromium-1194 installed). Covered instead by the full offline npm run test run (tests/ui-accessibility.spec.ts's therapy-compass block updated for the new component and passing under vitest's jsdom harness, plus 17 other therapy-compass wiring/behavior tests) and manual review of the shared component's existing production usage in formulation/differentials/medication/applications/specifiers, which already prove the breakpoint behavior this PR reuses unchanged.

classifyPullRequestFiles on this diff returns clinicalRisk: false, operationalRisk: false, ragRanking: false — no Clinical Governance Preflight or RAG impact statement required.

Risk and rollout

  • Risk: low — UI-only convergence onto an already-proven shared component (5 other modes already use it in production). The one behavior change is deliberate and stated above (Decision 1): therapy's phone filter sheet's Clear all no longer also clears the search query.
  • Rollback: revert this commit; the retired filter-sheet.tsx is recoverable from git history if needed.
  • Provider or production effects: None.

Notes

  • /issues #170 updated to reflect therapy-compass's convergence; remaining items are services, factsheets, and documents (last).
  • Ledger row recorded via npm run ledger:append for this review.

Generated by Claude Code

Retires the bespoke TherapyFilterTrigger/TherapyFilterSheet in favour of
ResultFilterTrigger/ResultFilterSheet/ResultFilterFacetChips, the shared
components every other converged mode already uses. Two facet groups
(Topics, Availability) now feed both the desktop rail and the phone sheet
from one source, closing the last item in /issues #170.
Two decisions this PR resolves rather than silently changes, both stated
here per docs/filter-contract.md's own rollout convention:
- onClearAll vs the query: the old sheet's Clear all wiped the search
query too (phone-only, deliberate). That contradicted filter-contract.md
section 6 ("onClearAll never touches the query"). The phone-only
justification no longer holds — the shared composer already renders its
own always-visible clear-query control at every viewport
(master-search-header.tsx) — so onClearAll now wires to
clearSearchFilters (filters only), matching the invariant. No contract
change needed.
- AND-within-group tags: therapy's Topics predicate (select.ts's
wantTags.every) narrows rather than widens, unlike the contract's
OR-within-group default for facets. This is mode-owned filtering logic
the shared component's kind type doesn't dictate, so it stays unchanged;
only the UI layer converges. Hint counts are computed by re-running the
real predicate with each candidate added, which stays honest either way.
Also updates the Playwright and vitest coverage that pinned the retired
component's exact shape, and regenerates the design-system adoption
manifest.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TtjsdU7PRAKYHV98XJRMF6
@supabase

supabaseBot commented Aug 12, 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 ↗︎.

@coderabbitai

coderabbitaiBot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in:24 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

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

Run ID: 1009a6a4-7efc-4456-af11-7dca03dcf6d6

📥 Commits

Reviewing files that changed from the base of the PR and between 2ae5a0a and f8542c8.

📒 Files selected for processing (6)
  • src/components/therapy-compass/filter-sheet.tsx
  • src/components/therapy-compass/screens/search-screen.tsx
  • tests/therapy-compass-mode-wiring.test.ts
  • tests/therapy-filter-sheet.dom.test.tsx
  • tests/ui-accessibility.spec.ts
  • tests/ui-therapy-clear-search.spec.ts

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

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

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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:83d6f9bd41

ℹ️ 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 threadsrc/components/therapy-compass/screens/search-screen.tsx Outdated
@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch claude/prompt-e-completion-review-rk38cm at starting commit 23f5909; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:claude/prompt-e-completion-review-rk38cm, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit:23f5909993

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

@BigSimmo
BigSimmo enabled auto-merge August 12, 2026 21:23
@BigSimmo
BigSimmo disabled auto-merge August 12, 2026 21:25
@BigSimmoChatGPT Codex Connector

Copy link
Copy Markdown
OwnerAuthor

Disposition: the reported query-clear defect is already fixed on the current head d24720417c97f8ae78954930eb3b1e6c4ab2abe1: Therapy owns a b.clearSearch() action and replaces the deep-linked route with /therapy-compass/search, so the URL/provider query is cleared. The inline thread is outdated.

@BigSimmoChatGPT Codex Connector

Copy link
Copy Markdown
OwnerAuthor

@claude This PR is currently mergeable_state: dirty against current main at head d24720417c97f8ae78954930eb3b1e6c4ab2abe1. Its only stale review thread was independently verified against current code and resolved because the clear-search ribbon already calls b.clearSearch() and replaces the URL correctly. Fetch current main and merge it into this PR branch without rebasing or force-pushing. Resolve only merge conflicts, preserving the shared filter-contract convergence and all newer main changes. Run conflict-adjacent format/typecheck plus focused therapy-compass filter tests, push the merge-resolution commit, and report the pushed SHA and verification. Do not merge or close the PR, deploy, alter auto-merge, or broaden scope.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @BigSimmo — thanks for the @claude mention.

Open this in Claude Code on the web to continue here: https://claude.ai/code

Context: BigSimmo/Database · #1885

Automated backlink from the Claude backlink workflow. Claude Code can pick up the mention and push a scoped fix to the branch.

@claude

claudeBot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@github-actions

github-actionsBot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 3 failed job(s):

  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Unit coverageneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #10317 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

@BigSimmo
BigSimmo enabled auto-merge August 12, 2026 21:43
@BigSimmo
BigSimmo disabled auto-merge August 12, 2026 21:51
@BigSimmo
BigSimmo enabled auto-merge August 12, 2026 21:54
@BigSimmo
BigSimmo disabled auto-merge August 12, 2026 22:05
@BigSimmo
BigSimmo enabled auto-merge August 12, 2026 22:07
@BigSimmoChatGPT Codex Connector

Copy link
Copy Markdown
OwnerAuthor

Fixed the required CI issues on the current head: the Therapy clear-search button now uses the shared therapyBtn recipe required by the design-system contract. The PR remains blocked by its base-branch merge conflict; no rebase or force-push was performed.

@BigSimmo
BigSimmo disabled auto-merge August 12, 2026 22:48
@BigSimmo
BigSimmo enabled auto-merge (squash) August 12, 2026 23:07
@BigSimmo
BigSimmo disabled auto-merge August 12, 2026 23:17
@BigSimmo
BigSimmo enabled auto-merge August 12, 2026 23:37
@BigSimmo
BigSimmo disabled auto-merge August 12, 2026 23:51
@BigSimmo
BigSimmo enabled auto-merge August 13, 2026 00:07
@BigSimmo
BigSimmo disabled auto-merge August 13, 2026 00:17
@BigSimmo
BigSimmo enabled auto-merge August 13, 2026 00:37
@BigSimmo
BigSimmo disabled auto-merge August 13, 2026 01:07
@BigSimmo
BigSimmo enabled auto-merge August 13, 2026 01:07
@BigSimmo
BigSimmo disabled auto-merge August 13, 2026 01:08
@BigSimmo
BigSimmo enabled auto-merge August 13, 2026 01:37
@BigSimmo
BigSimmo disabled auto-merge August 13, 2026 01:59
@BigSimmo
BigSimmo enabled auto-merge (squash) August 13, 2026 02:06
@BigSimmoChatGPT Codex Connector

Copy link
Copy Markdown
OwnerAuthor

@claude Please main-sync this PR from exact head c61c45a1573765092b588d4adc57eb7d6dce870e: merge the latest main once (never rebase), resolve all conflicts minimally, commit and push. Do not merge/close the PR, force-push, alter auto-merge, or touch unrelated files.

This is a competing Therapy filter-convergence variant. Preserve its verified query-reset behavior and existing focused test, but also retain all newer main Therapy catalogue aliases, filter-contract semantics, navigation and accessibility fixes. For shared ledgers, design-system manifest/components, search-results decisions and outstanding issues, current main is authoritative; reapply only this PR’s still-current adoption/status delta through the proper tooling and deduplicate. Do not overwrite newer rows or rollout state from #1889/other filter PRs.

Run the focused Therapy filter-sheet/mode-wiring/clear-search tests, the relevant accessibility selector, design-system/adoption checks if those files remain changed, typecheck and format. Report the new head and exact outcomes.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @BigSimmo — thanks for the @claude mention.

Open this in Claude Code on the web to continue here: https://claude.ai/code

Context: BigSimmo/Database · #1885

Automated backlink from the Claude backlink workflow. Claude Code can pick up the mention and push a scoped fix to the branch.

@claude

claudeBot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@BigSimmoChatGPT Codex Connector

Copy link
Copy Markdown
OwnerAuthor

@copilot Merge main at 0709965e66e04173ec0b0de1d121e85ac1ff7e04 into current head c61c45a1573765092b588d4adc57eb7d6dce870e, resolve conflicts minimally, and push the merge commit to claude/prompt-e-completion-review-rk38cm. Never rebase or force-push. Do not merge/close the PR, deploy, alter auto-merge, or touch unrelated files.

This is a competing Therapy filter-convergence variant. Preserve its tested filters-only Clear all/query-reset behavior, but retain all current-main Therapy catalogue aliases, filter semantics, navigation and accessibility fixes. For shared docs/branch-review-ledger.md, docs/outstanding-issues.md, design-system manifest/components and search/filter contract docs, current main is authoritative; preserve newer history/status and reapply only still-current PR-specific adoption text using repository tooling. Do not overwrite #1889’s newer rollout state.

Run focused Therapy filter-sheet/mode-wiring/clear-search tests, relevant accessibility and design-system/adoption checks, ledger/issues integrity/write-discipline, typecheck and format. Report the pushed 40-character SHA and exact outcomes.

Preserve the competing Therapy filter implementation and focused tests while retaining current-main shared ledgers and generated design-system snapshots for regeneration on the combined tree.
@BigSimmo
BigSimmo merged commit 7fd2962 into mainAug 13, 2026
24 checks passed
@BigSimmo
BigSimmo deleted the claude/prompt-e-completion-review-rk38cm branch August 13, 2026 04:03
@BigSimmoChatGPT Codex Connector

BigSimmo commented Aug 13, 2026

Copy link
Copy Markdown
OwnerAuthor

Final post-merge audit complete for PR #1885.

  • Final PR head:f23949d1894a3f9bf055909bdcca257aaef6e4d5
  • Base at merge:2cc4494425c22dfc2f233585353925b25e44a597
  • Merge commit / current main:7fd296270ed3a61e6ea2222817ab368b2cec6fb4
  • Sync and merge-tree: the final head included the latest base, was 0 commits behind, and its tree was byte-identical to the base. GitHub's exact-head PR mergeability check completed successfully.

Findings and dispositions

  • The older competing Therapy implementation had a provable query-clear/filter-state coupling and a sub-48 px phone target. A focused correction was published earlier as f8542c892443109ac66fad24f65afa09f342770c.
  • Current main already contained a newer, more complete Therapy filter implementation and regression coverage. The final conflict resolution therefore retained current-main content rather than layering the older variant back over it. The resulting PR diff was empty: 0 files changed, 0 additions, 0 deletions.
  • No additional high-confidence PR-introduced defect remained on the final head. Pre-existing or superseded implementation details were left out of scope.
  • The only inline P2 review thread is resolved and outdated. No actionable unresolved thread remains.
  • CodeRabbit did not complete because of its external usage/spending limit. A separate manual adversarial pass covered query ownership, filter semantics, accessibility/tap geometry, generated/shared files, test consistency, and merge-resolution safety.

Exact-head CI

  • Gitleaks: success
  • PR policy: success
  • PR required: success
  • PR mergeability: success
  • Change scope: success
  • Production UI: skipped, not described as green. The final head had no PR delta, so UI scope was not selected.

Advisory checks

  • GitGuardian: success
  • Supabase Preview: skipped because there was no Supabase change
  • No Lighthouse, live/provider-backed evaluation, deployment, release, or production test was run.

Ledger and residual risk

No ledger-only or canonical outstanding-issues mutation was added. The final branch had no delta, and current main was authoritative for shared ledgers, manifests, contracts, and rollout state. The principal residual limitation is that Production UI was skipped rather than executed, although there was no PR-specific tree difference left to test.

GitHub auto-merged the PR on 13 August 2026 at 12:03 pm AWST (04:03 UTC) because auto-merge was already armed and the required checks completed. This task did not invoke a merge or close action and did not alter auto-merge.

Sign up for freeto 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

@BigSimmo@claude