Repository navigation
Description
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 bareTypeError/KeyErrortraceback. -
buildis equally safe when reached with entries that did not pass throughmerge_repos(it re-indexesrepo["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.pycover: non-dict entry in a page array, dict page withoutfull_name, andnullentry.
Activity
developing-today commentedon Nov 7, 2026
CODE-2079
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 7, 2026
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.
dezren39 commentedon Nov 7, 2026
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.
dezren39 commentedon Nov 7, 2026
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.
Merge pull request #6723 from developing-today/queue/fallback-6716-wr…
dezren39 commentedon Nov 7, 2026
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.