Skip to content

test: evals harness - #45

Open
amal66 wants to merge 1 commit into
upstream-mainfrom
upstream-pr/evals
Open

test: evals harness#45
amal66 wants to merge 1 commit into
upstream-mainfrom
upstream-pr/evals

Conversation

@amal66

@amal66 amal66 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

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 < threshold
  • evals/src/engine.mjs — dataset loading + run loop + aggregate stats
  • evals/src/scorers.mjs — the five deterministic scorers
  • evals/src/runners/fixture-runner.mjs — offline mock runner replaying committed fixtures, with a deliberate-failure mode
  • evals/datasets/golden.json + golden.schema.json — 8 synthetic cases (no real/copyrighted document text) + JSON Schema
  • evals/fixtures/model_outputs.json — recorded mock outputs
  • evals/package.json — private, zero-dependency (npm testnode 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 provider

The harness is entirely self-contained (relative imports only, no dependencies), so it runs unchanged on this layout: node evals/run.mjs from 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 evals job runs node evals/run.mjs --threshold 1.0 once this merges).

Testing

  • node evals/run.mjs — 8/8 cases pass, mean score 0.979, exit code 0
  • node evals/run.mjs --break privilege-pii-ssn — one case flips to FAIL, exit code 1 (verifies the CI gate actually fails)
  • node --check on all four .mjs sources — clean
  • Backend unaffected but re-verified on this branch: npm ci && npm run build (tsc) in backend/ — green

Provenance

All lines are mechanical ports of amal66/mike@origin/main (commit b3166dd); exceptions: none — evals/ is a byte-for-byte verbatim copy (verified with diff against origin/main:evals/*); the harness is self-contained, so no path/import adaptation was needed. The private package name @mike/evals in evals/package.json is kept verbatim; the package is never published or depended on.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CEguyEgXa9JjCciXCcVemC

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
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.

1 participant