Skip to content

test(release): cover first-time release creation and retries - #7152

Merged
kovtcharov-amd merged 2 commits into
amd:mainfrom
Drchennnn:fix/6998-release-creation-tests-20261111
Nov 11, 2026
Merged

kovtcharov-amd merged 2 commits into
amd:mainfrom
Drchennnn:fix/6998-release-creation-tests-20261111

Conversation

@Drchennnn

Copy link
Copy Markdown
Contributor

Summary

Exercise first-time release creation and its retry paths so regressions that duplicate or prevent publication are caught by tests.

Why

Existing publication tests start with a release that already exists. The missing-release lookup, draft creation loop and recovery after an accepted but rate-limited creation therefore lacked coverage.

Linked issue

Closes #6998

Changes

  • Cover missing-release lookup, fatal lookup errors, ordinary and prerelease creation, repeated rate limits, already-accepted drafts and creation races.
  • Assert fatal creation failures and bounded deadlines stop the operation before uploading or publishing.
  • Script the external gh boundary and clock while exercising the helper's real orchestration.

Test plan

  • On macOS arm64, Python 3.12.14, run the following command. All 146 tests passed, including all 26 tests in the directly affected module.
python -m pytest \
  tests/unit/test_github_release_retry.py \
  tests/unit/test_publish_release_assets.py \
  tests/unit/test_release_tag.py \
  tests/unit/test_release_train_dryrun_workflow.py \
  -q --cov=github_release_retry --cov-branch --cov-report=term-missing
  • Changed-file Black, isort 8.0.1 using project settings, Flake8 using project ignores, the added-lines guard and git diff --check origin/main...HEAD passed.
  • Aggregate python util/lint.py --all exited 1 with 16 checks passed, one failed check and one advisory MyPy warning category. Pylint reports E1120 at awake_clock.py:47 and terminal.py:109. Both files match main. Running Pylint on those files in a separate clean checkout of main 0a2afdc3 reproduced both findings.
  • The full unit suite was not run locally. The focused coverage report for the release helper is 72%, leaving other pre-existing paths uncovered.

Evidence

The added tests use synthetic assets, scripted gh responses and a simulated clock. No live GitHub release creation or publication was exercised.

  • Agent UI — N/A, test-only change.
  • MCP tools / servers — N/A, test-only change.
  • CLI — N/A, no command behavior changed.
  • HTTP API / REST — N/A, no API behavior changed.

Checklist

  • I have linked a GitHub issue above.
  • I have described why this change is being made.
  • I have run linting and tests locally (python util/lint.py --all, pytest tests/unit/). Focused tests and changed-file lint passed, aggregate lint and full-suite limits are detailed above.
  • I have marked each real-world evidence surface N/A with a reason.
  • Documentation was considered. This change adds tests to the existing release helper.

Verify that missing releases are distinguished from rate limits and fatal lookup errors. Refs amd#6998.
Protect first-time release publication against duplicate drafts, retry regressions and fatal errors. Script the gh boundary and clock so no release is created by these tests. Fixes amd#6998.
@github-actions github-actions Bot added the tests Test changes label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve

This PR adds tests for the case where the release script has to create a release that doesn't exist yet: the lookup, the draft creation, and the retries when GitHub rate-limits. Before, every test started from a release that already existed. The tests fake only the gh command and the clock, so the script's real retry logic is what runs. Each one also checks that the script made exactly the expected calls in the expected order. That means a regression that creates a duplicate draft, or uploads after a fatal error, would fail a test. I found no blocking issues.

Real-world evidence

N/A: this PR only changes tests (no evidence bundle was produced), so the verdict rests on reading the code. I ran the changed test file locally and all 26 tests passed (with --noconftest, because the runner lacks GAIA's runtime dependencies).

🔍 Technical details

Issues found: none blocking.

🟢 Fragile clock stub (tests/unit/test_github_release_retry.py, test_publish_creation_fails_if_the_call_exhausts_the_deadline). iter([100.0, 100.0, 160.0]) hard-codes how many times publish_release calls time.monotonic() before the create fails. If one more call is added (for example a log line with a timestamp), the test fails with StopIteration instead of a readable assertion. A stub that returns 100.0 until create runs, then 160.0, would tie the test to the behaviour instead of the call count. Optional.

Checked against util/github_release_retry.py:

  • The deadline test (max_wait_seconds=20, sleeps [15, 5]) matches _retry_delay: the second sleep is capped by the remaining budget, and the loop then exits through the time.monotonic() >= deadline guard.
  • The "already exists" race, the accepted-but-rate-limited draft, and both fatal-error paths (403, DNS) follow the real branches at lines 204–233.
  • The finally in the fixture checks that no scripted calls are left over and that the sleeps match. Because it also runs on the error paths, the fatal-error tests prove nothing was uploaded or published afterwards.

Strengths

  • Each scripted step names the exact gh command it expects, so the tests check what is sent to gh, not just that it was called.
  • raised.value is error and __cause__ is limited check that the original exception comes through unchanged, not wrapped or swapped for another one.
  • The prerelease and normal modes are both covered, using the flags publish_release actually sends.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 11, 2026
Merged via the queue into amd:main with commit 6003907 Nov 11, 2026
26 checks passed
@kovtcharov-amd kovtcharov-amd mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release publishing is never tested on creating a release that doesn't exist yet

2 participants