Skip to content

BiasProfile screen conformance + audit-walk scoping#385

Merged
sysread merged 2 commits into
mainfrom
claude/so-tech-debt-audit-8zr2gf
Jul 3, 2026
Merged

BiasProfile screen conformance + audit-walk scoping#385
sysread merged 2 commits into
mainfrom
claude/so-tech-debt-audit-8zr2gf

Conversation

@sysread

@sysread sysread commented Jul 3, 2026

Copy link
Copy Markdown
Owner

SYNOPSIS

First screen of the Layer 3 decomposition: BiasProfile.svelte brought into conformance with the frontend split, plus the audit-checklist fix that makes the periodic walk cover src/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 scoped src/components/. BiasProfile (1,466 lines) is the smallest oversized screen, so it establishes the decomposition pattern for the rest.

DESCRIPTION

  • audit scope: the periodic walk now covers src/components/*.svelte AND src/screens/*.svelte, with a note that screens are where the convention drifts hardest
  • BiasProfile: decision logic (label transforms, stat derivations, list assembly, shape branching) extracted into the existing src/lib/ui/bias-profile.ts companion per the convention; screen keeps composition + runes only; 413 lines of new vitest coverage over the extracted primitives

Notes:

  • zero behavior change; QA verified the modal renders all 19 bias types with stats, gate green, zero console errors
  • pattern-setter for the remaining screens (Memories, Settings, Wiki, Cookbook, Chat), which follow in subsequent batches

Generated by Claude Code

claude added 2 commits July 3, 2026 20:26
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).
@sysread sysread merged commit 1ec5d77 into main Jul 3, 2026
1 check passed
@sysread sysread deleted the claude/so-tech-debt-audit-8zr2gf branch July 3, 2026 20:56
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.

2 participants