Repository navigation
fix(tier3): keep malformed optional usage metadata unavailable - #725
Conversation
Signed-off-by: Afloat <ShuffleMonkey@163.com>
chrisknvidia
left a comment
There was a problem hiding this comment.
Thanks, this is a real one. On main a null, list, string or number in final_metrics raises AttributeError, which is not in the except tuple, so one bad trajectory file takes down the whole collection step. The guard keeps all four usage fields None for the condition, which matches what the reports document (unavailable, never zero). I checked that the new tests fail without the source change and pass with it. Looks good to me.
Signed-off-by: Afloat <ShuffleMonkey@163.com>
Signed-off-by: Afloat <ShuffleMonkey@163.com>
rng1995
left a comment
There was a problem hiding this comment.
Thanks, @Afloat16, for guarding malformed optional final_metrics. The condition stays unavailable when a trajectory's metrics are not an object, instead of aborting completed-result collection or reporting partial usage as complete. I found no new actionable issues on this head.
Validation: all 10 new usage-shape cases and all 34 existing baseline-store tests passed.
rng1995
left a comment
There was a problem hiding this comment.
Thanks @Afloat16 for this contribution! I reviewed 92a8d54cff. I reproduced the problem on main, confirmed this change fixes it, checked that the new tests fail on main, and ran the new and related tests on this head (all pass). I left 2 inline comments (2 P3); please take a look.
Signed-off-by: Afloat <ShuffleMonkey@163.com>
Summary
measured_condition_usage()reads optional trajectoryfinal_metricswithout checking its container type. A JSONnull, array, boolean, number or string raises an uncaughtAttributeError, which can interrupt the collector while it is assembling otherwise completed Tier 3 results.Treat a non-object metrics container as unavailable usage. Mark the condition incomplete for usage totals so a valid sibling trial cannot disguise the missing measurement. Existing metric validation, duplicate-trial handling and scores remain unchanged.
Verification
All ten new cases fail against the original implementation. They cover five malformed JSON value types both alone and alongside a measured trial, and require all condition totals to remain unavailable rather than partial.
python -m pytest tests/tier3/test_usage_metric_shapes.py tests/test_baseline_store.py tests/test_harbor_collector_multistep_trajectory.py -q— 118 passed, 2 failed.The two failures are
tests/test_baseline_store.py::test_runner_fresh_reused_and_incompatible[default]and[custom_only]. Both reproduce on unchanged base8fe9723: the environment places the test's isolated output-provenance key inside a tree selected for evaluation, so the existing location guard refuses the run before collection. No successful full-module run is claimed.make lintequivalent:python -m ruff check src testsmake testdid not complete successfully in this environment (see below)make buildequivalent:python -m build(wheel and sdist)The unchanged base
8fe9723, tested withpython -m pytest -x -q, stops after 456 passed and 19 deselected attests/ci/test_gateway_benchmark_workflows.py::test_gitlab_enriched_tier1_applies_the_keyless_job_baselines[extra0-expected0]. The sandbox has no/tmp, while that workflow fixture explicitly invokesmktemp -d /tmp/skillevaluator-enriched-tier1.XXXXXX. The same test fails for the same reason on the retry branch. No full-suite pass is claimed.Release Impact
CHANGELOG.md