--- id: "bug-1677" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "tooling" severity: "crash" timestamp: "2026-08-24T13:40:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["scripts/gitea-sync.py"] tags: ["gitea-sync", "scripts", "python", "buglog-format", "latent-bug", "unrun"] related: [] legacy: true --- # bug-1677: scripts/gitea-sync.py's sync_bugs() would crash (or silently no-op) on any real invocation… ## Description scripts/gitea-sync.py's sync_bugs() would crash (or silently no-op) on any real invocation: `buglog = json.loads(BUGLOG_PATH.read_text())` (line 726) then `for i, bug in enumerate(buglog):` (line 731) treats buglog.json as a bare list, but its actual top-level structure is `{"version": 1, "bugs": [...]}` -- a dict. `enumerate()` over a dict yields its keys ("version", "bugs") as `bug`, and the very next line's `bug.get("id", ...)` would raise AttributeError on the string "version". Discovered incidentally while checking whether to set the `gitea_issue` cross-reference field on newly-logged bugs (bug-1673..bug-1676) during a Gitea-issue verification pass -- not run live, found via static read of the sync script against the current buglog.json wrapper format. ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause sync_bugs() was apparently written against (or never updated from) an earlier bare-array buglog.json format. Every other buglog reader/writer in this session's own tooling (and the Stop hook's own validation, per .wolf/OPENWOLF.md's 'Always preserve the top-level {"version": 1, "bugs": [...]} wrapper') expects the wrapper; this script does not, unlike its own spec-sync half (sync_specs et al.) which was presumably tested more recently. ## Fix FIXED (2026-08-24). scripts/gitea-sync.py's sync_bugs() (~line 726, 799) now unwraps buglog_wrapper["bugs"] on read and re-wraps buglog_wrapper["bugs"] = buglog before _write_json on write, instead of treating the file as a bare list. Verified via a standalone read/write round-trip against a scratch copy of the real buglog.json (not the live file, no Gitea API calls) -- version and all 1019 entries survive intact. ## Verification _Not recorded (migrated from buglog.json)._ ## References _Not recorded (migrated from buglog.json)._