Skip to content

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 #6822

Closed

Description

@dezren39

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:

  1. If the seed's tests field is present but not an object (a list, a string — a hand edit, or a future seed generator emitting pairs), load_weights raises a raw AttributeError from raw.items().
  2. A weight of Infinity (which Python's json.load accepts by default in a seed file) passes the seconds > 0 check, poisons the total, and pack raises a raw OverflowError: cannot convert float infinity to integer. (NaN is filtered only by accident, because NaN > 0 is false.)
  3. A true weight is accepted as 1.0s, because bool is an int subclass and the isinstance(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's drain_last check) 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' at load_weights (raw = doc.get("tests", doc) then raw.items()).
  • {"tests": "TestA=10"} → same AttributeError ('str').
  • {"tests": {"TestA": Infinity, "TestB": 20, "TestC": 30}} → accepted as a measured weight (inf), then pack raises OverflowError at math.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 raw becomes {} — only the tests-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_weights treats a non-object tests field as a malformed seed: named error (or equal-weights fallback with the reason in the weight note), never an AttributeError traceback.
  • Weights must be finite positive numbers and not bools: Infinity, -Infinity, NaN, and true/false values 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.json and for the no-seed fallback).
  • Tests for the packer cover: list tests, string tests, 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

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    on Nov 7, 2026
  2. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor
  3. added
    priority/lowNice to have; do when convenient
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    on Nov 7, 2026
  4. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b, run 2026-11-06 23:50 CST
    • Found via: filed this run
    • Task: e2e-shard-packer.py load_weights trusts the timings seed shape: a non-object tests field raises a raw AttributeError, an Infinity weight passes seconds > 0 and 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).
    • Expectation: effort/s small-fix — validate the tests field and require finite non-bool positive weights, named error or equal-weights fallback; packer tests for the malformed shapes.
    • Links: packet creator-b-2026-11-06-2350/packet-6822-small-fix.json (goal hidden_files)
  5. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  6. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 8, 2026
  7. 111 remaining items

  8. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off (repeat handoff)

  9. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  10. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  11. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  12. developing-today commented on Nov 9, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  13. developing-today commented on Nov 9, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  14. developing-today commented on Nov 9, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  15. developing-today commented on Nov 9, 2026

    @developing-today
    Contributor

    🤖 Agent note · correction — claim displaced

  16. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  17. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    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 tests field 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)epic/mcpx-platformReprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientqueue/parkedQueue task is parked (waiting on CI, time, or an event)source/creatorFiled by the new-issue-creator jobstatus/parkedDeliberately paused with a recorded resume conditionstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions