feat: add promptlens compare for run-to-run regression detection - #45
Open
brainsparker wants to merge 1 commit into
Open
feat: add promptlens compare for run-to-run regression detection#45brainsparker wants to merge 1 commit into
brainsparker wants to merge 1 commit into
Conversation
Compare any two exported runs by (test case, model) pair: per-case score deltas, new error detection, per-model summaries with cost and latency drift, markdown reports for PR comments, and a --fail-on-regression CI gate that exits 3 so pipelines can tell relative regressions apart from absolute gate failures (2) and run errors (1). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What this adds
promptlens compare <baseline.json> <current.json>: run-to-run comparison and regression detection built on the results.json every run already exports.--fail-on-regressionexits with code 3, distinct from the absolute--fail-undergate (2) and run errors (1), so pipelines can tell the three failure modes apart--markdown <path>writes a diff report ready to post as a PR comment;--json <path>emits the full comparison data for downstream toolingUsage
Why this, why now
PromptLens recently shipped JUnit XML export and a
--fail-underscore gate (#42, #43). That is an absolute gate: it cannot answer "did this prompt change make things worse than main?" when both runs clear the bar. Relative baseline comparison is the defining pre-ship feature across the 2026 eval tooling market:PromptLens is positioned as the lightweight local alternative to those platforms, and this was the biggest missing piece of that story. It composes with the existing exit-code scheme instead of adding a parallel one.
Runner-up candidates considered today: new export targets for you.md (existing coverage of Claude Code, Codex, Gemini, Windsurf, Cursor, and AGENTS.md is already strong) and MCP-Profiles harness extensions (smaller user reach).
Implementation notes
promptlens/comparison.py: pydantic models (CaseComparison,ModelComparisonSummary,RunComparison),load_run_result()with clear errors for missing / invalid / wrong-schema files,compare_runs(), andrender_markdown()compareCLI command inpromptlens/cli.pyfollowing the existing click + rich conventionsTest status
tests/test_comparison.pyandtests/test_cli_compare.py(pairing, thresholds, error transitions, coverage changes, markdown output, exit codes, invalid input)Built by Daily Feature Builder.