feat: add benchmark scaffold and result store (task 0022) #23
Reference in New Issue
Block a user
Delete Branch "task-0022-bench-scaffold-and-result-store"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task:
.claude/tasks/0022-bench-scaffold-and-result-store.mdSummary
Lays the foundation the whole benchmark harness reads and writes:
bench/directory, excluded from the published npm package by the existingfilesallow-list; a new packaging-tier assertion locks in thatpackage/benchnever ships.bench/result.ts— the immutableResultRecordshape: the four token components, turns, duration, imputed cost, a tagged pass/fail outcome, and the arm/task/tier/trial/timestamp tags.ArmandTierare typed unions; the failure tag is"incorrect" | "confused" | "hung"(confused = turn cap, hung = wall-clock backstop, plusincorrectfor the checker-scored-wrong case the later runner records).bench/store.ts— an append-only sample store, one newline-delimited JSON file per cell at<root>/<arm>/<taskId>.jsonl. Immutability is structural: onlyappend/read/cellsare exposed and append is a bare file append, so deepening a cell can only add samples.cells()enumeration is foundational for the aggregator slice (0030).bench/README.md— harness working docs plus the benchmark vocabulary, deliberately kept out of the tool's domain glossary per the spec.vitest.bench.config.ts,npm run test:bench) colocated with the source and kept out of the fast tier, so harness code never counts against thesrc/coverage thresholds;tsconfig.jsonnow typechecksbench.All four acceptance criteria are met. No deviations from the plan; the only additions beyond the literal criteria (
CellKey,store.cells(), the README) are foundational for later slices and called out in the task's Implementation Notes.Review
Risk
Overall: Low
bench/files plus two tiny additive edits (package.jsonscript,tsconfig.jsoninclude); no existingsrc/callers touched.store.tscovered by a thorough colocatedstore.test.ts; packaging exclusion asserted;result.tsis types only.Standards — unaddressed findings
cells()casts a raw directory name straight to theArmunion (arm as CellKey["arm"]) without validation, so a stray directory outside the four arms would be silently mis-typed. Left intentionally: the store is internal harness code, it writes only under known arms, and the<root>/<arm>/layout is documented — validation here would be speculative. (The two Duplicated Code findings —appendbypassingcellPath, and the repeated ENOENT handling — were fixed in the diff.)Spec
No findings — the diff faithfully implements the task with no gaps, no scope creep, and no wrong behaviour.