Skip to content

Fix(differentials): route "Compare selected" directly to resolved presentation workflow#883

Closed
BigSimmo wants to merge 5 commits into
mainfrom
codex/fix-restricted-viewport-error-on-compare-hk5lur
Closed

Fix(differentials): route "Compare selected" directly to resolved presentation workflow#883
BigSimmo wants to merge 5 commits into
mainfrom
codex/fix-restricted-viewport-error-on-compare-hk5lur

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Clicking "Compare selected" opened an intermediate redirect endpoint which could surface a restricted/incorrect origin (e.g. 0.0.0.0) and produced a restricted viewport; the goal is to route selected comparisons directly to the resolved presentation workflow URL and preserve selected IDs.
  • Centralize URL/href construction for differential navigation so mobile and desktop CTAs share a deterministic same-origin behavior.

Description

  • Add src/lib/differentials-navigation.ts with differentialRouteWithQuery() and differentialSelectedCompareHref() to build same-origin relative route hrefs and resolve the presentation workflow for chosen diagnosis IDs.
  • Replace routeWithQuery usage in src/components/clinical-dashboard/differentials-home.tsx with the new helpers for mobile and desktop "Compare selected" CTAs and other catalogue navigation links.
  • Remove the in-file routeWithQuery helper and wire CTAs to the presentation page directly so the app no longer relies on the redirect endpoint that could embed a bad origin.
  • Add a focused unit test tests/differentials-navigation.test.ts which asserts that the new hrefs target a presentation page, include the query and IDs, and do not contain 0.0.0.0.

Testing

  • Ran npm ci to populate node modules and it completed successfully.
  • Ran the targeted unit test with npm run test -- tests/differentials-navigation.test.ts and the new test suite passed (2 tests, 0 failures).
  • Ran type checking with npm run typecheck and it passed with no errors.
  • Ran linting with npm run lint and it completed without errors.
  • Attempted npm run ensure to verify the dev UI, but the local Next/Turbopack dev server did not become ready due to font-module resolution / Google font fetch failures in this environment, so end-to-end browser verification was not completed; no persistent dev server was left running.

Codex Task

Summary by CodeRabbit

  • Bug Fixes

    • Improved differentials navigation to use same-origin relative links.
    • Preserved selected items and search parameters when navigating to presentations, diagnoses, and comparison views.
    • Standardized redirect behavior with temporary redirects while retaining workflow and query details.
  • Tests

    • Added coverage for navigation links, redirect paths, URL encoding, and selected-item preservation.

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

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Differentials navigation now uses shared client-safe URL helpers, while the presentations route returns relative 307 redirects. Dashboard links, compare actions, query parameters, selected IDs, and regression tests were updated accordingly.

Changes

Differentials navigation

Layer / File(s) Summary
Centralize differential href construction
src/lib/differentials-navigation.ts
Adds helpers for query routes and compare-selected links, preserving encoded queries and selected IDs without snapshot imports.
Route dashboard navigation
src/components/clinical-dashboard/differentials-home.tsx
Updates dashboard links, compare actions, empty states, catalogue links, and fallback navigation to use the shared helpers.
Return relative presentations redirects
src/app/differentials/presentations/route.ts, tests/differentials-navigation.test.ts, tests/audit-navigation-auth-regressions.test.ts
Builds relative redirect locations, returns explicit 307 responses, and updates coverage for relative URLs and preserved parameters.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DifferentialsHome
  participant differentials-navigation
  participant Browser
  participant presentationsRoute
  DifferentialsHome->>differentials-navigation: Build differential href with query and selected IDs
  differentials-navigation-->>DifferentialsHome: Return relative href
  Browser->>presentationsRoute: GET /differentials/presentations with query parameters
  presentationsRoute->>presentationsRoute: Compute presentationsRedirectLocation
  presentationsRoute-->>Browser: Return 307 Location with relative pathname and query
Loading

Possibly related PRs

Suggested reviewers: cursoragent

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is informative, but it omits required template sections for Summary, Verification, Risk and rollout, and Clinical Governance. Add the template's Summary, Verification checklist, Risk and rollout, Clinical Governance Preflight, and Notes sections, including any unmet verification items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: routing compare-selected links directly to the resolved presentation workflow.
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.
✨ 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/fix-restricted-viewport-error-on-compare-hk5lur

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

@BigSimmo
BigSimmo marked this pull request as ready for review July 18, 2026 15:39

@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: e0545bc86e

ℹ️ 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/components/clinical-dashboard/differentials-home.tsx
@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.

@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: e0545bc86e

ℹ️ 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/lib/differentials-navigation.ts Outdated
cursoragent and others added 2 commits July 18, 2026 15:45
…re-hk5lur

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Resolve presentation workflow on the server redirect with a relative
Location header so Compare selected keeps IDs without pulling the
differentials snapshot into the client bundle.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

@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: 1

🤖 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 `@tests/differentials-navigation.test.ts`:
- Around line 39-44: Update the redirect assertion in the differential
navigation test to parse the relative location URL and inspect its query
parameters. Assert that the decoded ids parameter exactly equals both expected
selected IDs, while retaining the existing status, path, query, and host
assertions.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f80b75ee-4412-49b2-a55c-a3876e5f5ab8

📥 Commits

Reviewing files that changed from the base of the PR and between 44a4c51 and 78ceaa9.

📒 Files selected for processing (5)
  • src/app/differentials/presentations/route.ts
  • src/components/clinical-dashboard/differentials-home.tsx
  • src/lib/differentials-navigation.ts
  • tests/audit-navigation-auth-regressions.test.ts
  • tests/differentials-navigation.test.ts

Comment thread tests/differentials-navigation.test.ts
@BigSimmo
BigSimmo enabled auto-merge (squash) July 18, 2026 16:00
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/differentials-navigation.test.ts

Commit: e59b9a15506e1169ac0526ff4f0ec579961ef368

The changes have been pushed to the codex/fix-restricted-viewport-error-on-compare-hk5lur branch.

Time taken: 2m 38s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@BigSimmo BigSimmo closed this Jul 18, 2026
auto-merge was automatically disabled July 18, 2026 16:06

Pull request was closed

cursor Bot pushed a commit that referenced this pull request Jul 18, 2026
Capture the reviewed screenshot-queue outcomes, supersessions, and
hosted/local checks used for the safe merge pass.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo deleted the codex/fix-restricted-viewport-error-on-compare-hk5lur branch July 18, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants