From 643741fad5658b08225014e85e589915f735f463 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Mon, 24 Aug 2026 14:23:31 +0000 Subject: [PATCH] fix(gitea-sync): unwrap buglog.json's {version,bugs} wrapper before iterating (bug-1677) sync_bugs() read buglog.json as a bare list and wrote it back the same way, but the real format is {"version": 1, "bugs": [...]}. Any real run would have crashed on the first bug entry (enumerate() over a dict yields its keys, not bug objects) and, had it somehow gotten past that, a write-back would have destroyed the wrapper. Never actually run against production Gitea, per the buglog entry. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01AgYRU3zDTqNGV5Jk8aiKLg --- scripts/gitea-sync.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/gitea-sync.py b/scripts/gitea-sync.py index e4b13d26..afefd9ff 100755 --- a/scripts/gitea-sync.py +++ b/scripts/gitea-sync.py @@ -723,7 +723,8 @@ def sync_bugs(api, dry_run=False, quiet=False, since=None): warn(f"buglog not found: {BUGLOG_PATH}") return - buglog = json.loads(BUGLOG_PATH.read_text()) + buglog_wrapper = json.loads(BUGLOG_PATH.read_text()) + buglog = buglog_wrapper["bugs"] created = 0 closed = 0 skipped = 0 @@ -796,7 +797,8 @@ def sync_bugs(api, dry_run=False, quiet=False, since=None): # Write back updated buglog if any new issues were created if created > 0 and not dry_run: - _write_json(BUGLOG_PATH, buglog) + buglog_wrapper["bugs"] = buglog + _write_json(BUGLOG_PATH, buglog_wrapper) if not quiet: print(f"Bugs: {created} created, {closed} closed, {skipped} skipped")