Skip to content

fix(vale): hold the upgrade wait until the registry reaches the manifest's Vale - #736

Merged
aibex-agent[bot] merged 2 commits into
mainfrom
aibex/t_xa4dm0uLOk5MAwpCKqvzfhNl
Dec 2, 2026
Merged

aibex-agent[bot] merged 2 commits into
mainfrom
aibex/t_xa4dm0uLOk5MAwpCKqvzfhNl

Conversation

@aibex-agent

@aibex-agent aibex-agent Bot commented Dec 2, 2026

Copy link
Copy Markdown

A push-triggered Upgrade the pinned Vale run could propose an older Vale than the release that triggered it.

What happened (2026-12-02, run 46830233801). Merging #729 (manifest → 3.29.0) started both Release Vale and the upgrade. The wait correctly held for the Release Vale run (success at 07:10:47Z), then waitForRegistry() returned ahead immediately: its only condition was "registry serves a newer set than the pins". The pins were still 3.27.0 (the 3.28.1 upgrade, #731, was unmerged) and npm still served 3.28.1 as latest, so 3.28.1 counted. 3.29.0 became visible at 07:12:28Z, after the run had already rebuilt vendor/vale/upgrade at 3.28.1.

Fix. On a push, the wait now also requires the base version of the published stamp (3.29.0 of 3.29.0-<stamp>) to equal valeVersion in .github/scripts/vale-manifest.json at GITHUB_SHA. An intermediate newer set is logged as "newer than the pins, but not yet Vale X" and polled again.

Unchanged. Every exit is still 0. A registry that never reaches the manifest's version ends as the existing registry-stale warning (now naming the version it waited for) and leaves the work to the daily cron. Scheduled and dispatched runs skip both waits and never read the manifest. A manifest that cannot be read falls through to the existing recover() path (ready=true, wait-errored).

Tests. .github/scripts/vale-upgrade-wait.test.cjs replays the incident: pins at 3.27.0, registry at 3.28.1, then 3.29.0 → waits for 3.29.0; registry stuck at 3.28.1 → registry-stale; plus readManifestVersion and a check that non-push runs never read the manifest. 39/39 pass; pnpm typecheck and pnpm lint pass.

The workflow change is comments only. CI-only, so no changeset.

…est's Vale

A push-triggered upgrade run waited for the Release Vale run, then took the
first registry answer "newer than the pins" as the new release. On 3.29.0 the
pins were at 3.27.0 (the 3.28.1 upgrade unmerged) and npm still served 3.28.1
as latest for a minute and a half after the publish succeeded, so the run
rebuilt vendor/vale/upgrade at 3.28.1, older than the release that started it.

On a push, waitForRegistry now also requires the base version of the published
stamp to equal the manifest's valeVersion at GITHUB_SHA. A registry that never
gets there ends as the existing registry-stale warning, and non-push runs are
unchanged.
@aibex-agent

aibex-agent Bot commented Dec 2, 2026

Copy link
Copy Markdown
Author

@claude /review

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @aibex-agent[bot]'s task in 3m 13s —— View job


Review: fix(vale): hold the upgrade wait until the registry reaches the manifest's Vale

Review mode: incremental — read 0 prior review thread(s) before reviewing. .prior-review.json contains no reviewThreads and no reviews, and its single comments entry is just the @claude /review trigger itself — this is the first review of this PR, so everything below is assessed fresh (nothing to carry forward as addressed/unaddressed).

  • Read .prior-review.json
  • Fetch PR diff (gh pr diff) and metadata (gh pr view)
  • Read full contents of changed files (vale-upgrade-wait.cjs, vale-upgrade-wait.test.cjs, vale-upgrade.yml) plus the related vale-upgrade-detect.cjs, vale-release.cjs, and the current vale-manifest.json for context the diff hunks don't show
  • Review correctness, security, performance, test adequacy, clarity
  • Post inline comments for concrete issues
  • Post final top-level summary

Findings

[New] One inline comment on vale-upgrade-wait.cjs (lines 356–371): the new reached check requires the registry's base version to exactly equal the manifest's valeVersion, not merely be at or past it. That correctly fixes the incident this PR targets (registry lagging behind), but it creates the mirror case — if a second manifest bump merges and its own publish completes while this run is still polling, the registry can race past the expected version, and the exact-equality check would then (incorrectly) report registry-stale and defer to the daily cron even though the registry is actually ahead of the pins. See the inline comment for the scenario and a suggested fix using the already-exported compareValeVersions helper. This is narrow (needs two manifest-bump PRs merging within the ~5-minute registry-poll window) and degrades gracefully (daily cron backstop still runs), so I'd call it a real gap worth a decision rather than a blocking bug.

