Fix reusable artifact validation for nested metadata / 修复嵌套元数据的可复用产物校验#2221
Conversation
中文:规范化可复用产物标识,支持嵌套 KV 卸载后端元数据。
|
Claude finished @cquil11's task in 1m 50s —— View job Review of PR #2221
LGTM - no blocking issues found The Note: I could not run pytest in this environment (command approval denied), but the PR's CI and the author-reported 26/26 + 140/140 passing runs cover that. |
There was a problem hiding this comment.
LGTM — a minimal, well-tested fix for the unhashable-dict crash in artifact identity building.
Extended reasoning...
Overview
The PR adds a single helper, freeze_identity_value, to utils/validate_reusable_sweep_artifacts.py, and applies it at the one call site (agentic_key) where a dict-valued kv_offload_backend field was being fed unmodified into a tuple that later goes through Counter/set operations, causing TypeError: unhashable type: 'dict'. The helper recursively converts dicts into a sorted tuple of (key, value) pairs (order-independent) and lists/tuples into tuples, making arbitrarily nested JSON metadata hashable and comparable. Test-only changes add two regression tests: one asserting the identity is hashable and order-independent across nested dict/list values, and one exercising the full validate_agentic_artifacts duplicate-detection path with a mapping-valued kv_offload_backend.
Security risks
None. This is internal CI validation tooling for benchmark artifact reuse; it does not process untrusted input, execute code, or touch auth/permissions.
Level of scrutiny
Low-to-moderate. This is a narrowly scoped bug fix in a non-production, CI-support utility (artifact validation for benchmark result reuse), not a critical runtime path. The change is small, self-contained, and directly matches the stated root cause (a real CI failure from run 29425167775).
Other factors
I ran the full test suite (utils/test_validate_reusable_sweep_artifacts.py) locally and confirmed all 26 tests pass, matching the PR's validation claims. I also traced kv_offload_backend back to utils/agentic/aggregation/process_agentic_result.py and utils/matrix_logic/generate_sweep_configs.py, confirming it is indeed dict-shaped (name/version/options) in the real pipeline, so the fix addresses a genuine, reachable bug rather than a hypothetical one. The recursive freeze logic is straightforward and correctly handles nesting (dicts of lists of dicts, etc.) via sorted-tuple canonicalization, with no edge cases (e.g., non-string dict keys) that would arise from real JSON metadata.
Summary
{"name": "native"}failure and deeper nested metadataRoot cause: post-merge run 29425167775 passed a dict-valued
kv_offload_backendintoCounter, which raisedTypeError: unhashable type: 'dict'while reusing PR #2158's staged artifacts.Validation
python -m pytest utils/test_validate_reusable_sweep_artifacts.py -v— 26 passedtest-changelog-gate.ymlpytest command — 140 passed中文说明
{"name": "native"}故障以及更深层的嵌套元数据添加回归测试根因:合并后运行 29425167775 在复用 PR #2158 的暂存产物时,将字典类型的
kv_offload_backend传入Counter,触发TypeError: unhashable type: 'dict'。验证
python -m pytest utils/test_validate_reusable_sweep_artifacts.py -v— 26 项通过test-changelog-gate.yml中的 pytest 命令 — 140 项通过