test: evals harness - #45
Open
amal66 wants to merge 1 commit into
Open
Conversation
Ports the evals/ evaluation harness: a zero-dependency, fully offline, deterministic scorecard for citation accuracy, field extraction, prompt-injection resistance, and privilege/PII leakage, run against committed fixtures (no network, no LLM calls). Verbatim copy of evals/ from amal66/mike@main (b3166dd); the harness is self-contained (relative imports only), so no path or import adaptation was needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CEguyEgXa9JjCciXCcVemC
This was referenced Jul 17, 2026
Closed
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.
Summary
Adds
evals/, a zero-dependency, fully offline, deterministic legal-AI evaluation harness: a curated golden dataset (8 synthetic cases), five deterministic scorers (citation accuracy, keyword recall, field extraction, prompt-injection resistance, privilege/PII leakage), and a fixture-based mock runner that produces a scorecard and a CI-gating exit code with no network, no LLM calls, and no secrets.Changes
evals/run.mjs— CLI entry point (--threshold,--break,--json,--dataset); exits non-zero when pass rate < thresholdevals/src/engine.mjs— dataset loading + run loop + aggregate statsevals/src/scorers.mjs— the five deterministic scorersevals/src/runners/fixture-runner.mjs— offline mock runner replaying committed fixtures, with a deliberate-failure modeevals/datasets/golden.json+golden.schema.json— 8 synthetic cases (no real/copyrighted document text) + JSON Schemaevals/fixtures/model_outputs.json— recorded mock outputsevals/package.json— private, zero-dependency (npm test→node run.mjs)evals/README.md— usage, scorer semantics, an honest "what this does NOT cover" scope section, and a sketch for plugging in a live providerThe harness is entirely self-contained (relative imports only, no dependencies), so it runs unchanged on this layout:
node evals/run.mjsfrom the repo root. Nothing was left behind — no part of the fork's harness depends on fork-only modules.Why
Mis-citation, prompt injection via document content, and privilege/PII leakage are the highest-stakes failure modes for a legal-AI assistant, and all three are cheap to regression-test deterministically. This gives the repo a runnable scorecard that can gate CI (see the companion CI workflow PR, whose
evalsjob runsnode evals/run.mjs --threshold 1.0once this merges).Testing
node evals/run.mjs— 8/8 cases pass, mean score 0.979, exit code 0node evals/run.mjs --break privilege-pii-ssn— one case flips to FAIL, exit code 1 (verifies the CI gate actually fails)node --checkon all four.mjssources — cleannpm ci && npm run build(tsc) inbackend/— greenProvenance
All lines are mechanical ports of amal66/mike@origin/main (commit b3166dd); exceptions: none —
evals/is a byte-for-byte verbatim copy (verified withdiffagainstorigin/main:evals/*); the harness is self-contained, so no path/import adaptation was needed. The private package name@mike/evalsinevals/package.jsonis kept verbatim; the package is never published or depended on.🤖 Generated with Claude Code
https://claude.ai/code/session_01CEguyEgXa9JjCciXCcVemC