Skip to content

V51: a store that fits on a screen - #113

Merged
dapiced merged 1 commit into
mainfrom
claude/labml-improvements-ipscw1
Oct 9, 2026
Merged

dapiced merged 1 commit into
mainfrom
claude/labml-improvements-ipscw1

Conversation

@dapiced

@dapiced dapiced commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Summary

Refactor with no intended behaviour change. The 906 existing unit tests and 97 Chromium e2e tests pass unchanged before and after.

Before After
lab-store.ts, 1 050 lines 530 lines: actions only, public names re-exported, so no importer changes
onmessage: a 250-line if / else if chain store/responses.ts: a dispatch table typed as a mapped type over WorkerResponse['kind']
State shape, V47 fence and threshold artifact inline in the store store/state.ts, store/fence.ts, store/artifacts.ts
Test files v35 … v40 honest-evaluation, imbalance-ensemble, knn-and-helpers, french-numbers, column-recipe, quality-score
numbersOf / missingRatio / shares duplicated in drift.ts and reference.ts one copy in quality/distribution.ts

Dispatch table

  • A missing or extra handler is now a compile error. The old chain's final else used to treat any unlisted kind as error without saying so.
  • The handler bodies were moved by script, not retyped.

Not done

  • Feature slices: the actions share one worker and one send, so slicing them would move code without separating anything.
  • Two quantile functions: left as two. On an empty list one returns 0 and the other NaN, so merging them would change behaviour.
  • Mixed test files v35 and v36: renamed, not split, to keep the change mechanical.

Coverage gate (V49) fired, and the fix was a test, not a lower floor

  • Moving the code turned 35 branches into 35 functions. The function denominator went from 2 142 to 2 174, and the 54 % floor failed at 53.72 %.
  • I added store/responses.test.ts: 17 cases that pin which fields each state-only response writes. That is also the check a moved body needs.
  • Function coverage is back at 54.46 %.

Test plan

  • lint, typecheck, format:check, build
  • npm run test:coverage: 923 passed (906 unchanged + 17 new), all floors met
  • Playwright Chromium: 97/97

🤖 Generated with Claude Code

https://claude.ai/code/session_01ELAjHYDyxa5zbbdcke1bMA


Generated by Claude Code

No behaviour change: the 906 existing unit tests and 97 Chromium e2e
tests pass unchanged.

- lab-store.ts 1050 -> 530 lines; the onmessage if/else chain becomes a
  typed dispatch table (store/responses.ts), one entry per response kind
- state, V47 fence and threshold artifact moved to store/
- v35..v40 test files renamed after what they pin
- numbersOf / missingRatio / sharesOverEdges merged into
  quality/distribution.ts (quantile functions kept apart: 0 vs NaN on [])
- responses.test.ts pins each state-only handler; it also restores the
  function-coverage floor the branch-to-function move had dipped
- PLAN/CHANGELOG: V51 delivered, version 1.51.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ELAjHYDyxa5zbbdcke1bMA
@dapiced
dapiced marked this pull request as ready for review October 9, 2026 10:13
@dapiced
dapiced merged commit ab72c8f into main Oct 9, 2026
7 checks passed
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