Skip to content

fix(ci): a catalog publish run that main overtook ends clean instead of failing - #7816

Open
wonjangcloud9 wants to merge 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/catalog-publish-superseded-run
Open

wonjangcloud9 wants to merge 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/catalog-publish-superseded-run

Conversation

@wonjangcloud9

@wonjangcloud9 wonjangcloud9 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

A Publish catalog run that finds main ahead of the commit it checked out now ends green with a notice. It used to throw and mark the run on main as failed.

Why

The workflow runs on every push to main. When a second push lands while a run is still building the catalog, the first run stops with:

Error: Main advanced during publication; the next push run will regenerate it.
##[error]Process completed with exit code 1.

The message is right: the second push has its own run, and that run publishes the newer state. So the first run has nothing left to do, and nothing is broken. It still shows as a red Publish catalog on main.

Of the last 100 Publish catalog runs on main (2026-11-13 to 2026-11-15), 6 failed, and all 6 failed with this error: 43687544153, 43671899736, 43671816399, 43663563106, 43655538003, 43555009474. A red run on main that needs no action makes the real failures harder to see.

Related work

No issue or PR covers this. I searched "Main advanced", "publish-catalog" and "Publish catalog". #5372 and #5480 changed other parts of the same script.

How

  • assertCurrentMain throws a MainAdvanced error instead of a plain Error.
  • publish catches only that error, prints it as a ::notice:: and returns. Any other error still fails the run.
  • The checks stay where they were, so a run that main overtook still writes nothing to the publish branch or its PR. If main moves after the staging commits, the staging branch is deleted as before. If that cleanup fails too, the run still fails with the AggregateError.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

Two new cases in scripts/catalog-publication.test.mjs:

  • main is ahead before the run starts: the run exits 0, prints the notice and makes no write call.
  • main moves after the staging commits: the run exits 0, prints the notice, deletes the staging branch, and makes no PATCH or dispatch call.

Both fail on main (24 of 26 pass) and pass with this change (26 of 26). oxlint, oxfmt --check, comment-ratchet and check-comment-citations are clean.

Manual run of the real script against the live GitHub API (macOS, Node 22.16). I ran it from a checkout whose HEAD is not the head of main, with GITHUB_REPOSITORY set to my fork, so the first GET git/ref/heads/main returns another commit:

# main's script
$ node scripts/publish-catalog.mjs
Catalog publication: 0 files, 0 signed commit batches.
Error: Main advanced during publication; the next push run will regenerate it.
exit=1

# this branch
$ node scripts/publish-catalog.mjs
Catalog publication: 0 files, 0 signed commit batches.
::notice::Main advanced during publication; the next push run will regenerate it.
exit=0

The fork's branch list is the same before and after both runs, so neither wrote anything.

I did not run the workflow in Actions: it needs write access to this repository. The case where main moves after the staging commits is covered only by the test with the fake gh.

🤖 Generated with Claude Code

…of failing

Every push to main starts its own Publish catalog run, so a run that finds
main ahead of its checkout has nothing left to do. It used to throw, which
marked 6 of the last 100 main runs red with nothing to fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@wonjangcloud9
wonjangcloud9 force-pushed the fix/catalog-publish-superseded-run branch from ba478b9 to 34bf40f Compare November 15, 2026 08:32

This branch has not been deployed

No deployments
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