Skip to content

fix(forms): stop long pathway step codes overflowing the decision context#742

Closed
BigSimmo wants to merge 12 commits into
mainfrom
claude/form-sizing-design-8hebku
Closed

fix(forms): stop long pathway step codes overflowing the decision context#742
BigSimmo wants to merge 12 commits into
mainfrom
claude/form-sizing-design-8hebku

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Final piece of the form-code overflow cleanup (after #728 and #734). The decision-context "Pathway" card on the form detail page renders each before/parallel/after step code in a fixed-width column. pathwayItems keeps the raw string as the code when it matches a form-code shape — which includes qualified codes like 6B attachment (form 6B lists it as a parallel step) — so the code cell overflowed into the title.

  • Adds a small PathwayStepCode helper that renders only the split head (6B) in the compact code cell, reusing the shared splitFormCode from form-code-badge.
  • The cell now truncates and carries a full-code title tooltip; the adjacent title column already shows the full label, so no information is lost and the compact list styling is preserved.

Scope note: presentational only — one component (form-detail-page.tsx), no data/routing/retrieval/answer/governance behaviour touched. The full step label remains visible in the title column and via tooltip.

Verification

  • npx eslint src/components/forms/form-detail-page.tsx — clean
  • npx prettier --check — clean
  • node scripts/check-type-scale.mjs --strict — passes
  • npx vitest run tests/forms.test.ts tests/forms-clipboard-fallback.test.ts — 6/6 pass
  • npm run typecheck — no new errors in the changed file (pre-existing failures are missing @testing-library/@axe-core/playwright dev deps in tests/, identical on base)
  • Browser QA: screenshot of /forms/form-6b decision-context, whose parallel step is 6B attachment — the code cell now shows 6B with 6B attachment in the title column, fully contained; 1A/6A/Step rows unaffected
  • UI verification not run: the npm run verify:ui gate requires @axe-core/playwright, not installed in this environment; verified visually with the pre-installed Chromium via playwright-core instead.

Risk and rollout

  • Risk: low — presentational change to one component; renders a shorter code label in a compact sidebar cell.
  • Rollback: revert the single commit on this branch; no migrations or state.
  • Provider or production effects: None / not applicable.

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

  • Non-form step labels (e.g. Clinical de-escalation) already resolve to the Step head, so they render unchanged.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • UI Improvements
    • Pathway codes in the “Before,” “Parallel,” and “After” sections are now displayed in a more compact format.
    • When qualifiers are present, they’re available via tooltips for the relevant code cells, while maintaining full context for accessibility.

…text

The before/parallel/after lists in the decision-context card render the
step code in a fixed-width column. `pathwayItems` keeps the raw string as
the code when it looks like a form code, which includes qualified codes
like "6B attachment" (e.g. form 6B's parallel step), so the code cell
overflowed into the title.

Render only the split head ("6B") in that compact cell via a new
PathwayStepCode helper (reusing the shared splitFormCode) with truncation
and a full-code tooltip; the adjacent title column already carries the
full label, so nothing is lost.

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

supabase Bot commented Jul 17, 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 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 43e3f4d9-a2e6-4c7a-a13b-38d0382877b6

📥 Commits

Reviewing files that changed from the base of the PR and between 890e507 and 2bae0ea.

📒 Files selected for processing (1)
  • src/components/forms/form-detail-page.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/forms/form-detail-page.tsx

📝 Walkthrough

Walkthrough

Pathway codes on the form detail page now render compact heads, with optional qualifiers exposed through tooltips and assistive text in the Before, Parallel, and After pathway lists.

Changes

Pathway code rendering

Layer / File(s) Summary
Compact pathway code display
src/components/forms/form-detail-page.tsx
Imports splitFormCode, adds the PathwayStepCode renderer, preserves full codes for assistive technology, and uses it for pathway codes in the Before, Parallel, and After columns.

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

Possibly related PRs

  • BigSimmo/Database#728: Updates related form code rendering using splitFormCode, visible heads, qualifiers, and assistive text.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the presentational fix for overflowing pathway step codes.
Description check ✅ Passed The description is mostly complete and matches the template with summary, verification, risk, governance, and notes sections.
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 claude/form-sizing-design-8hebku

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

@BigSimmo
BigSimmo marked this pull request as ready for review July 17, 2026 18:53

@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/components/forms/form-detail-page.tsx (1)

206-221: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose the full pathway code in the tooltip.

When code is 6B attachment, using only qualifier for title shows attachment and omits the displayed head. This does not satisfy the stated behavior of providing the full code via tooltip.

Proposed fix
-        title={qualifier ?? undefined}
+        title={qualifier ? code.trim() : undefined}
🤖 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/components/forms/form-detail-page.tsx` around lines 206 - 221, Update
PathwayStepCode so its title exposes the complete original code whenever a
tooltip is needed, including both head and qualifier for values such as “6B
attachment”; preserve the existing head-only display and avoid adding a tooltip
when no qualifier exists.
🤖 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/components/forms/form-detail-page.tsx`:
- Around line 206-221: Update PathwayStepCode so its title exposes the complete
original code whenever a tooltip is needed, including both head and qualifier
for values such as “6B attachment”; preserve the existing head-only display and
avoid adding a tooltip when no qualifier exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 965e4f3a-e52f-4396-9a97-dc41c856665a

📥 Commits

Reviewing files that changed from the base of the PR and between 023c329 and c311f04.

📒 Files selected for processing (1)
  • src/components/forms/form-detail-page.tsx

Copy link
Copy Markdown
Owner Author

Re: CodeRabbit's "expose the full pathway code in the tooltip" comment — no change needed; the current code already does this. PathwayStepCode sets:

title={qualifier ? `${head} ${qualifier}` : undefined}

So for 6B attachment the tooltip is the full 6B attachment (head + qualifier), and there's no tooltip when there's no qualifier. The comment quotes title={qualifier ?? undefined}, which isn't what's in the file (form-detail-page.tsx:215). Leaving the code as-is.


Generated by Claude Code

@BigSimmo
BigSimmo enabled auto-merge July 17, 2026 19:58

@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/components/forms/form-detail-page.tsx (1)

205-220: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose the full pathway code to assistive technology.

The compact element displays only head, while the qualified code is available only through title, which is not reliably exposed to screen readers or keyboard/touch users. Follow FormCodeBadge’s existing pattern by adding a visually hidden full-code label (and marking the decorative truncated span aria-hidden).

🤖 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/components/forms/form-detail-page.tsx` around lines 205 - 220, Update
PathwayStepCode to expose the complete code by adding a visually hidden label
containing the full code, following FormCodeBadge’s accessibility pattern. Mark
the truncated span that renders head as aria-hidden so assistive technology uses
the full-code label instead of the decorative compact text.
🤖 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/components/forms/form-detail-page.tsx`:
- Around line 205-220: Update PathwayStepCode to expose the complete code by
adding a visually hidden label containing the full code, following
FormCodeBadge’s accessibility pattern. Mark the truncated span that renders head
as aria-hidden so assistive technology uses the full-code label instead of the
decorative compact text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f5e27430-21d0-4249-8b47-488b5dbd37bb

📥 Commits

Reviewing files that changed from the base of the PR and between c311f04 and 890e507.

📒 Files selected for processing (1)
  • src/components/forms/form-detail-page.tsx

claude and others added 2 commits July 17, 2026 21:47
PathwayStepCode showed only the split head ("6B") visually, leaving the
full code reachable only via the title tooltip, which assistive tech does
not reliably announce. Add an sr-only full-code label and mark the
decorative head aria-hidden, matching FormCodeBadge's pattern, so screen
readers get "6B attachment" while the compact visual is unchanged.

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

Copy link
Copy Markdown

CI triage

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

  • Production UIneeds 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 #3145 (success).

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

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.

3 participants