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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AgYRU3zDTqNGV5Jk8aiKLg
This commit is contained in:
parent
a58c2a19e6
commit
643741fad5
1 changed files with 4 additions and 2 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue