Repository navigation
ci: run the release shell on every PR instead of on every tag - #44
Merged
Merged
Conversation
Two releases were spent finding two bugs that no linter can catch:
v0.5.0-rc.3 the builder built and checksummed the zip and never
uploaded it; the upload list did not mention it.
v0.5.0-rc.4 all four assets were built, signed, notarized, stapled
and uploaded CORRECTLY, and the release still failed, on
a debug `echo "$ENTRIES" | head -5`.
Neither bug is the point. The point is that release.yml held 522 lines
of release-critical shell that first executed during a real release,
where one iteration costs a tag, a 20-40 minute signed build, Apple's
notary queue and a human approval.
The assertions now live in scripts/release/, and selftest.sh drives
every one of them against fixtures in the ordinary PR gate: 27 checks,
seven seconds, no tag, no Mac, no credential. Reintroducing either
failed form makes it fail — `| head -5` at exit 141, `| grep -q` by
reporting a stapled app as unstapled.
What the fixture is for: the real rc.4 listing is 604 entries / 55,827
bytes, UNDER a pipe's 64K capacity. It broke the release anyway, because
the reader closing its end mid-write is a RACE — lost on the Ubuntu
runner, won on macOS, where the identical pipeline over the identical
artifact exits 0. The fixture is ~6x larger so the failure is
deterministic on any machine rather than intermittent on one.
Also fixed, found while extracting: the previous-tag lookup took the
newest tag that is not $TAG, which is a NEWER tag when an older one is
re-released. Against the real tag list, re-releasing rc.3 compared its
bundle identity against rc.5. It is now the entry after $TAG in a
newest-first listing, with tests.
The contract is now read from the TAG (`git show`) while the scripts
come from the CHECKOUT. On a tag push those are the same commit; on
workflow_dispatch the checkout is a branch, so a fix to the release
machinery reaches an already-cut tag while the contract released stays
the tag's own. That split is what makes the recovery path in #42 safe to
enable.
shellcheck now covers scripts/release/ and scripts/verify-dmg.sh, which
was 485 lines of unlinted, never-executed acceptance test. It was clean.
Verified against the real v0.5.0-rc.4 artifacts: same sha256 the release
run reported, valid UDIF, stapled app, exit 0 in 0.83s.
The gate went red on its first run, on three `A && B || C` argument checks that shellcheck 0.9.0 flags as SC2015 and 0.11.0 does not. The runner image ships 0.9.0; a maintainer's Mac has 0.11.0. Both halves fixed. The checks become explicit `if` statements, which is what they meant and what .macos-builder/build.sh already advocates for exactly this shape. And the lint runs at --severity=warning with the version echoed, so info-level findings — style opinions that move between shellcheck releases — cannot turn the gate red on an image bump that changed nothing in this repository. Warnings and above still fail; the SC2046 this same lint caught earlier is a warning.
This was referenced Sep 4, 2026
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.
Closes #42.
Summary
Release verification logic moves out of
release.ymlintoscripts/release/, and a fixture-driven self-test runs it in the normal PR gate. The goal is to make release shell testable before a tag is cut rather than only during a release.Background
release.ymlcontained 522 lines of shell that executed for the first time during a real release. A single iteration costs a tag, a 20-40 minute signed build, Apple's notarization queue, and a manual approval. Two defects were found this way:echo "$ENTRIES" | head -5.actionlintandshellcheckboth ran against this code and reported nothing. Neither defect is detectable by static analysis; both are detectable by execution.Changes
New scripts
contract.sh.macos-builder/config, cross-checkforge.config.ts, expand{tag}and{version}verify-assets.shkolytrailer, PKZip magic,Info.plist, stapled-ticket markerprev-tag.shselftest.shrelease.ymlretains only orchestration: the job graph,ghcalls, output wiring, and the asset wait loop. It drops from 522 to roughly 430 lines.CI
selftest.shandshellcheckrun in thecheckjob, before the install step. They are placed inside that job rather than in a separate one becausebuild / typecheck / lint / testis the only check required by main's ruleset; a separate job would run without gating merges.shellcheckcoverage now includesscripts/verify-dmg.sh, which was 485 lines that no linter or test had previously exercised. It required no changes.Contract resolution
The contract is now read from the tag via
git show, while the scripts and workflow come from the checkout:release.yml,scripts/release/.macos-builder/config,forge.config.tsOn a tag push these are the same commit. On
workflow_dispatchthe checkout is a branch, and this split prevents building the tag's commit againstmain's contract. This is the code-side prerequisite for #42; see Follow-ups.Previous-tag selection
The prior implementation was:
This returns the newest tag that is not
$TAG, which is a newer tag whenever an older tag is re-released. Against the current tag list, re-releasingv0.5.0-rc.3would compare its bundle identity againstv0.5.0-rc.5. The replacement takes the entry following$TAGin a newest-first listing, which is the previous release by construction. Covered by four test cases.Verification
Self-test: 27 assertions, 0 failures, approximately 2 seconds. Identical results on macOS (bash 3.2) and on the Ubuntu runner.
Regression detection. Reintroducing either failed form causes the suite to fail:
echo "$ENTRIES" | head -5printf … | grep -qxF …The second case is the more dangerous of the two: it does not crash, it inverts the verdict of the check that guards offline launch.
Real artifacts.
verify-assets.shwas run against the releasedv0.5.0-rc.4dmg and zip (320 MB): the computed sha256 matches what the release run reported, the UDIF trailer validates, and the zip'sMaximal.appis confirmed stapled. Exit 0 in 0.83s, including the rewritten trailer read (ddat an offset, replacingtail -c 512 | head -c 4), which costs 0.13s of CPU on a 171 MB image.shellcheckandactionlintare clean.Correction to the rc.4 diagnosis
The commit message for #43 stated that the zip listing was "thousands of entries, far past the 64K pipe buffer, so the write cannot complete." This was incorrect.
The actual listing is 604 entries, 55,827 bytes, which is below a pipe's 64 KB capacity. The failure is a race rather than a size threshold:
headcloses the read end after five lines, and whether the writer has finished by then depends on scheduling. The Ubuntu runner lost the race; the same pipeline over the same artifact exits 0 on macOS.This makes the original defect intermittent and platform-dependent. The zip fixture is therefore sized at 6,009 entries (353,196 bytes), roughly six times the real listing, so that a reintroduced pipeline fails deterministically on any machine.
selftest.shasserts the fixture remains large enough, and fails if it does not.Follow-ups
This PR completes only the code half of #42. Dispatch-based recovery additionally requires a branch to be added to the
releaseenvironment's deployment policy, which is a repository setting and not changed here.