Skip to content

repo-universe(generate): wrong-shape enumeration entries crash the whole generator — a non-object entry or a dict without full_name aborts regeneration with a bare TypeError/KeyError #6716

Closed

Description

@dezren39

Problem

scripts/fleet/repo-universe/generate.py (repo-universe piece 1, #1650) has no wrong-shape guard on the enumeration captures it decodes — the exact defect family that #6652 fixed in its sibling check_issues.py, where the contract is: valid JSON with the wrong shape must surface as a named, per-item error, never as a bare TypeError/KeyError that aborts the whole run.

decode_pages (generate.py:79-100) flattens every decoded document into a list of entries without checking their shape, and both consumers index the entries blindly:

  • merge_repos (generate.py:117): merged.setdefault(repo["full_name"], repo)
  • build (generate.py:236): gh[repo["full_name"]] = repo

So one bad entry in any of the three captures (org, forks-org, user) kills the entire regeneration with a traceback and no artifact: a non-object entry in a page array (string, number, null), an object page that is not a repo (e.g. an API error object {"message": "API rate limit exceeded"} saved into a capture), or a repo object missing full_name.

Evidence (verified this run, laptop main e632ea0)

Probe ~/git/fleet/probe-repo-universe-gen/probe.py (on the laptop) imports the real generate.py and feeds decode_pages → merge_repos → build:

Input Result
[{"full_name": "a/b", "fork": false}, "oops"] CRASH TypeError: string indices must be integers
[{"full_name": "a/b", ...}] {"message": "API rate limit exceeded"} CRASH KeyError: 'full_name'
[{"name": "b", "fork": false}] CRASH KeyError: 'full_name'
[{"full_name": "a/b", ...}, null] CRASH TypeError: 'NoneType' object is not subscriptable
well-formed control OK, artifact lists a/b

test_generate.py has no wrong-shape case for enumeration entries (its only "wrong" test is the live-mode account guard).

Why it matters

The generator is the piece that produces doc/fleet/repo-universe.yaml, the inventory the issue checker (#1651) and tracker (#1511) consume. The offline path exists so a regeneration can be run from captures; a single malformed capture entry — a hand-saved gh error page, a truncated-then-repaired capture, a schema drift in one repo object — currently aborts the whole run opaquely, with no indication of which capture or entry is at fault. #6612 already established the house rule for this tool: a missing/emptied source must fail loudly and by name, never silently or opaquely. The checker side of the same tool got the per-item shape guard in #6652; the generator side was left out.

Acceptance criteria

  • A non-object entry, or an object entry without a string full_name, in any enumeration capture makes the run fail with a clear error naming the capture source and the offending entry (index or repr) — no bare TypeError/KeyError traceback.
  • build is equally safe when reached with entries that did not pass through merge_repos (it re-indexes repo["full_name"] at generate.py:236).
  • Well-formed captures (single page, multi-page concatenated, org+forks+user merge) regenerate byte-identically to today (idempotence preserved).
  • New cases in test_generate.py cover: non-dict entry in a page array, dict page without full_name, and null entry.

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/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 job (lane A, new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run, 2026-11-06 21:05 CST
    • Found via: filed this run
    • Task: Small fix: give repo-universe generate.py the wrong-shape guard its sibling check_issues.py got in 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 — a non-object entry or an object without a string full_name in any enumeration capture must fail with a named error (capture + entry), not a bare TypeError/KeyError that aborts regeneration.
    • Expectation: effort/xs — done when the four probe shapes fail with a clear named error, well-formed captures regenerate byte-identically, and test_generate.py covers the wrong-shape cases.
    • Links: probe ~/git/fleet/probe-repo-universe-gen (laptop, real generate.py @e632ea0967)
  5. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-g (Lane G queue worker, FALLBACK MODE — queue backend down, PostgREST 503 PGRST002; fleet 0.1.0 binary lacks the fallback verb, so markers are posted via gh exactly per doc/fleet/queue-fallback-mode.md). Working this small-fix now: wrong-shape enumeration entries crash generate.py — guard per #6652 pattern, tests in test_generate.py.

  6. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 7, 2026
  7. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Heartbeat · stage: verified — defect confirmed by code read (generate.py decode_pages flattens unvalidated entries; merge_repos:117 and build:236 index repo["full_name"] blindly; sibling guard pattern at check_issues.py normalize_issue, #6652). Worktree ~/git/fleet/6716-wrong-shape on branch queue/fallback-6716-wrong-shape-entries. Next: add entry validation naming capture source + entry, defensive validation in merge_repos/build, tests in test_generate.py.

  8. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Heartbeat · stage: pr_opened — PR #6723 (branch queue/fallback-6716-wrong-shape-entries, commit 835048e). Tests: python3 -m unittest test_generate test_check_issues → 30 OK on laptop; CLI repro gives a clean named error, no artifact. Next: merge check (Codex findings, mergeability), then release.

  9. added a commit that references this issue on Nov 7, 2026
  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released · done — PR #6723 merged (merge sha 6acb50a, branch queue/fallback-6716-wrong-shape-entries, commit 835048e). generate.py now validates enumeration entries (validate_entry in decode_pages with capture-source naming; defensive validation in merge_repos and build; CLI converts ValueError to a clean error: exit). Acceptance: wrong-shape entries fail named with no traceback and no artifact; well-formed regeneration byte-identical (idempotence test). Tests: python3 -m unittest test_generate test_check_issues → 30 OK (laptop); CI scripts-test 3.12 + 3.14 SUCCESS on PR #6723; Codex review completed, no findings. This issue closed automatically via Fixes #6716 on merge.

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