Repository navigation
test(365): pin the stickler surface Strands Evals 1.6.0 reads - #410
Conversation
strands-agents-evals 1.6.0 scores structured output with stickler (StructuredOutputSimilarity, StructuredOutputReport). Its suite pins a released stickler, so only a test here fails on the commit that breaks it. - tests/integrations/strands_corpus.py: five models covering the shapes users pass as structured_output_model, 42 cases, and a verbatim copy of 1.6.0's _passed gate. - test_strands_evals_contract.py (no strands dependency): import paths, eval_for kwargs, evaluate/explain shapes, every EvalResult attribute, that raw["confusion_matrix"]["overall"] carries integer tp/fa/fd/fp/tn/fn, recall = tp/(tp+fn), matched = score >= threshold, the nothing-to-find guard, and aggregate_from_comparisons on stripped and JSON-reloaded raws. - test_strands_evals_snapshot.py + strands_evals_snapshot.json: exact scores, verdicts and aggregate metrics for 40 typical cases. STICKLER_UPDATE_STRANDS_SNAPSHOT=1 regenerates it. - test_strands_evals_e2e.py: the real evaluator through Experiment, offline; skipped without strands_evals, fails if stickler is not this checkout. - CI: a strands-evals job installs strands-agents-evals==1.6.0 without its [stickler] extra and runs tests/integrations on Python 3.10 and 3.14. Refs #365.
Security Scan ResultsASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Top 2 HotspotsFiles with the highest number of security findings:
Detailed FindingsShow 4 actionable findingsFinding 1: SECRET-HEX-HIGH-ENTROPY-STRING
Description: Code Snippet: Finding 2: B108
Description: Code Snippet: Finding 3: B307
Description: Code Snippet: Finding 4: B307
Description: Code Snippet: Report generated by Automated Security Helper (ASH) at 2026-10-16T17:49:57+00:00 |
|
|
||
| # e2e: install strands-agents-evals WITHOUT the [stickler] extra, which would | ||
| # pull a PyPI stickler-eval over this checkout. The e2e fails if it did. | ||
| uv pip install --python .venv "strands-agents-evals==1.6.0" |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
The local e2e install command fails today: it has no --exclude-newer-package, so the 7-day [tool.uv] cooldown rejects 1.6.0 (uploaded 2026-10-14T22:45Z).
Verified with uv 0.12.3 on 2026-10-20: uv pip install --python .venv "strands-agents-evals==1.6.0" exits with "requirements are unsatisfiable" and the hint "strands-agents-evals was filtered by exclude-newer". Anyone following the Running section before 2026-10-21 cannot run the e2e file. Add the same --exclude-newer-package "strands-agents-evals=2026-10-15T00:00:00Z" flag the workflow uses.
There was a problem hiding this comment.
Fixed in #442 (59e39ce, 2db699d). The README command now carries the workflow's --exclude-newer-package "strands-agents-evals=2026-10-15T00:00:00Z" and the same uv.lock constraints as CI, and it writes them to a mktemp file instead of a fixed /tmp path. Ran the exact snippet as a dry run in bash and zsh against a fresh venv (uv 0.11.6): it resolves strands-agents-evals==1.6.0 with idna==3.15. Thanks for catching it.
| ## Bumping strands-agents-evals | ||
|
|
||
| Re-read `structured_output.py` in the new wheel, update the line references and | ||
| `strands_test_pass` if `_passed` changed, then bump the pin in the workflow. The |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
The bump procedure says to bump the pin but not to move the --exclude-newer-package cutoff, and the fixed cutoff blocks every later release permanently.
The per-package override replaces the global 7-day cooldown for strands-agents-evals. A maintainer who follows this section and changes only ==1.6.0 to ==1.7.0 keeps the cutoff 2026-10-15T00:00:00Z, so 1.7.0 never resolves, even after 7 days, and the strands-evals job fails at install. The workflow comment says "Move the cutoff with the pin". Add that step here.
There was a problem hiding this comment.
Fixed in #442 (59e39ce, 2db699d). The bump steps now say to change the ==1.6.0 pin and move the --exclude-newer-package cutoff to just after the new release's upload time, in both the workflow and the README command, and to git grep -n 1.6.0 for the remaining references. They also say why: the cutoff replaces the cooldown for this package, so a pin newer than the cutoff never resolves.
| # (1.6.0 was uploaded 2026-10-14T22:45Z), so the job tests the release | ||
| # the integration shipped in. Move the cutoff with the pin. | ||
| run: >- | ||
| uv pip install --python .venv |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
uv pip install runs without constraints, so it upgrades packages that uv.lock pinned. The strands-evals job then tests stickler against dependency versions that uv.lock does not record.
Measured on this branch after uv sync --frozen: the dry run of this exact command replaces idna==3.15 (locked) with idna==3.20. A future strands-agents or transitive release that raises a pydantic, numpy or scipy floor would move those packages too, and failures would be blamed on stickler. Constrain the install to the lock: uv export --frozen --no-hashes -o /tmp/lock.txt followed by uv pip install ... -c /tmp/lock.txt.
There was a problem hiding this comment.
Fixed in #442 (59e39ce, 2db699d). The install is now constrained to the lock: uv export --frozen --no-hashes --no-emit-project -q -o "$RUNNER_TEMP/uv-lock.txt", then uv pip install -c. --no-emit-project is required: without it the export includes -e . and uv rejects it ("Unnamed requirements are not allowed as constraints"). Measured with a dry run in a fresh venv: constrained gives idna==3.15, unconstrained gives 3.20. The constraints cover uv.lock's default (no-extras) export only, 78 packages. 35 of the packages strands-agents-evals installs (boto3, httpx, strands-agents, mcp, ...) are locked only under extras and can still move. The workflow comment says so. CI uses a file and not <(...) because process substitution hides a failed export and installs unconstrained (measured). -q stops the 221-line echo.
| class TestGuard: | ||
| @pytest.mark.parametrize("case_id,expected", sorted(GUARD_VERDICTS.items())) | ||
| def test_verdict(self, case_id, expected): | ||
| assert strands_test_pass(_evaluate(_case(case_id)), 0.7) is expected |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
TestGuard hardcodes 0.7 instead of STRANDS_DEFAULT_THRESHOLD, which this file imports and uses elsewhere.
If the default in strands_corpus.STRANDS_DEFAULT_THRESHOLD changes on a strands bump, _evaluate scores at the new threshold but strands_test_pass(..., 0.7) still gates recall at 0.7. Lines 325, 333, 341 and the other 0.7 literals in TestGuard then pin verdicts for a configuration the evaluator does not use. Replace the literals with the constant.
| # --- aggregate_from_comparisons --------------------------------------------------- | ||
|
|
||
|
|
||
| def _by_model(): |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
_by_model() evaluates all 42 corpus cases on every call, and every TestAggregate test calls it, even though each test uses one model's cases.
There are 25 parametrized calls, so the corpus is evaluated about 1,000 times to produce results that never change. Optional: cache the result with a module-scoped fixture or functools.lru_cache, or evaluate only the requested model's cases.
There was a problem hiding this comment.
Fixed in #442. 59e39ce made the helper (now _results(model)) evaluate only the requested model's cases. 2db699d makes _evaluate share one spec per model and threshold, as the evaluator shares the one it builds at line 344. Measured over test_strands_evals_contract.py: eval_for calls went from 1630 to 116 and evaluate calls from 1577 to 737, still 603 passed.
| stored: Dict[str, List[Dict[str, Any]]] = {} | ||
| cases: Dict[str, Any] = {} | ||
| for case in SNAPSHOT_CORPUS: | ||
| spec = specs.setdefault( |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
specs.setdefault(case.model, eval_for(...)) evaluates its default eagerly, so eval_for runs once per case (40 times) and 35 of the specs are discarded.
setdefault always evaluates its second argument. Optional: use if case.model not in specs: specs[case.model] = eval_for(...), which builds one spec per model as the code intends.
| return spec.evaluate(case.expected, case.actual) | ||
|
|
||
|
|
||
| def _case(case_id): |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
_case, CASE_IDS, and _direct (an equivalent of the contract file's _spec/_evaluate) are copied between test_strands_evals_e2e.py and test_strands_evals_contract.py.
Both files already import from strands_corpus.py. Optional: move these helpers there, so a change to how a case is looked up or scored only has to be made once.
There was a problem hiding this comment.
Agreed. I kept it out of the follow-up to keep that diff to review fixes. It is tracked for 1.1.0 in #440: move _case, CASE_IDS and the evaluate helper (_direct / _evaluate) into strands_corpus.py, so both files share one lookup and one scoring path.
|
|
||
|
|
||
| @pytest.fixture(scope="module", autouse=True) | ||
| def _this_checkout_offline(): |
There was a problem hiding this comment.
Non-blocking — suggest a follow-on issue.
Only the e2e file checks which stickler is imported. The contract and snapshot tests do not, and they run when strands_evals is absent, which is when the e2e file is skipped.
If an editable install points at another worktree, a local pytest tests/integrations without strands reports the snapshot as matching or changed against that other tree, and nothing fails to flag it. AGENTS.md ("Print which stickler you imported before you trust a number") describes this case. Optional: move the inspect.getfile(stickler) check into a tests/integrations/conftest.py so it covers all three files.
There was a problem hiding this comment.
Fixed in #442 (59e39ce). The check moved from the e2e file into tests/integrations/conftest.py as a session-scoped autouse fixture, so it covers the contract, snapshot and e2e files whether or not strands is installed. Measured: run from w365f with a venv whose editable stickler points at another worktree, all 777 tests error. With PYTHONPATH set to the checkout: 776 passed, 1 xfailed. A repo-wide version of the guard is tracked separately in #441.
vawsgit
left a comment
There was a problem hiding this comment.
✅ LGTM!
The 8 inline comments are non-blocking and are suggestions for follow-on issues.
|
Thanks @vawsgit for the careful review. #410 merged before the fixes landed, so they are in #442:
Measured on the follow-up tree: full suite 3765 passed, 3 skipped, 1 xfailed; Strands e2e (strands-agents-evals 1.6.0) 776 passed, 1 xfailed; snapshot unchanged. Helper dedup (#440) and a repo-wide wrong-tree guard (#441) are tracked for 1.1.0. |
Closes #365.
strands-agents-evals1.6.0 shipsStructuredOutputSimilarity, and itssticklerextra pinsstickler-eval>=1.0.0,<2.0.0, so every stickler 1.x release reaches its users. Nothing in this repo exercised that surface. This adds tests that fail if stickler changes anything the evaluator reads.What is pinned
Read from the 1.6.0 source (
strands_evals/evaluators/deterministic/structured_output.py), not guessed:stickler.eval_for,stickler.aggregate_from_comparisons,stickler.utils.process_evaluation.ProcessEvaluation.eval_for/EvalSpec: the exact call the evaluator makes (match_threshold,weight_hints),evaluate(expected, actual), andexplain()keyed by dotted path withcomparator,threshold,weight,clip_under_threshold,source,why.EvalResult:overall_score,precision,recall,f1are finite floats in [0, 1];matched == overall_score >= match_threshold;field_scoreskeys are the top-level fields.raw:confusion_matrix.overallcarries integertp,fa,fd,fp,tn,fn. The evaluator reads these with.get()defaults, so a renamed key would turn every case into a pass instead of raising. The tests assert the keys exist._passed, checked against 13 expected verdicts. The e2e tests confirm the copy agrees with the real evaluator on every case.aggregate_from_comparisons: on raws withprediction_rawstripped, as the evaluator stores them: no warnings, correctdocument_count,field_metricskeyed by theexplain()paths, totals equal to the per-document counts, identical after a JSON round trip.Files
tests/integrations/:test_strands_evals_contract.py: the surface above, over a 42-case corpus (5 models: flat, nested, optional nested, lists of strings and of models, aliases). 605 tests, no extra dependency.test_strands_evals_snapshot.py+strands_evals_snapshot.json: a golden snapshot of what the evaluator receives for 40 typical cases. Any change to it changes what Strands Evals users see, so it needs a CHANGELOG entry and a check against strands-agents-evals. Regenerate withSTICKLER_UPDATE_STRANDS_SNAPSHOT=1.test_strands_evals_e2e.py: the real evaluator, offline (a plain task function, no agent or model), throughExperiment(..., report_cls=StructuredOutputReport). Skipped whenstrands_evalsis absent. It also asserts thatsticklerimports from this checkout, not a PyPI copy.README.md: the contract and the snapshot rule.CI
A
strands-evalsjob inrun_pytest.yaml(Python 3.10 and 3.14) runsuv sync --frozen, installsstrands-agents-evals==1.6.0without the[stickler]extra (so it cannot replace this checkout with a PyPI stickler), thenpytest tests/integrations. The package is exempt from the 7-day cooldown up to a cutoff just after the 1.6.0 upload; its dependencies are not.uv.lockandpyproject.tomlare unchanged. The contract and snapshot tests also run in the existingtestjob.Verified
report.to_file(), which fails on adatetime.datevalue on the evals side.fd, renamingconfusion_matrix, movingfncounts intofd) failed 24 to 218 tests each.src/(fix(306): accept default_factory on ComparableField #360, fix: report refused list elements with field comparison rules #364, fix(auto): dump by field name; leave excluded fields out of evaluation #380, fix(336): warn about the nested-field pairs the matcher kept, not every cell #382, fix: restore stdout when print_confusion_matrix output_file write fails #394, fix(292): format the budget key as a number in Bulk_Confidence_AUROC #396, fix!: treat a None list element as absent (#386, #322) #399, fix(298): stop reporting success when results carry no non-match records #404 to fix(importers): resolve an unstated threshold and clip as the Python path does (#334, #348) #408), merged on top of this branch, passes both suites. Nine of them merged together pass too.Found in 1.6.0, for the evals side
overallcounts, so a missing item inside a nested list does not lower recall.report.to_file()fails ondatetime.datevalues.