Skip to content

publishing: stage every target before any is visible, and resume a failed publish from a pushed record (#4048) - #4080

Merged
lex00 merged 2 commits into
mainfrom
feat/4048-publish-resume
Oct 18, 2026
Merged

lex00 merged 2 commits into
mainfrom
feat/4048-publish-resume

Conversation

@lex00

@lex00 lex00 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Closes #4048

A publish stages every target before any becomes visible, and a failed publish resumes without republishing what already went out (#3856's recommendation).

  • Contract (lifecycle/release-publish.ts): publish(ctx) becomes stage(ctx) and reveal(ctx, staged), with a stable key per target (kind plus a digest of its declaration, which never holds a credential). runPublish plans everything, stages every target in declared order, then reveals them in the same order. A failure throws PublishRunError saying which step failed and what is staged or visible.
  • npm: stage asks npm view <name>@<version> and runs npm publish --tag next only for versions the registry lacks; reveal moves latest with npm dist-tag add, the first package in the target's list (the core) first. npm makes a brand-new package's first version latest whatever tag it is published under; that one case is documented.
  • OCI: stage pushes blobs and manifests by digest only; reveal moves the tags.
  • GitHub and Forgejo: stage finds or creates a draft release and uploads only missing assets; reveal publishes the draft. GitLab has no drafts: stage uploads to the generic package registry, reveal creates the release with its links in one call.
  • Publish record: one line per target per step in _releases/publishes.jsonl on chant/lifecycle (member prefix, append-only, version: 1), pushed after each write, so a CI job on a fresh clone resumes from it. Stages still query their registries, so a missing record costs speed rather than a second publish. Lines are redacted and hold names, destinations, digests and draft ids.
  • Also: test/egress-catalogue.ts now lists the publish modules' fetch (release-publish.ts, publish-oci.ts, publish-forge.ts), which publishing: a publish-target contract, with npm, OCI and forge release assets #4047 added without a row, so no-egress passes again; the fakes are read from lifecycle/__fixtures__/.

Level-0 output changes

On the exceptions page and #2525: npm runs view, publish --tag next and dist-tag add; OCI tags move only at the reveal; GitHub and Forgejo go through a draft, and a release already published for the tag without the assets is refused (publish-forge-release-published); GitLab links all assets at the reveal; a publish writes and pushes _releases/publishes.jsonl; new progress lines and resume hints; publish-npm-tag-failed; --json gains progress and resumed.

Acceptance

  • A resume test: a publish that fails after some targets resumes and republishes none of them (publish-resume.test.ts "a stage failure leaves nothing visible; a reveal failure is resumed; neither run again publishes what went out", and the e2e "a publish that failed at the image is resumed from a fresh clone with the record it pushed, and stages no package again").
  • A test per target that nothing is visible under latest, a moved tag or a published release until the last step runs, and that npm moves core's latest first (publish-targets.test.ts: npm, OCI, GitHub draft, GitLab, Forgejo, over stateful fakes).

Checks

  • npx tsx scripts/typecheck.ts: no regressions (26 baselined)
  • npx tsx scripts/check-lexicons.ts: no untracked tier-1 failures
  • publish targets, resume, release-publish, release e2e (cut, publish targets), no-listener, no-egress, level-0 goldens: pass with GITHUB_SHA, GITHUB_RUN_ID and CI set, after rebasing on publishing: a publish-target contract, with npm, OCI and forge release assets #4047
  • npx vitest run --project unit passes
  • lint-docs-sentences (baseline ratcheted down by 2), lint-prompts, check-docs-diataxis, ./scripts/build-docs.sh: pass
  • Nothing was published anywhere real; the real repository's chant/lifecycle was unchanged.

lex00 added 2 commits October 17, 2026 21:52
…iled publish from a pushed record (#4048)

A publish target now has two steps in place of publish(ctx): stage(ctx)
puts every item out where no consumer resolves it (npm under the next
dist-tag, OCI by digest, forge assets on a draft release, GitLab assets in
the package registry), and reveal(ctx, staged) is the one last step that
makes them visible (npm moves latest in the declared order, the first
package, the core, first; OCI moves the tags; the forge publishes the draft,
or GitLab creates the release with its links). chant release publish --yes
stages every target, then reveals them.

Each step is appended to _releases/publishes.jsonl on chant/lifecycle
(version 1) and pushed, so a publish run again after a failure, also from a
fresh CI clone, skips what was staged or revealed. Each stage also asks its
destination first and sends nothing already there. Records hold names,
destinations, digests and draft ids, redacted, never a credential.
@lex00
lex00 merged commit a01bdcf into main Oct 18, 2026
11 checks passed
@lex00
lex00 deleted the feat/4048-publish-resume branch October 18, 2026 04:06
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.

publishing: resume after a failure without republishing, and all-or-nothing visibility

1 participant