Skip to content

xtask: reject versioned workspace deps on publish=false crates#578

Merged
EffortlessSteven merged 1 commit into
mainfrom
xtask/publish-false-dep-guard
May 11, 2026
Merged

xtask: reject versioned workspace deps on publish=false crates#578
EffortlessSteven merged 1 commit into
mainfrom
xtask/publish-false-dep-guard

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Why

The v0.7.0 release lane failed because [workspace.dependencies] in the root Cargo.toml declared version = \"0.7.0\" on three internal publish = false crates — uselesskey-test-support, uselesskey-test-grid, and uselesskey-feature-grid. Even though those entries were only consumed as [dev-dependencies] in dependents, cargo publish resolves the workspace version constraint against crates.io and fails with no matching package named uselesskey-test-support found.

#569 fixed the instance by stripping the version field from those three entries (path-only). This PR closes the class: the same bug could silently recur the next time anyone bumps versions across the workspace manifest. There was no gate to catch it before tag push.

What

  • New verify_no_versioned_publish_false_deps() in xtask/src/main.rs:
    • Parses the workspace root Cargo.toml via the toml crate (already a dep of xtask).
    • Walks every [workspace.dependencies] inline-table entry that declares both path = ... and version = ... (bare-string entries and path-only entries are correctly ignored).
    • Opens the referenced crate's Cargo.toml and checks whether [package].publish is false.
    • Collects all violations into a Vec and reports them together with the exact message: workspace.dependencies entry '{name}' has version = \"{version}\" but {path} is publish = false; strip the version to make it path-only.
  • Wired into two call sites:
    • publish_check() — runs first, so the cheap PR gate fails fast.
    • run_publish_preflight() — added as a new preflight:publish-false-dep-guard receipt step ahead of preflight:metadata, so the release lane catches it before any cargo package work.
  • Unit test verify_no_versioned_publish_false_deps_passes_on_current_workspace() asserts Ok(()) on the current workspace (which is clean after fix: make internal test-helper deps path-only in workspace.dependencies #569). If someone re-adds a stray version field, both the test and the preflight gate fail.

No Cargo.toml files are modified by this PR — it is xtask-only.

0.7.1 plan

This is PR 2 of the v0.7.1 publish-system hardening series. PR 1 is #572 (topology guard). The two are conceptually paired but independent — either can land first; if #572 lands first, this branch may need a tiny rebase on xtask/src/main.rs since both add a verification function near publish_check.

Test plan

  • rtk cargo build -p xtask
  • rtk cargo test -p xtask verify_no_versioned_publish_false_deps (1 passed)
  • rtk cargo fmt --check -p xtask
  • rtk cargo clippy -p xtask --all-targets -- -D warnings (no issues)
  • rtk cargo xtask publish-preflight — new step preflight:publish-false-dep-guard runs first and the full preflight succeeds
  • rtk cargo xtask publish-check — succeeds
  • CI green (gate)

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 59 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 660aae89-6ed0-447e-992a-297ffca5f84f

📥 Commits

Reviewing files that changed from the base of the PR and between 2827093 and fbb3988.

📒 Files selected for processing (1)
  • xtask/src/main.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xtask/publish-false-dep-guard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The v0.7.0 release lane failed because `[workspace.dependencies]` had
`version = "0.7.0"` declared on three internal `publish = false` crates
(`uselesskey-test-support`, `uselesskey-test-grid`,
`uselesskey-feature-grid`). Even though those entries were only consumed
as `[dev-dependencies]`, `cargo publish` resolves the workspace version
constraint against crates.io and fails with `no matching package named
...`. PR #569 stripped the offending `version` fields to fix the
instance, but the class of bug — a versioned workspace.dependencies
entry pointing at a non-publishable crate — could silently recur the
next time someone bumps versions across the manifest.

This adds `verify_no_versioned_publish_false_deps()`: it parses the
workspace `Cargo.toml`, walks every `[workspace.dependencies]`
inline-table entry that declares both `path` and `version`, opens the
referenced crate's `Cargo.toml`, and bails if `[package].publish` is
`false`. All violations are collected and reported together so the fix
is a single pass. The check is wired into both `publish_check()` and
`run_publish_preflight()` (as a new `preflight:publish-false-dep-guard`
step) so it runs ahead of any cargo packaging work and on the cheap
gate PRs already run.

A unit test asserts the function returns `Ok(())` on the current
workspace (post-#569). If anyone re-introduces a `version` field on a
path that resolves to a `publish = false` crate, the test and the
preflight gate both fail before a tag push can land.
@EffortlessSteven EffortlessSteven force-pushed the xtask/publish-false-dep-guard branch from 4d2f078 to fbb3988 Compare May 11, 2026 18:32
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Rebased against current main (which now has #572's topo guard merged). Both verify_* functions coexist: topo guard runs first in publish_check, publish-false dep guard runs second.

@EffortlessSteven EffortlessSteven merged commit b8e2df4 into main May 11, 2026
6 checks passed
EffortlessSteven added a commit that referenced this pull request May 11, 2026
Why patch mode
==============

v0.7.0 ran the full minor-release evidence lane, including expensive
gates like `cargo xtask mutants-nightly --scope public`, the broad
perf suite, and new product profile proofs. That investment is right
for a minor release that changes the user-facing platform.

v0.7.1 is different: it hardens release tooling and the user install
path without changing public behavior. It only needs confidence that
release-system gates and the user path still work. Running the full
minor lane on every patch wastes CI time and dulls the signal of the
minor lane itself.

What the patch lane runs
========================

`cargo xtask release-evidence --version <V> --patch [--summary]`
selects `release_evidence_steps_patch()` which runs 10 focused steps:

1.  `public-surface`            — re-confirm exported API
2.  `check-file-policy`         — non-Rust file allowlist
3.  `publish-preflight`         — metadata + cargo package --no-verify
4.  `publish-check`             — ordered publish dry-runs (includes
                                  topology guard from #572 and
                                  publish=false dep guard from #578)
5.  `scanner-safe-reference --check` (#577) — scanner reference paths
6.  `cratesio-smoke --path . --skip-install-cli` (#580) — user path
7.  `docs-sync --check`         — docs are in sync with code
8.  `no-blob`                   — no secret-shaped blobs in test paths
9.  `examples-smoke`            — examples still compile / run
10. `impacted-evidence --base origin/main` — change-impact routing

What it deliberately omits
==========================

- `mutants-nightly --scope public` — full nightly mutation runs
  against `main` on schedule; targeted mutation already runs through
  `cargo xtask pr` when `impacted-evidence` flags the change.
- broad perf suite (`perf --compare`) — patch releases should not
  shift baselines; if they do, escalate to the minor lane.
- new product profile proofs (scanner-safe bundle, OIDC contract
  pack) — patch releases are not the venue to re-prove new profiles.

Receipt shape
=============

`ReleaseEvidenceReceipt` gains a `lane_mode` field (`"minor"` or
`"patch"`). The existing `lane: "release-evidence"` string is
preserved for backward compatibility with anything consuming the
shape; only the new field distinguishes the two lanes. The
release-evidence markdown gains a `Mode:` line; the summary opens
with a "Patch-mode evidence lane" callout when patch is set and
swaps the v0.7.0-specific gate table for the patch step list.

Tests
=====

- `release_evidence_patch_step_list_excludes_mutants_nightly`
- `release_evidence_minor_step_list_includes_mutants_nightly`
- `release_evidence_patch_step_list_includes_scanner_safe_reference`
- `release_evidence_patch_step_list_includes_cratesio_smoke`
- `release_evidence_patch_receipt_records_patch_mode`
- `release_evidence_patch_summary_announces_patch_lane`

Minor-lane callers (`release-evidence --version X [--summary]` with
no `--patch`) are unchanged in behavior and continue to run the
full 15-step lane.
@EffortlessSteven EffortlessSteven mentioned this pull request May 11, 2026
4 tasks
EffortlessSteven added a commit that referenced this pull request May 11, 2026
Bump workspace version 0.7.0 -> 0.7.1 and seed the CHANGELOG entry
describing the release-hardening additions (#572, #577, #578, #580,
#581) and docs (#571, #579). No new product surface; no shim removal;
no profile work. Patch evidence lane passes.
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