Everything else checked out:

  • The core fix (readManifestVersion + stampBase + expectedVersion threaded through waitForRegistry/main) correctly reproduces and resolves the measured incident: pins at 3.27.0, registry transiently at 3.28.1 (newer than pins but not the triggering release), then 3.29.0 — the wait now correctly holds for the second.
  • comparison.upstream is always present in probeRegistry's JSON output (confirmed in vale-upgrade-detect.cjs), so stampBase(comparison.upstream) is safe to compute unconditionally even when comparison.ahead is false.
  • Read-order in main() (manifest read before waitForReleaseRun) is correct and fails fast via the existing recover() path if the manifest can't be parsed — matches the PR's documented "falls through to wait-errored" claim, and is covered by a test with the real on-disk manifest.
  • The non-push skip path is verified to never call manifestVersion() (test asserts a throwing stub is never invoked), matching the workflow comment that scheduled/dispatched runs never read the manifest.
  • Test coverage is thorough and specifically targets the incident shape (intermediate release that's newer-than-pins-but-not-the-target, in both waitForRegistry unit tests and full main() integration tests), plus the back-compat "no expectedVersion" path and the manifest-missing-field error case.
  • Workflow comment-only changes in vale-upgrade.yml accurately describe the new behavior; no non-comment lines changed, consistent with "CI-only, so no changeset."
  • Minor/cosmetic, not flagged inline: a couple of comment lines (vale-upgrade-wait.cjs line 50, vale-upgrade.yml line ~144) run noticeably longer than the ~80-char soft-wrap the surrounding prose otherwise holds to — purely stylistic, not worth a blocking comment.

Comment thread .github/scripts/vale-upgrade-wait.cjs Outdated
Comment on lines +356 to +371
@@ -330,14 +366,19 @@ async function waitForRegistry({
try {
const comparison = await probe();
answered += 1;
if (comparison.ahead === true) {
const reached =
expectedVersion === undefined ||
stampBase(comparison.upstream) === expectedVersion;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[New] reached requires the registry's base version to be exactly expectedVersion (line 371: stampBase(comparison.upstream) === expectedVersion), not "at least" it. That's a fine fix for the measured incident (registry lagging behind the manifest), but it creates the mirror case: if the registry has already raced past the manifest's version by the time this probes — e.g. a second manifest bump (3.30.0) merges and its own Release Vale run finishes publishing while this run (waiting for 3.29.0) is still in its 5-attempt registry poll — stampBase(comparison.upstream) is "3.30.0", never equals "3.29.0", and the run reports registry-stale and defers to the next day's cron even though the registry is actually ahead of the pins and could be upgraded to immediately.

Both release-vale.yml and vale-upgrade.yml serialize themselves via their own concurrency: groups (release-vale, vale-upgrade), so this needs two manifest-bump PRs to merge within roughly the 5-minute registry-poll window to trigger — narrow, but not impossible with quick reviews/bot approvals.

Since vale-release.cjs already exports compareValeVersions for comparing two plain (non-stamped) Vale versions, consider compareValeVersions(stampBase(comparison.upstream), expectedVersion) >= 0 instead of strict equality, so "ahead of the pins and at or past the manifest's target" both count as reached.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed in bafc124. The wait now uses compareValeVersions(stampBase(upstream), expectedVersion) >= 0 (imported from vale-release.cjs), so a registry already past the manifest's version counts as reached. An earlier, intermediate version still waits. Added a test for the 3.30.0-past-3.29.0 case and reworded the warning and comments to say "at or past".

Review on #736: an exact match would report registry-stale when a later
manifest bump published first. Compare with compareValeVersions so at or past
the manifest's version counts.
@aibex-agent
aibex-agent Bot merged commit 4ea1696 into main Dec 2, 2026
7 checks passed
@aibex-agent
aibex-agent Bot deleted the aibex/t_xa4dm0uLOk5MAwpCKqvzfhNl branch December 2, 2026 07:49
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