Skip to content

feat(formulation): add psychiatric formulation workspace#660

Merged
BigSimmo merged 7 commits into
mainfrom
codex/formulation-workspace
Jul 14, 2026
Merged

feat(formulation): add psychiatric formulation workspace#660
BigSimmo merged 7 commits into
mainfrom
codex/formulation-workspace

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Adds the recovered psychiatric Formulation workspace, including mechanism search, structured builder, comparison, relationship map, mechanism guidance, compatibility redirects, local content, documentation, and focused tests. Verification: verify:cheap passed; verify:pr-local passed including production build and client-bundle secret scan; 4 dedicated Chromium Formulation tests passed; production-readiness had no blockers. No live Supabase or OpenAI providers were contacted.

Summary by CodeRabbit

  • New Features
    • Added a Formulation workspace: mechanism search/results, map, comparison, and mechanism detail pages.
    • Introduced a multi-step Formulation builder (framework/template, structured guidance, quality review, and editable clinical draft).
    • Updated clinical dashboard navigation and mode actions to support Formulation throughout.
  • Bug Fixes
    • Legacy specifier URLs now redirect into the corresponding Formulation experience, preserving compatible query inputs.
  • Documentation
    • Updated codebase index and site maps to replace Specifiers coverage with Formulation, including routing/redirect behavior.
  • Tests
    • Added formulation unit tests and new end-to-end UI coverage (incl. accessibility); removed specifiers UI/unit coverage and updated production test selection.

@supabase

supabase Bot commented Jul 14, 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 ↗︎.

@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: 8ac2747cdf

ℹ️ 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/app/specifiers/[[...path]]/page.tsx Outdated
Comment thread src/components/formulation/formulation-builder-page.tsx Outdated
@BigSimmo

Copy link
Copy Markdown
Owner Author

@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. 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. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. 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.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 22608ba8-13b7-4db9-abac-f57873c4bbe7

📥 Commits

Reviewing files that changed from the base of the PR and between 2a6cb56 and ce6baa3.

📒 Files selected for processing (2)
  • src/app/specifiers/[[...path]]/page.tsx
  • tests/ui-formulation.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/ui-formulation.spec.ts

📝 Walkthrough

Walkthrough

Replaces the specifiers workspace with a formulation workspace, including clinical content, search and drafting utilities, pages, routes, dashboard mode wiring, legacy redirects, documentation, and automated tests.

Changes

Formulation workspace

