Skip to content

refactor: decompose ClinicalDashboard monolith (AuthPanel + answer-content, move-only) - #202

Merged
BigSimmo merged 13 commits into
mainfrom
claude/kind-visvesvaraya-beb836
Jul 2, 2026
Merged

refactor: decompose ClinicalDashboard monolith (AuthPanel + answer-content, move-only)#202
BigSimmo merged 13 commits into
mainfrom
claude/kind-visvesvaraya-beb836

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

What

Move-only decomposition of src/components/ClinicalDashboard.tsx into src/components/clinical-dashboard/*, landing two modules so far.

1. auth-panel.tsx

Extracted AuthPanel + its auth-email snapshot helpers verbatim. The isolated leaf of the map — no closure over main-component state, helpers solely consumed by it.

2. answer-content.tsx

Extracted the answer render family (SourceImage, ScopeAndGovernanceNotice, the answer/source formatters, SourcePreviewContent, NaturalLanguageAnswer, UserQuestionBubble, KeyClinicalItems) against the current (post-drift) monolith. The block moved verbatim — the original source range diffs empty against the new module body.

Two monolith-internal helpers used by both the moved block and the code that stays behind went to clean shared homes instead of a monolith↔module import cycle:

  • useMobilePreviewSheet (+ its media-query snapshot helpers) → new clinical-dashboard/use-mobile-preview-sheet.ts (matches the use-theme.ts hook pattern)
  • comparableAnswerTextclinical-dashboard/display-text.ts (the shared text-helper module)

Move fidelity

  • Blocks cut verbatim — no body edits; data-testid / aria-label strings byte-identical across ClinicalDashboard.tsx + clinical-dashboard/*.tsx (sha1 checksum unchanged before/after each move).
  • Stripped only the imports each move orphaned; pre-existing dead-code lint warnings left untouched (move-only discipline — confirmed HEAD=WORK usage counts).

Pinned guards — retargeted, not weakened

  • tests/clinical-dashboard-merge-artifacts.test.ts: findFunctionDeclaration now scans a scannedFiles array (monolith + answer-content.tsx); the NaturalLanguageAnswer pin resolves in the module, ClinicalOutputPanel still in the monolith, and the clinicalOutputModeCopy/PrimaryAnswerContent absence checks now cover both files.
  • tests/rendered-text-formatting.test.ts: negative raw-render regexes now scan the monolith+module corpus (verified the module trips none); positive toContain assertions stay pinned to the monolith where those strings remain.

Gates (green)

  • npm run typecheck
  • npm run lint — 0 errors
  • Pinned vitest 12/12
  • testid/aria sha1 checksum identical before/after
  • npm run format:check
  • npm run verify:cheap — 903/906 (the one failure is an unrelated rag-cache-invalidation 15s timeout under parallel load; passes in isolation in ~6s)

Deferred

Remaining modules (ordered hand-off in docs/process-hardening.md Phase 3): evidence-panels.tsx (clinical-detail helper family — must land before output-panel), output-panel.tsx (AST-pinned ClinicalOutputPanel), visual-evidence.tsx, document-results.tsx.

🤖 Generated with Claude Code

BigSimmo and others added 10 commits July 2, 2026 20:30
Adds scripts/capture-chrome-parity.ts: drives Playwright against the dev
server with the smoke suite's demo API mocks and dumps getComputedStyle
(incl. ::placeholder/::after) for the header + composer chrome across 16
states (home/answer/focus/document x mobile/desktop x light/dark).
Selectors are refactor-stable (testids/aria/structure), never the chrome
class names being migrated. --compare diffs two snapshots and exits
nonzero on any difference, proving the @layer migration is pixel-identical.
Snapshots write to the git-ignored scratch/ dir (machine-specific).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The "purple" mode-home pill tone (Youth service pathway dot) used a raw
Tailwind palette color, the only non-token color introduced by #171. It
did not adapt to dark mode or forced-colors like the surrounding tokens.
Add --tone-purple (light #7c3aed == violet-600 so light mode is
unchanged; brighter #a78bfa on dark; CanvasText under forced-colors) and
reference it via bg-[color:var(--tone-purple)].

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…cal)

The header + mode pill was the source of the recurring overlap/shadow
bugs. Move edge-glass-header (+ responsive padding), universal-header,
universal-header-mode-button, and universal-header-icon-control into
@layer components so Tailwind utilities on those elements now win instead
of silently losing to the unlayered class.

Reconciled the three shadow conflicts so rendered output is unchanged:
drop the dead shadow-[var(--shadow-tight)] on the two edge-glass-header
headers (class already sets box-shadow:none), and drop
shadow-[var(--shadow-inset)] on the mode button and the New-chat icon
control so the layered class supplies its shadow directly (avoids
Tailwind's shadow utility injecting transparent ring-placeholder layers).

Verified byte-identical computed styles across 16 states
(home/answer/focus/document x mobile/desktop x light/dark) with
scripts/capture-chrome-parity.ts. The frosted COMPOSER chrome stays
unlayered (deferred): PR #171 pushed it to ~92 conflicts in shared
ui-primitives constants; tracked in docs/process-hardening.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…aya-beb836

# Conflicts:
#	scripts/capture-chrome-parity.ts
…anel

Move-only: AuthPanel plus its solely-consumed auth-email snapshot helpers
(subscribeAuthEmail/getAuthEmailSnapshot/getServerAuthEmailSnapshot and the
authEmailChangeEvent const) out of the ClinicalDashboard monolith into a
self-contained module. No closure over main-component state; testid/aria
strings unchanged (sha1 identical); pinned AST/rendered-text guards green.
First step of the approved move-map decomposition (docs/redesign/04-deferred).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 17:05
@BigSimmo
BigSimmo disabled auto-merge July 2, 2026 17:09
@BigSimmo
BigSimmo enabled auto-merge July 2, 2026 17:11
@BigSimmo
BigSimmo merged commit 2de6106 into main Jul 2, 2026
4 checks passed
@BigSimmo BigSimmo changed the title refactor: extract AuthPanel from ClinicalDashboard monolith (move-only) refactor: decompose ClinicalDashboard monolith (AuthPanel + answer-content, move-only) Jul 2, 2026
BigSimmo added a commit that referenced this pull request Aug 5, 2026
Add #237#239 from the fastest-wins planning session, repair mislabeled
queue rows (#201/#202 vs #183/#185), remove archived #182 from the queue,
and enqueue every previously open-but-unqueued item including P1s #207,
#226, and #231.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
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