BiasProfile screen conformance + audit-walk scoping#385
Merged
Conversation
The extraction convention already binds src/screens (its CLAUDE.md mirrors the components one), but frontend-organization.md's audit checklist only walked src/components - so the periodic sweeps never looked at the biggest files in the frontend, which is where the tech-debt audit found ~22k lines of unextracted decision logic.
The bias-profile modal had accumulated the largest pile of decision logic of any screen: row sorting, the render-cap selection, catalog lookups, five formatters, the per-row interpretation prose, the landscape chart's hue and width geometry, and the current-conversation empty-state copy all lived in the .svelte file, none of it unit- testable without a mount. This moves every framework-agnostic decision into the existing src/lib/ui/bias-profile.ts companion (joining the five primitives already there) and adds plain-vitest coverage for the whole module in tests/bias-profile.test.ts, following the cohort-panel exemplar. The screen keeps only Svelte wire-up: state runes, the supabase fetch orchestration, toggle handlers, and markup that picks values instead of deriving them. Structure only - no behavior change. This is the decomposition pattern for the remaining oversized screens: extract primitives into the companion module first; split components only when a section is genuinely self-contained (nothing here was - the sections all read the same summary/rendered state, so the screen stays one file with clean delegation).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SYNOPSIS
First screen of the Layer 3 decomposition:
BiasProfile.sveltebrought into conformance with the frontend split, plus the audit-checklist fix that makes the periodic walk coversrc/screens/at all.PURPOSE
The tech-debt audit found the screens tree carrying ~22k lines of unextracted decision logic - and the reason it accumulated is that
frontend-organization.md's audit walk only scopedsrc/components/. BiasProfile (1,466 lines) is the smallest oversized screen, so it establishes the decomposition pattern for the rest.DESCRIPTION
src/components/*.svelteANDsrc/screens/*.svelte, with a note that screens are where the convention drifts hardestsrc/lib/ui/bias-profile.tscompanion per the convention; screen keeps composition + runes only; 413 lines of new vitest coverage over the extracted primitivesNotes:
Generated by Claude Code