Layer / File(s) Summary
Formulation data and search engine
src/data/formulation-content.json, src/lib/formulation.ts, src/lib/app-modes.ts, src/lib/app-mode-icons.ts
Adds formulation content, search/comparison/draft helpers, and replaces the specifiers app mode with formulation.
Formulation workspace UI
src/components/formulation/*
Adds formulation search, mechanism detail, map, comparison, and multi-step builder experiences with shared navigation and safety components.
Formulation routes and legacy redirects
src/app/formulation/..., src/app/specifiers/[[...path]]/page.tsx, src/app/page.tsx
Adds formulation route handlers and redirects legacy specifier paths and mode requests to formulation routes.
Dashboard mode and navigation wiring
src/components/clinical-dashboard/*
Replaces dashboard navigation, action sets, local-search handling, standalone routing, and prefetching for formulation.
Route documentation and test selection
docs/*, scripts/generate-site-map.ts, playwright.config.ts
Updates route inventories, ownership metadata, dynamic slug generation, and production Playwright matching.
Formulation and routing validation
tests/app-modes.test.ts, tests/formulation.test.ts, tests/ui-formulation.spec.ts, tests/ui-smoke.spec.ts
Adds coverage for formulation data, mode contracts, workspace flows, redirects, accessibility, responsiveness, and keyboard navigation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FormulationHomePage
  participant FormulationMechanismPage
  participant FormulationBuilderPage
  User->>FormulationHomePage: Search formulation mechanisms
  FormulationHomePage-->>User: Show ranked mechanism matches
  User->>FormulationMechanismPage: Open mechanism guide
  FormulationMechanismPage-->>User: Show formulation actions
  User->>FormulationBuilderPage: Open builder with mechanism
  FormulationBuilderPage-->>User: Build and edit formulation draft
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the change and verification, but it omits the required template sections and checklist items. Add the Summary, Verification, Clinical Governance Preflight, and Notes sections from the repository template, with the relevant checklist items filled out.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding the psychiatric Formulation workspace.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/formulation-workspace

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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

@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: 8ac2747cdf

ℹ️ 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/app/specifiers/[[...path]]/page.tsx Outdated
@BigSimmo
BigSimmo enabled auto-merge July 14, 2026 12:45

@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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
tests/ui-formulation.spec.ts (1)

7-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract shared Playwright helpers
blockExternalRequests, gotoApp, and the horizontal-overflow checks are repeated across the UI spec files. Move them into a shared test helper so the localhost allow-list and overflow tolerance stay consistent.

🤖 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/ui-formulation.spec.ts` around lines 7 - 31, Extract
blockExternalRequests, gotoApp, and expectNoHorizontalOverflow from
tests/ui-formulation.spec.ts into a shared Playwright test helper, preserving
the localhost allow-list, navigation behavior, and overflow tolerance. Update
tests/ui-formulation.spec.ts (lines 7-31) and tests/ui-smoke.spec.ts (lines
34-37) to import and reuse the shared helpers, removing their duplicated local
implementations.
🤖 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.

Inline comments:
In `@src/app/specifiers/`[[...path]]/page.tsx:
- Around line 8-19: The legacy redirect in LegacySpecifierRoute must preserve
compare pairs: when path targets “compare”, map the incoming specifier values to
query keys “a” and “b” in order, while retaining the existing “specifier” to
“mechanism” mapping for other routes. Update the query-parameter transformation
without changing pathname construction or redirect behavior.

In `@src/components/formulation/formulation-compare-page.tsx`:
- Around line 88-114: Update FormulationComparePage so leftId and rightId are
resynchronized with fallbackPair(initialLeft, initialRight) whenever the
query-derived initialLeft or initialRight values change, rather than retaining
only the first mount’s state. Preserve the existing chooseLeft, chooseRight, and
swap behavior while ensuring navigation to a new pair displays the corresponding
comparison.

In `@src/data/formulation-content.json`:
- Around line 74-75: Update the governance metadata represented by sourceStatus,
sourceConfidence, releaseStatus, and contentReviewSummary so release readiness
remains separate from owner-confirmation status; do not mark owner confirmation
complete while pendingOwnerConfirmations is 9 or sourceWarnings still reports
confirmation pending. Either preserve the pending owner-confirmation state or
clear all pending confirmations before marking it complete.

---

Nitpick comments:
In `@tests/ui-formulation.spec.ts`:
- Around line 7-31: Extract blockExternalRequests, gotoApp, and
expectNoHorizontalOverflow from tests/ui-formulation.spec.ts into a shared
Playwright test helper, preserving the localhost allow-list, navigation
behavior, and overflow tolerance. Update tests/ui-formulation.spec.ts (lines
7-31) and tests/ui-smoke.spec.ts (lines 34-37) to import and reuse the shared
helpers, removing their duplicated local implementations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 29cd7639-968c-4a84-93b9-71d9bad55a81

📥 Commits

Reviewing files that changed from the base of the PR and between 24c1439 and 8ac2747.

📒 Files selected for processing (42)
  • docs/codebase-index.md
  • docs/site-map.md
  • playwright.config.ts
  • scripts/generate-site-map.ts
  • src/app/formulation/[slug]/page.tsx
  • src/app/formulation/builder/page.tsx
  • src/app/formulation/compare/page.tsx
  • src/app/formulation/layout.tsx
  • src/app/formulation/map/page.tsx
  • src/app/formulation/page.tsx
  • src/app/page.tsx
  • src/app/specifiers/[[...path]]/page.tsx
  • src/app/specifiers/[slug]/page.tsx
  • src/app/specifiers/builder/page.tsx
  • src/app/specifiers/compare/page.tsx
  • src/app/specifiers/map/page.tsx
  • src/app/specifiers/page.tsx
  • src/components/clinical-dashboard/ClinicalSidebar.tsx
  • src/components/clinical-dashboard/global-search-shell.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/mode-action-popup.tsx
  • src/components/formulation/formulation-builder-page.tsx
  • src/components/formulation/formulation-compare-page.tsx
  • src/components/formulation/formulation-home-page.tsx
  • src/components/formulation/formulation-map-page.tsx
  • src/components/formulation/formulation-mechanism-page.tsx
  • src/components/formulation/formulation-ui.tsx
  • src/components/specifiers/specifier-builder-page.tsx
  • src/components/specifiers/specifier-compare-page.tsx
  • src/components/specifiers/specifier-map-page.tsx
  • src/components/specifiers/specifier-record-page.tsx
  • src/data/formulation-content.json
  • src/lib/app-mode-icons.ts
  • src/lib/app-modes.ts
  • src/lib/formulation.ts
  • src/lib/specifiers.ts
  • tests/app-modes.test.ts
  • tests/formulation.test.ts
  • tests/specifiers.test.ts
  • tests/ui-formulation.spec.ts
  • tests/ui-smoke.spec.ts
  • tests/ui-specifiers.spec.ts
💤 Files with no reviewable changes (12)
  • src/app/specifiers/builder/page.tsx
  • src/app/specifiers/page.tsx
  • tests/specifiers.test.ts
  • tests/ui-specifiers.spec.ts
  • src/components/specifiers/specifier-record-page.tsx
  • src/components/specifiers/specifier-map-page.tsx
  • src/app/specifiers/compare/page.tsx
  • src/app/specifiers/[slug]/page.tsx
  • src/components/specifiers/specifier-builder-page.tsx
  • src/lib/specifiers.ts
  • src/app/specifiers/map/page.tsx
  • src/components/specifiers/specifier-compare-page.tsx

Comment thread src/app/specifiers/[[...path]]/page.tsx
Comment thread src/components/formulation/formulation-compare-page.tsx
Comment thread src/data/formulation-content.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: 5d1e00ecce

ℹ️ 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/app/specifiers/[[...path]]/page.tsx Outdated

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/data/formulation-content.json (1)

1063-1063: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Record concrete source update dates for the attachment and dissociation entries.
sourceUpdatedAt should use the source’s actual update date instead of "source page current at review" so the provenance stays reproducible.

🤖 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 `@src/data/formulation-content.json` at line 1063, Update the sourceUpdatedAt
values for the attachment and dissociation entries in formulation-content.json
to their concrete source update dates, replacing the review-time placeholder
while preserving the existing date format and entry structure.
🤖 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.

Outside diff comments:
In `@src/data/formulation-content.json`:
- Line 1063: Update the sourceUpdatedAt values for the attachment and
dissociation entries in formulation-content.json to their concrete source update
dates, replacing the review-time placeholder while preserving the existing date
format and entry structure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7187debb-03db-45f4-bf8c-ac1bce0f6e2f

📥 Commits

Reviewing files that changed from the base of the PR and between 5d1e00e and 27a3036.

📒 Files selected for processing (6)
  • src/app/formulation/compare/page.tsx
  • src/app/specifiers/[[...path]]/page.tsx
  • src/components/formulation/formulation-compare-page.tsx
  • src/data/formulation-content.json
  • tests/formulation.test.ts
  • tests/ui-formulation.spec.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/app/formulation/compare/page.tsx
  • tests/formulation.test.ts
  • src/components/formulation/formulation-compare-page.tsx
  • tests/ui-formulation.spec.ts

@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: 2a6cb56b2a

ℹ️ 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/app/specifiers/[[...path]]/page.tsx
@BigSimmo
BigSimmo merged commit 061a1ef into main Jul 14, 2026
16 checks passed
Copilot AI added a commit that referenced this pull request Jul 14, 2026
… branch

Resolve conflicts across 11 files, combining:
- DSM-5 Diagnosis mode + Specifiers mode (this branch)
- Formulation workspace mode (main, PR #660)

All three modes coexist: dsm, specifiers, formulation added to AppModeId,
AppModeSearchKind, appModeDefinitions, namespaceIsolatedModes, sidebar,
global-search-shell, master-search-header, and mode-action-popup.
Tests updated to cover all three modes. Site-map and generate-site-map
regenerated with all three slug inventories.
@BigSimmo
BigSimmo deleted the codex/formulation-workspace branch July 17, 2026 05:45
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.

1 participant