Skip to content

repo-universe(check_issues): valid-JSON wrong-shape fetch/state entries crash the whole checker instead of a per-repo ERROR — poison state re-crashes daily #6652

Closed

Description

@dezren39

repo-universe(check_issues): valid-JSON wrong-shape fetch/state entries crash the whole checker instead of a per-repo ERROR — poison state re-crashes daily

Problem

scripts/fleet/repo-universe/check_issues.py promises in its header that a failed fetch is "an explicit ERROR line in the report (and a non-zero exit); the repo's persisted state is left untouched, so a failure never masquerades as an empty repository." That contract only holds for failures raised as FetchError. Every valid-JSON-but-wrong-shape input escapes as an unhandled TypeError / AttributeError, kills the whole run before any report or state file is written, and — for persisted state — re-crashes every daily timer run until a human repairs state.json by hand.

Sites (all on current main fff580fb1e, origin/main):

  • check_issues.py:109-113 — normalize_issue: "pull_request" in raw then raw.get(field). A non-object item (123, "x") raises TypeError / AttributeError, not FetchError.
  • check_issues.py:150-161 — fetch_issues_fixture: only a dict entry containing "error" becomes a FetchError. A dict entry without "error" (e.g. one issue object instead of a list) is iterated by key; an int entry is not iterable; a list of non-objects reaches normalize_issue and crashes the same way. load_fixture (:146-147) likewise returns any JSON shape, so a top-level list fixture crashes at fixture.get (:151).
  • check_issues.py:116-147 — fetch_issues_gh has the same hole on the live path: a parsed JSON page that is not a list of objects (a string, a list containing a scalar) is iterated into normalize_issue and raises outside the FetchError wrapping that covers the subprocess and the JSON parse.
  • check_issues.py:261-262 + :202-203 + :216-217 — persisted state: main loads state.json with bare json.loads; run_check does state.get("repos", {}), dict(prior_repos) and prior_repos.get(repo); a top-level list, a list-valued repos, or an int per-repo entry raises before any repo is checked. diff_repo (:179-188) then subscripts persisted issue entries (old["state"] etc.), so an int entry for one issue number crashes that repo's diff.
  • check_issues.py:207-215 — run_check catches only FetchError around fetch(repo); the shape crashes above are raised inside the fetch callables and inside diff_repo, outside that handler, so one bad repo / one bad state entry takes down every other watched repo's delta for the run.

Evidence (verified this run, laptop @ fff580fb1e == origin/main)

Probe ~/git/fleet/probe-check-issues/probe.py on the laptop, importing the real check_issues module from origin/main:

  • Control — run_check with a valid in-memory fetch: Ok (had_error=False); control baseline-then-diff with a well-formed persisted entry: Ok.
  • Fixture entry {"number": 1} (object, no error) → AttributeError: 'str' object has no attribute 'get'; entry 123 → TypeError: 'int' object is not iterable; entry [123] → TypeError: argument of type 'int' is not a container or iterable; entry ["x"] → AttributeError: 'str' object has no attribute 'get'; top-level fixture [1, 2] → AttributeError: 'list' object has no attribute 'get'.
  • Persisted state as a top-level list → AttributeError: 'list' object has no attribute 'get'; {"repos": []} → same; {"repos": {"a/b": 123}} → TypeError: 'int' object is not subscriptable; {"repos": {"a/b": {"issues": {"1": 123}}}} with a current issue test #1 → TypeError: 'int' object is not subscriptable.

No report file and no state file are written on any of these paths (main writes both only after run_check returns, :271-280).

Why it matters

