Skip to content

Add opt-in live-model mode to the benchmark harness - #16

Merged
morgaesis merged 2 commits into
mainfrom
feat/bench-live-mode
Jun 13, 2026
Merged

morgaesis merged 2 commits into
mainfrom
feat/bench-live-mode

Conversation

@morgaesis

Copy link
Copy Markdown
Contributor

Adds a --live / BENCH_LIVE=1 mode to the bench harness that runs the real binary against the real fixtures with a real model (local diff-file mode, no forge I/O), scoring detection rate, silence-on-clean, false positives, confidence distribution, and duration, with a timestamped report under bench/.runs (gitignored). Mock mode stays the default and the CI path; live mode refuses without POSTIL_API_KEY and is documented as a measured baseline (single model, one run each), not a peer comparison. tsc, mock bench (30/30), and cargo test are green.

Add a live mode to the bench harness that runs the real release binary
against the same fixtures with a real model and no mocked model server,
measuring detection ability rather than pipeline fidelity. Each case runs
in local diff-file mode (postil review --diff-file <f> --no-post
--output-json), which does no forge I/O, so no GitHub server is involved
and nothing is written to any repo.

It scores detection rate (path match, line within +/-3), severity match
among detections, silence on clean PRs, false positives, the confidence
distribution of true detections, and per-case duration and token usage,
mirroring the earlier manual fixture run. Live mode refuses to run
without POSTIL_API_KEY and never reads or prints the key value;
REVIEW_MODEL/--model selects the model (default deepseek/deepseek-v4-pro).

Selected via --live or BENCH_LIVE=1 (new bench:live script). Every run
writes a timestamped JSON report under .runs/ (gitignored). Mock mode and
bun run bench are unchanged and remain the default and the CI path.
Document the opt-in live mode: that it needs POSTIL_API_KEY, spends real
tokens, is not run in CI, what it scores, and that its numbers are a
measured baseline for this CLI (single model, one run per case, diff-only)
and not a peer comparison.
@morgaesis
morgaesis merged commit 4943584 into main Jun 13, 2026
6 checks passed

@postil-dev postil-dev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Live-mode defect scoring uses an unsafe cast for the ground-truth line number; if a fixture supplies null, the tolerance check becomes NaN <= 3 and the case is always scored as a miss, silently corrupting the detection-rate metric.

  • warn warn bench/src/live.ts:238 — Ground-truth null line breaks defect scoring · confidence 0.85 · kind: risk

Model: moonshotai/kimi-k2.6

Comment thread bench/src/live.ts
}

const match = findings.find(
(f) => f.path === truth.path && Math.abs(f.line - (truth.line as number)) <= LINE_TOLERANCE,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warn Ground-truth null line breaks defect scoring
warn · confidence 0.85 · kind: risk

Line 238 computes Math.abs(f.line - (truth.line as number)). If truth.line is null (allowed by the GroundTruth interface), the subtraction produces NaN and the comparison is always false, so the defect is never counted as detected even if the model found the right file. This silently under-reports the detection rate for any fixture lacking an exact line. Fix: add a guard so that when truth.line == null the benchmark either matches on path only or skips the case with an explicit error, and remove the unsafe cast.

@morgaesis
morgaesis deleted the feat/bench-live-mode branch July 2, 2026 04:06
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