open-code-review icon indicating copy to clipboard operation
open-code-review copied to clipboard

A failed npm publication leaves a public partial release, and resume never verifies artifact identity

Open Fanzzzd opened this issue 3 months ago • 2 comments

Problem

Split out of #807 (which now tracks only the release-process/reviewability proposal): the release workflow can leave a publicly visible partial release, and a re-run never verifies that already-published artifacts are the ones this release intended to publish. Verified by inspection of main @ 071debe; not exercised against the live registry.

1. The GitHub Release is public before any npm artifact exists

In .github/workflows/release.yml, the release job runs the Create GitHub Release step, and npm-publish only starts afterwards (needs: release). npm has no transaction across the six platform packages and the root wrapper, so any failure in npm-publish — after zero or some platform packages — leaves users looking at a finished-looking public release whose npm install -g @alibaba-group/open-code-review either fails or resolves incoherently. The effective public commit point should be the root package (installable only when all exact-version platform dependencies exist), with the GitHub Release created last.

2. Resume-by-existence accepts whatever is already on the registry

Every recovery path checks only that name@version exists, never what it contains:

A retried release therefore silently accepts an artifact published by an interrupted, corrupted, or different run, as long as the version number matches. Since npm versions are immutable, a wrong artifact accepted this way is permanent.

Suggested direction

  1. Publish platform packages first, root wrapper last; create the vX.Y.Z tag's GitHub Release only after an exact-version install smoke test passes.
  2. On resume, compare registry integrity (npm view … dist.integrity) against the locally packed tarball: skip identical artifacts, fail closed on mismatch, never delete or republish an existing version.
  3. Serialize release runs (concurrency with cancel-in-progress: false) so two publishes for the same version cannot interleave.

Acceptance criteria

  • A failure at any point of npm publication leaves no public GitHub Release.
  • Re-running the workflow for the same version either completes the release with byte-identical artifacts or fails with a clear mismatch report.
  • Platform packages are always published before the root wrapper.

Fanzzzd avatar Aug 11 '26 05:08 Fanzzzd

Great idea, but I don't think it's really needed. Atomic publishing feels over-engineered here: a failed npm publish is usually transient, and each package either lands or it doesn't, so re-running the workflow should publish whatever is missing. There's no shared transaction between npm and GitHub anyway, so it would all come down to ordering, checks and rollback code.

npm-first doesn't really fix that, it just moves the problem: instead of a Release with nothing on npm, you'd get npm versions with no Release. And that one is worse to undo, since deleting a Release is one command while an npm version is immutable. Vite publishes this way today too, fwiw.

hanhaiqingchuan avatar Aug 14 '26 03:08 hanhaiqingchuan

Fair enough on the ordering half — the Vite precedent and "a Release is one command to delete, an npm version isn't" both land, and I'm happy to drop it.

The half your comment actually sharpens is the other one: re-running to publish whatever is missing is only safe if resume verifies it's publishing the same artifacts this release built — today's check is existence-only, so a re-run after a partial failure can pair the Release with artifacts rebuilt from different state. I'll treat this issue as narrowed to that identity check.

Fanzzzd avatar Aug 14 '26 05:08 Fanzzzd