Repository navigation
Description
mcpx(ci): e2e-shard-packer crashes with raw tracebacks on a wrong-shape timings seed — non-object tests field and non-finite weights are unguarded
Summary
pkgs/mcpx/scripts/ci/e2e-shard-packer.py (the #1994 measured-time shard packer that produces the mcpx-test e2e matrix) carefully guards its discovery side — the coverage assertion fails with a named coverage defect: ... message rather than emitting a bad matrix — but its timings seed side (load_weights) trusts the shape of e2e-timings.json:
- If the seed's
testsfield is present but not an object (a list, a string — a hand edit, or a future seed generator emitting pairs),load_weightsraises a rawAttributeErrorfromraw.items(). - A weight of
Infinity(which Python'sjson.loadaccepts by default in a seed file) passes theseconds > 0check, poisons the total, andpackraises a rawOverflowError: cannot convert float infinity to integer. (NaNis filtered only by accident, becauseNaN > 0is false.) - A
trueweight is accepted as 1.0s, becauseboolis anintsubclass and theisinstance(seconds, (int, float))check does not exclude it — the same bool-as-number class the fleet's other validators (github-backup(fetch): a valid-JSON but wrong-shape plan/state entry crashes the whole daily fetch — one poison entry in plan.json or state.json wedges every repo, every day #6637'sdrain_lastcheck) explicitly exclude.
In every case the mcpx-test init job dies with an interpreter traceback instead of either the script's equal-weights fallback or a named error saying the seed is malformed and which entry is wrong — so a malformed seed regeneration blocks the whole e2e workflow with a message that points at the packer's internals, not at the seed.
Evidence (verified this run, laptop, origin/main c110f92)
Probe: real e2e-shard-packer.py extracted verbatim from origin/main, driven through its own load_weights/pack (~/git/fleet/probe-shard-packer):
- Control
{"tests": {"TestA": 10, "TestB": 20, "TestC": 30}}→ weights as measured,pack→ 1 shard, OK. {"tests": [["TestA", 10]]}→AttributeError: 'list' object has no attribute 'items'atload_weights(raw = doc.get("tests", doc)thenraw.items()).{"tests": "TestA=10"}→ sameAttributeError('str').{"tests": {"TestA": Infinity, "TestB": 20, "TestC": 30}}→ accepted as a measured weight (inf), thenpackraisesOverflowErroratmath.ceil(total / target_seconds).{"tests": {"TestA": true, ...}}→ weight silently becomes 1.0s.- (For reference: a wholly non-object seed, e.g. a top-level list, already falls back to equal weights, because
rawbecomes{}— only thetests-field shape and the weight values are unguarded.)
Why it matters
The seed is a committed file that timing tooling regenerates; the failure mode for a bad regeneration should be the packer's own contract style — fall back to equal weights with the note printed, or fail with a named error identifying the seed problem — never a raw traceback that fails the init job and every e2e leg behind it. This is the same wrong-shape-inside-a-valid-container class fixed for repo-universe (#6716/#6814) and github-backup (#6637/#6821).
Acceptance criteria
-
load_weightstreats a non-objecttestsfield as a malformed seed: named error (or equal-weights fallback with the reason in the weight note), never anAttributeErrortraceback. - Weights must be finite positive numbers and not bools:
Infinity,-Infinity,NaN, andtrue/falsevalues are rejected per-entry (skipped with the entry named, or the seed refused by name), and cannot poison the median or the shard-count arithmetic. - Well-formed seeds behave byte-identically to today (same matrix output for the committed
e2e-timings.jsonand for the no-seed fallback). - Tests for the packer cover: list
tests, stringtests, infinite weight, bool weight, and the well-formed control; the mcpx-test workflow's init step still emits its matrix for the committed seed.
Dedup
Searches (all states) for "shard-packer" and "e2e-timings": #1994 (closed, built the packer), #1992/#1985/#1901 (open, other mcpx testing topics). None covers the seed-shape guards. Filed by new-issue-creator-code-b, 2026-11-06 run.
Activity
developing-today commentedon Nov 7, 2026
CODE-2095
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
testsfield raises a raw AttributeError, an Infinity weight passesseconds > 0and crashes pack with OverflowError, and a bool weight is silently read as 1.0s. Verified with the real script verbatim from origin/main c110f92 on the laptop (probe ~/git/fleet/probe-shard-packer).developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
111 remaining items
dezren39 commentedon Nov 8, 2026
🤖 Agent note · handed off (repeat handoff)
opencodeagain.developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
opencode— handed off to the opencode claimant; this lane does not work it directly.developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
developing-today commentedon Nov 9, 2026
🤖 Agent note · handed off
developing-today commentedon Nov 9, 2026
🤖 Agent note · handed off
opencodedeveloping-today commentedon Nov 9, 2026
🤖 Agent note · handed off
opencodedeveloping-today commentedon Nov 9, 2026
🤖 Agent note · correction — claim displaced
opencode(row 3375) before the displacement was detected.dezren39 commentedon Nov 9, 2026
🤖 Agent note · handed off
opencodedezren39 commentedon Nov 14, 2026
agent-note:v1
state: done
task: 17270
lane: code-d
worker: repo-worker-code
What: Fixed by PR #7897, MERGED as ff81370. All three defects from this issue are guarded in load_weights on main: (1) a non-object
testsfield falls back to equal weights with a named "timing seed defect: 'tests' is , expected object; ignoring seed" note instead of AttributeError; (2) non-finite weights (Infinity / -Infinity / NaN) are rejected by the finite check in _weight_seconds instead of poisoning pack() with OverflowError; (3) boolean weights are rejected before the numeric check (bool is an int subclass) instead of becoming 1.0s. Regression coverage: WeightLoadingTest in pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py (combined with the #6906 discovery suite during the merge resolution); verified on the merged tree — packer tests 15/15 OK, full pkgs/mcpx/scripts/tests discover 29/29 OK.Next: none — closing as completed.