release-health re-folds and retries instead of losing a report - #43
Merged
Merged
Conversation
One release reports several distributions -- audiocomponents publishes two from one tag, audioif three -- and each dispatches its own release-health event. A repository_dispatch freezes github.sha at creation time, so the second run checks out a tip that predates the first run's commit and its push is rejected. The concurrency group serializes the jobs but cannot fix the checkout. That is how pydevices-audioeffects' row sat stale at 0.1.1 while pydevices-audioinstruments right above it read 0.2.0. The sibling fix in reusable-synchronize-mip-package rebases and retries, but a rebase is wrong here: RELEASE_HEALTH.md is regenerated whole and data.json is one sorted object, so replaying our diff onto the new tip conflicts or drops the other distribution's row. Instead the fold moves into a file and the step loops: on a rejection, discard the commit, take the branch tip, and fold the payload in again. The fold is idempotent, so the result carries both rows. The commit message also takes the payload through env rather than interpolating it into the shell. tests/test_release_health.py lifts the step out of the YAML and runs it against real repositories, staging the race with two clones of one tip. Closes #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #34.
One release reports several distributions —
audiocomponentspublishes twofrom one tag,
audioifthree — and each dispatches its ownrelease-healthevent. A
repository_dispatchfreezesgithub.shaat creation time, so thesecond run checks out a tip that predates the first run's commit and its push
is rejected. The
release-healthconcurrency group serializes the jobs; itcannot fix the checkout.
A rebase-and-retry, as suggested on the issue, is not the right shape here.
reusable-synchronize-mip-package.ymlcan rebase because it edits a lockfileentry. This step regenerates
RELEASE_HEALTH.mdwhole and rewritesrelease-health/data.jsonas one sorted object, so replaying our diff onto thenew tip either conflicts or drops the other distribution's row.
So the step re-folds instead: the Python moves into
$RUNNER_TEMP/fold.pyso itcan be run again, and on a rejection the loop discards the commit, takes the
branch tip, and folds the same payload in a second time. The fold is idempotent
— it sets one key by distribution name — so the result carries both rows.
Three attempts, then a hard error rather than a silent stale row.
While in there, the commit message takes
distributionandversionthroughenv:rather than interpolating the dispatch payload straight into the shell.How it was proved
tests/test_release_health.pylifts the step'srun:body out of the YAML andruns it against real git repositories, staging the race as two clones of one
tip pushing to a bare origin.
The race test asserts the retry path is actually taken (
push rejected (attempt 1)in the output), that both keys are in the publisheddata.json, and that both rows are on the page. Two more cover anuncontended report and a re-report of the same distribution.
The same race run against the pre-fix step, so the test is not passing
vacuously:
audioeffectsis simply missing — the bug as filed.actionlintclean,ruff check scripts/ tests/clean.Note the stale row the issue describes has since been overwritten by later
releases;
RELEASE_HEALTH.mdonmainis current. This stops it recurring.