Skip to content

test: the release scripts' stand-in gh is safe when two calls run at once (flaky JSONDecodeError) - #2130

Merged
NotRexed merged 1 commit into
mainfrom
test/fake-gh-atomic
Nov 11, 2026
Merged

NotRexed merged 1 commit into
mainfrom
test/fake-gh-atomic

Conversation

@NotRexed

Copy link
Copy Markdown
Owner

tests/test_release_scripts.py fails now and then on Linux, as it did on main at 364d199 and on #2127. The failing test is test_tag_pushed_by_hand_gets_its_release_and_sums; the stand-in gh hits json.decoder.JSONDecodeError: Expecting value: line 1 column 1 when it reads its state file.

The cause: scripts/release_files.sh check runs two gh calls at the same time (cmp -s <(sums "$id") <(uploaded "$id")). Every stand-in call appends itself to calls and rewrites the state file with open(STATE, "w"). So one call can read the file while the other has just truncated it.

The stand-in now:

  • holds an exclusive fcntl lock for the whole call, so calls take turns and no entry in calls is lost;
  • writes its state to a temporary file and moves it into place with os.replace.

The test is the only thing changed; the release scripts stay as they are. It needs jq and only runs on Linux, so this was not run locally; CI checks it.

🤖 Generated with Claude Code

…aves its state whole

release_files.sh check runs two gh calls at once (cmp <(sums) <(uploaded)). Every stand-in call appends to the state's call list and rewrites the file, so one call could read it while the other had it truncated: JSONDecodeError at line 1, and test_tag_pushed_by_hand_gets_its_release_and_sums failing now and then (main at 364d199, #2127). The stand-in now holds a lock for its whole run and writes the state through a temporary file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NotRexed
NotRexed merged commit e0578ed into main Nov 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant