Skip to content

fix(ci): rewrite every workspace path dependency in the publish tree - #43

Merged
fffonion merged 1 commit into
masterfrom
subagent/rustscript-publish-fix-20261117
Nov 16, 2026
Merged

fffonion merged 1 commit into
masterfrom
subagent/rustscript-publish-fix-20261117

Conversation

@fffonion

Copy link
Copy Markdown
Collaborator

Problem

Publish crates, tag 0.31.2, run 43930447468 failed before uploading anything:

error: failed to select a version for the requirement `pd-host-schema = "^0.1.0"`
candidate versions found which didn't match: 0.31.2
location searched: .../crates/pd-host-schema
required by package `pd-vm v0.31.2`

and then scripts/publish_crates.py exited 101 at
cargo update -p pd-host-function@0.22.2 --precise 0.22.7.

Root cause

rewrite_manifests() rewrites [workspace.package] version to the release version, which moves
crates/pd-host-schema (it uses version.workspace = true) to 0.31.2. But it only rewrote path
dependencies whose package name was pd-host-function or pd-vm. pd-vm declares
pd-host-schema as a build dependency (and a dev dependency) with version = "0.1.0", so the
publish tree required ^0.1.0 from a path crate that now is 0.31.2.

That mismatch makes the whole workspace unresolvable, so the cargo update that
refresh_compatible_registry_lock() runs before publishing aborted with 101 — the path
dependency, not the registry entry, was the blocker. Reproduced locally with
--prepare-only --version 0.31.2 on an untouched copy of the tree: identical error, identical
exit status.

Two secondary problems in the same area:

  • pd-host-schema is a normal dependency of pd-host-function and a build dependency of pd-vm
    and has never been published (crates.io returns no versions), yet it was missing from
    PACKAGE_ORDER, so pd-vm 0.31.2 could never be published even with correct manifests.
  • verify_publish_order.py silently ignored workspace crates absent from the order, so the gate
    could not catch that.

Fix

  • package_versions() is now the single source of truth for the publish plan and the path
    dependency rewrite. Adding a crate to PACKAGE_ORDER can no longer leave a stale requirement
    behind.
  • Dependency rewriting is section aware: normal/build tables (including target-specific ones) get
    the publish version; [dev-dependencies] lose the version, so cargo strips them from the
    packaged manifest instead of demanding an unpublished version. Verified with
    cargo package --no-verify --offline: a versioned path dev-dependency that is not on crates.io
    fails packaging with no matching package named ..., which would block pd-host-function
    (published before the pd-vm it dev-depends on).
  • pd-host-schema leads PACKAGE_ORDER; the workflow PACKAGE_ORDER is synced and asserted by a
    test.
  • verify_publish_order.py now rejects an order that omits a workspace crate with a normal/build
    edge.
  • stale_path_dependencies() re-checks the rewritten tree and fails loudly;
    refresh_compatible_registry_lock() prints cargo's output instead of raising a bare
    CalledProcessError.

Verification

  • python3 -m unittest scripts.test_publish_crates scripts.test_verify_publish_order — 18 tests, OK
  • python3 -m py_compile on all four scripts; yaml.safe_load on both workflows
  • python3 scripts/verify_publish_order.py pd-host-schema pd-host-function pd-vm pd-vm-nostd rustscript — valid; the old 0.31.2 order now fails with both missing edges named
  • --prepare-only --version 0.31.2 --host-version 0.22.7 on a copy of this tree: the lock refresh finishes (updates pd-host-function 0.22.2 -> 0.22.7 plus the workspace crates) and prints
    [["pd-host-schema","0.31.2"],["pd-host-function","0.22.7"],["pd-vm","0.31.2"],["pd-vm-nostd","0.31.2"],["rustscript","0.31.2"]]
  • cargo metadata in the rewritten tree: pd-vm build dep pd-host-schema ^0.31.2, dev dep *
  • cargo package -p pd-host-schema --no-verify --offline in the rewritten tree succeeds

No crates were published, no tag or version was changed, and nothing was merged here. Full
end-to-end proof still requires the real Publish crates run, which must publish pd-host-schema
first.

Publish crates for tag 0.31.2 (run 43930447468) died in
refresh_compatible_registry_lock with exit 101:

  error: failed to select a version for the requirement `pd-host-schema = "^0.1.0"`
  candidate versions found which didn't match: 0.31.2
  location searched: .../crates/pd-host-schema
  required by package `pd-vm v0.31.2`

rewrite_manifests bumps [workspace.package] version to the release version,
which moves crates/pd-host-schema to 0.31.2, but it only rewrote path
dependencies named pd-host-function and pd-vm. pd-vm's build-dependency (and
dev-dependency) kept `pd-host-schema = "^0.1.0"`, so cargo could not resolve
the publish tree at all and aborted the
`cargo update -p pd-host-function@0.22.2 --precise 0.22.7` that runs before
anything is published.

Changes:
- package_versions is the single source of truth for both the publish plan and
  the dependency rewrite, so a crate added to PACKAGE_ORDER cannot keep a
  stale requirement behind.
- Path dependencies are rewritten per section: normal and build tables get the
  publish version, [dev-dependencies] (including target-specific tables) lose
  the version so cargo strips them from the packaged manifest. Checked with
  `cargo package --offline`: a versioned path dev-dependency that is not on
  crates.io fails packaging with `no matching package named ...`, which would
  block pd-host-function (published before the pd-vm it dev-depends on).
- pd-host-schema now leads PACKAGE_ORDER: it is a normal dependency of
  pd-host-function and a build dependency of pd-vm, and had never been
  published. The workflow PACKAGE_ORDER is kept in sync and asserted.
- verify_publish_order rejects an order that omits a workspace crate with a
  normal/build edge, which would have caught this before upload.
- stale_path_dependencies re-checks the rewritten tree, and
  refresh_compatible_registry_lock prints cargo's output instead of failing
  with a bare CalledProcessError.

Verification: python3 -m unittest scripts.test_publish_crates
scripts.test_verify_publish_order (18 tests), py_compile, YAML parse,
verify_publish_order.py (new order passes, the 0.31.2 order now fails), and a
--prepare-only run over a copy of this tree for 0.31.2/0.22.7 that finishes the
lock refresh and prints the full plan. Nothing was published; no tag or version
was changed.
@fffonion
fffonion merged commit 75caac6 into master Nov 16, 2026
13 checks passed
@fffonion
fffonion deleted the subagent/rustscript-publish-fix-20261117 branch November 16, 2026 19:52
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