This checker is the daily, scheduled correctness floor for the repo-universe tracker (#1651): it is the thing that notices new/closed issues across every watched repo. Its one job on bad data is to say so per-repo and keep going. Instead, one malformed fixture/API item — or one wrong-shape entry in its own persisted state.json (a partial hand edit, a future schema change, a torn-but-parseable write) — silences the whole checker with a traceback in a timer log, and the state poison is self-perpetuating because the crashing run never rewrites the file.

Acceptance criteria

  • Non-object fetch items (from the fixture path and the gh api path alike) and non-list per-repo fixture entries are reported as that repo's FetchError — an ERROR line in the report, a non-zero exit, other repos still checked, and that repo's persisted state untouched.
  • A wrong-shape persisted state.json (non-object top level, non-object repos, non-object per-repo entry, non-object persisted issue entry) is handled under the same rule: named as an error and either skipped per-repo or failed as a single named load error — never an unhandled TypeError / AttributeError traceback that aborts the run for every repo.
  • Valid behaviour is unchanged: baselining, new/closed/reopened/changed deltas, failed-fetch state preservation, and report/state writing all work exactly as before on well-formed inputs (in-tree test_check_issues.py still passes).
  • Regression tests in test_check_issues.py cover at least: fixture entry as an object without error, fixture entry [123], state as a top-level list, per-repo state entry as an int, and a persisted issue entry as an int — each fails on current code with the exceptions above and passes after the fix.

Dedup: distinct from #6612 (generate.py offline --forks-org-json omission — the generator, not the checker), #5945/#1651 (the checker existing / being wired at all), and the github-backup shape issues #6637/#6606/#6575 (different system, different files). Title/keyword searches for check_issues + shape/state return no covering issue.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    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/normalOrdinary priority (the default)
    app/repo-universescripts/fleet/repo-universe generator + issue checker
    on Nov 7, 2026
  4. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-b
    • Session / ID: new-issue-creator-code-b cron run, Fri 2026-11-06 18:50 CST
    • Found via: filed this run
    • Task: Filed this verified check_issues shape-poison finding for triage — wrong-shape fetch/state entries crash the whole repo-universe checker instead of a per-repo ERROR.
    • Expectation: effort s; done = shape validation per the acceptance criteria, with regression tests in test_check_issues.py.
    • Links: probe ~/git/fleet/probe-check-issues/probe.py (laptop, origin/main fff580f)
  5. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-y (Lane Y queue worker shift, FALLBACK MODE — queue backend down: fleet queue health returns HTTP 503 PGRST002; fallback protocol in doc/fleet/queue-fallback-mode.md followed manually via the gh CLI).

    🤖 Agent note · picked up

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

  8. added and removed
    status/triagedTriaged and routed (see agent note)
    on Nov 7, 2026
  9. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-a — FALLBACK MODE (queue backend down; fallback claim marker on this issue is the claim of record)
    • Session / ID: cron repo-queue-worker-shift run 2026-11-06 19:20 CST; fallback worker id repo-worker-code-a (issue repo-universe(check_issues): valid-JSON wrong-shape fetch/state entries crash the whole checker instead of a per-repo ERROR — poison state re-crashes daily #6652 is the task in fallback mode)
    • Found via: fallback scan (queue/queued items in scan order; triage by lane code-y confirmed the bug and re-queued this issue as the fix vehicle)
    • Task: fix scripts/fleet/repo-universe/check_issues.py so valid-JSON wrong-shape fetch/state inputs become per-repo FetchError reports (or a single named load error for state) instead of unhandled TypeError/AttributeError crashes; add the five named regression tests to test_check_issues.py
    • Expectation: s — done = PR with fix + tests, scripts tests green, merged under standing criteria
    • Links: branch queue/6652-check-issues-shape (laptop worktree ~/git/fleet/fb-6652), to be created this shift
  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-a: fix in progress in ~/git/fleet/fb-6652 (branch queue/6652-check-issues-shape): normalize_issue/fixture/gh shape guards raising FetchError, run_check state-shape validation (per-repo ERROR for malformed prior entries, named load error for top-level state shape), main maps FetchError to a named exit-2; regression tests for all five named shapes + main-level state file case.

  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-a: targeted_tests_passed: python3 test_check_issues.py — 15 tests OK (8 pre-existing + 7 new WrongShapeTests) on the laptop. Committed + pushed; opening PR.

  12. added a commit that references this issue on Nov 7, 2026
  13. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  14. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-a (outcome: done). Done: check_issues wrong-shape fetch/state JSON now becomes per-repo FetchError ERRORs / a named load error (exit 2). PR #6705 merged (c05ada5), closing #6652. Laptop: test_check_issues.py 15 tests OK (7 new); Codex zero findings; scripts-test CI QUEUED (runner backlog).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/repo-universescripts/fleet/repo-universe generator + issue checkerkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions