Skip to content

publish: per-package mode ignores dependency order and pushes each tag before the branch #735

Closed

Description

@goosewobbler

Problem

Per-package mode runs whenever any update carries a tag (packages/publish/src/pipeline/index.ts:66). That covers:

  • the single strategy;
  • the async strategy;
  • version.groups;
  • sync with packageSpecificTags.

Three problems in this mode:

  1. Dependency order is lost.
    • The loop gives each stage a context with only one update (index.ts:108-136). So these each see a single target and can't order anything:
      • orderNpmUpdates (registry/npm.ts:43-82);
      • the cargo topological sort and publishOrder (registry/cargo.ts:156-200);
      • pub publishOrder (registry/pub.ts:128-150).
    • The actual order is the order of VersionOutput.updates, which is discovery order.
    • A dependent crate can therefore publish before its path dependency, and cargo publish then fails on every retry.
    • docs/rust.md:15,143-165 and docs/dart.md:18,146-161 promise this ordering.
  2. Each tag is pushed before the branch.
    • pushPackageTag pushes refs/tags/<tag>, then the branch (stages/git-push.ts:118-128).
    • Batch mode does the reverse and explains why branch-first is safer (git-push.ts:183-189).
    • If a ruleset rejects the branch push, an orphan tag is left on the remote.
  3. "Re-run failed jobs" after a partial publish probably fails (traced).
    • The re-run recreates the release commit at a new SHA.
    • stages/git-commit.ts:105-127 then finds the earlier packages' tags at a different commit and throws GIT_TAG_ERROR.

Fix

  • Before the loop, sort input.updates the same way the batch stages do.
  • Push the branch before the tag.
  • Add tests for both.
  • For (3), decide between a code fix and a documented recovery: roll forward with the next release.

Found in the 2026-10-23 docs review.

Activity

  1. added this to the 0.42.1 milestone on Oct 23, 2026
  2. goosewobbler commented on Oct 23, 2026

    @goosewobbler
    OwnerAuthor

    This was generated by AI during triage.

    Coverage: #765 fixes items 1 and 2 (dependency order, branch pushed before tag). #762 settles item 3 the documented way, in line with the roll-forward invariant: a per-package direct failure is rolled forward, and the failure report stops suggesting "Re-run failed jobs" for it. Close this issue once both have merged.

  3. added and removed
    status:agent-readyDefined and ready for an autonomous (AFK) agent to pick up
    on Oct 23, 2026
  4. goosewobbler commented on Oct 24, 2026

    @goosewobbler
    OwnerAuthor

    Item 3 is split: #762 settles the documented part (a per-package direct failure that has pushed is rolled forward, and the report stops suggesting a re-run), and the rest moved to #774: the case where the first package's tag push fails after its branch push, and GitHub Releases for packages that published. #765 fixed items 1 and 2, so #762 closes this issue when it merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:wipWork in progresstype:bugSomething isn't working

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions