Implement gate() and parseReport() - #5
Open
ruanmartinelli wants to merge 2 commits into
Open
Conversation
ruanmartinelli
force-pushed
the
claude/code-review-improvements-5kqcfs
branch
from
July 7, 2026 00:42
d4f0f1d to
549fe56
Compare
Replace the TODO stubs with real implementations:
- loadBaseline reads and parses a saved JSON report, validating its
basic { name, byModel } shape with clear error messages.
- gate compares a fresh report against a baseline per model: an overall
score drop, or a baseline model missing from the report, is a
regression. opts.byTag extends the same check to per-tag scores, and
opts.tolerance (default 0) forgives small drops to absorb eval noise.
New models and tags are ignored.
Converts the placeholder TODO tests into real coverage and documents
both functions in the README. Also gitignores node-compile-cache,
which the test run drops in the repo root.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015XMPpi4PX2bWwAoMLaZZ4k
ruanmartinelli
force-pushed
the
claude/code-review-improvements-5kqcfs
branch
from
July 7, 2026 00:43
549fe56 to
bf526fa
Compare
The library should never touch node:fs. parseReport takes a JSON
string (or an already-parsed value), validates the { name, byModel }
shape, and returns the report — the caller owns the readFile. gate was
already pure and is unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015XMPpi4PX2bWwAoMLaZZ4k
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.
gateandloadBaselineare exported from the public API but wereTODO: implementstubs that throw at runtime. This fills them in — with one design change per review feedback: the library never touchesnode:fs.What
parseReport(source)(replacesloadBaseline(path)) — a pure function that takes a JSON string or an already-parsed value, validates the basic{ name, byModel }shape, and returns the typed report. The caller owns I/O:gate(report, baseline, opts?)— already pure; compares per model:opts.byTagholds each baseline model's per-tag scores to the same standardopts.tolerance(default 0) forgives drops of at most that much — useful for absorbing eval noise in CIRegression strings are human-readable and CI-log friendly, e.g.
m1: overall 0.7000 < baseline 0.8000.Also adds
node-compile-cache(dropped in the repo root by test runs) to.gitignore.Tests
The placeholder
it.todos are now 16 real tests — all pure, no temp files: JSON round-trip, already-parsed input, malformed values, every regression path, tolerance boundaries, and the empty-baseline case.pnpm typecheck && pnpm test: 85 passing.Notes
loadBaselineis gone rather than kept as an alias — it was an unusable stub onmain, so nothing can depend on it.opts.toleranceis a small addition beyond the original doc comment (which only mentionedbyTag) — happy to drop it if you'd rather keep the surface minimal.node:fsprinciple (its phase 1 proposed fs-touching save/load helpers).History
The first commit implemented
loadBaselinewithreadFile; the second makes the library fs-free per review feedback.🤖 Generated with Claude Code
https://claude.ai/code/session_015XMPpi4PX2bWwAoMLaZZ4k