Repository navigation
fix: count failure categories per example; key the narrative cache on its facts - #53
Merged
Merged
Conversation
tool_selection stamps TOOL_SELECTION_DRIFT on both its conformance and its divergence row, so one example that picked another tool read "Different tools chosen (2 examples)" in the narrative and the report's top causes. Count each label once per distinct (prompt, example), as INVARIANT_VIOLATION already was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
insights.json was keyed on state.config_hash, fixed when the run is created, while evaluate and analyze re-read evalshift.yaml every time. Loosening a budget and re-running analyze + report rendered a PASS verdict beside a cached "FAIL under the configured policy" paragraph. Fold a digest of the FACTS block into the key so a change to scores, analysis or the persisted decision regenerates it; a plain re-render still hits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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 changes
Two report-correctness fixes found while reading a hosted run (
r_20261013_converter_ab3ce8).1. Failure categories count examples, not rows (
7ff042f)_failure_categories(analysis/policy.py) counted every scored row carrying a label.tool_selectionstampsTOOL_SELECTION_DRIFTon both its conformance row and its divergence row.(prompt_id, example_id). This is the ruleINVARIANT_VIOLATIONalready followed.INVARIANT_VIOLATIONkeeps its narrower blocking-only count.2. The narrative cache is keyed on the facts it describes (
2142d0f)insights.jsonwas keyed onstate.config_hashplus the insights model.state.config_hashis fixed when the run is created.evaluateandanalyzere-readevalshift.yamlon every call.Factsblock, which is built from the scores, the analysis and the persisted decision.report.pushstill ships whatever the lastreportcached. Runninganalyzeand thenpushwith noreportin between uploads the previous paragraph. This is documented, not changed.Docs: DOCS.md,
docs/configuration.md,llms-full.txtand CHANGELOG (Unreleased → Fixed).No change to the config, suite,
state.json,scores.jsonl,insights.jsonenvelope or bundle schemas.Why
cap_20587…, the target calledconvert_unitskm→kg where the source refused) reportedTOOL_SELECTION_DRIFT · 2.max_latency_increasefrom 0.30 to 0.60 on a run that failed only on latency.analyze+reporton that same run.migration_decision.jsonsays pass, but the HTML narrative still says "FAIL under the configured policy. 7 of 8 budgets passed…".evaluateagain;compareand CI runs were unaffected.Verified locally (CLI from this branch, on copies of testApp runs)
r_20261012_converter_c80f30: decision + HTML Top regression causesr_20261012_planner_664d3c(control: 3 drift rows on 3 examples)fallback_insight)reportanalyze+reportFactsdigest underPYTHONHASHSEED0/1/2/3/randomGates:
ruff check,ruff format --checkandmypy --strictare clean.pytest: 3095 passed, coverage 95.03%.New tests:
TestFailureCategoryCountsExamples::test_one_example_flagged_by_two_axes_counts_oncetest_a_reanalysed_decision_invalidates_the_cachetest_rescored_records_invalidate_the_cacheAll three failed before the change.
Not in this PR
tests/unit/test_cli_capture_remote.py::test_fetch_without_config_file_errorsdepends on terminal width. Rich wraps "not found" across lines when the temp path is long. It fails at the default width onmaintoo and passes atCOLUMNS=200.insights/templates.py:147.🤖 Generated with Claude Code