Repository navigation
chore(ci): move the Vale upgrade wait loops into a tested script - #378
Conversation
|
@claude /review |
|
Claude finished @theCodeDrift's task in 5m 16s —— View job Review mode: incremental — read 0 prior review thread(s) before reviewing.
SummaryThis is a clean, well-structured refactor: the two hand-rolled bash wait loops become a single injectable, unit-tested script ( Two things worth a look before/after merge, posted inline:
Everything else checked out:
|
5e4de94 to
caf2963
Compare
Finding 2 (the untested — AI Coding Agent |
What
Replaces the two hand-rolled shell wait loops in
.github/workflows/vale-upgrade.ymlwith one step that runs a new zero-dependency script,.github/scripts/vale-upgrade-wait.cjs, paired withvale-upgrade-wait.test.cjsunderpnpm test:scripts.The script exports both waits with every dependency injectable (
runGh,probe,sleep,now,log) and amain()guarded byrequire.main === module:waitForReleaseRunpollsgh run list --workflow release-vale.yml --event push --commit $GITHUB_SHA --json status,conclusion(argv array, no shell) every 30 s for up to 25 minutes.waitForRegistryspawnsnode vale-upgrade-detect.cjs --jsonas a child process up to five times a minute apart, withGITHUB_OUTPUTremoved from its env so the probe'supdate=falsenever lands in this step's outputs, and stderr passed through so "see the error above" stays true.It always exits 0 and reports through
::warning::lines plus two$GITHUB_OUTPUTvalues:ready(should detect run) andoutcome(one word saying why). The detect step now carriesif: steps.wait.outputs.ready == 'true'; every later step already gates onsteps.detect.outputs.update, which a skipped step leaves empty.The step no longer has
if: github.event_name == 'push'. The script reads the event itself and skips both waits withready=trueon anything else, so thatreadyis defined on the schedule and dispatch events too; a skipped step has no outputs, and gating detect on it would have silently skipped the daily backstop.Why
The #369 review asked for it as a follow-up: both loops were the only decision logic in this pipeline not living in a
.cjswith a paired test, and that is why theset -efinding in that review slipped past local testing. Thread: #369 (comment) (paragraph starting "Also worth a look").The explanatory comments from the YAML (the race with the publish, the 3.22.0 measurement, why a persistently erroring probe is left for detect to fail loudly on) moved into the script's header; the workflow keeps a shorter version and points at it.
Behaviour preserved
readyoutcometrueaheadfalsepublish-failedfalsepublish-unfinishedgherrors twice, then the run succeedstrueaheadgherrors on every poll until the boundfalsepublish-unfinishedtrueaheadtrueprobe-erroredfalseregistry-staleschedule,workflow_dispatch)trueskippedOne behaviour changed on purpose: previously detect ran unconditionally after a wait that gave up, and re-asked the registry a sixth time to say "nothing to do". It is now skipped in those cases; the probe already asked the same question with the same code. The
probe-erroredrow keeps the #369 reasoning that a broken registry read is a real failure, not the race.How verified
pnpm test:scripts: 466 pass, including the 23 new cases (fake clock advanced by the injectedsleep, so the 25-minute bound costs nothing).pnpm lint(builds first, thenpnpm cli check): clean. Prettier clean on the three touched files. Workflow parsed with theyamlpackage; step ids andif:conditions read back as expected.GITHUB_EVENT_NAME=schedule→ready=true outcome=skipped, exit 0, noghcall.GITHUB_EVENT_NAME=push GITHUB_SHA=000…0 --timeout-minutes 0.2 --poll-seconds 4→ three realgh run listpolls,::warning::gave up waiting … (no run found),ready=false outcome=publish-unfinished, exit 0.GITHUB_EVENT_NAME=push GITHUB_SHA=4bca529c(the 3.22.0 manifest commit)--attempts 1→Release Vale succeeded, one real registry probe reporting{"pinned":"3.22.0-20260921180930","upstream":"3.22.0-20260921180930","ahead":false},ready=false outcome=registry-stale, exit 0.git merge --no-commitoforigin/chore/self-consistent-vendor-upgrades(chore(ci): make vendor upgrade PRs self-consistent so Validate is green by construction #374) onto this branch: clean, no conflicts. This change stops above the "No dependency install" comment that chore(ci): make vendor upgrade PRs self-consistent so Validate is green by construction #374 rewrites, and the detectif:sits below the hunk context chore(ci): make vendor upgrade PRs self-consistent so Validate is green by construction #374 touches.actionlintis not installed here, so it was not run.