fix(ci): add publish verification to prevent false positive Rust releases#256
Merged
fix(ci): add publish verification to prevent false positive Rust releases#256
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #255
…ases Replace raw `cargo publish` in rust.yml with a new `publish-to-crates.mjs` script that verifies the crate actually appeared on crates.io after publishing. Root causes found: - v0.8.0: workflow had no `cargo publish` step at all — GitHub release was created directly after `cargo build`, with no actual crate publishing - v0.9.0: `cargo publish` failed because `Cargo.lock` had uncommitted changes after `cargo build --release` modified it post-commit Fixes: - New `publish-to-crates.mjs` script with retry logic and post-publish verification against the crates.io API (matching `publish-to-npm.mjs` pattern) - Uses `--allow-dirty` flag to avoid Cargo.lock false failures - GitHub release creation remains gated on `published == 'true'` output - Includes case study documentation with timeline and CI log excerpts Fixes #255 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $7.125467📊 Context and tokens usage:Claude Opus 4.6:
Total: (138.4K + 10.8M cached) input tokens, 29.2K output tokens, $6.981619 cost Claude Haiku 4.5: Total: (48.3K + 521.3K cached) input tokens, 6.3K / 64K (10%) output tokens, $0.143848 cost 🤖 Models used:
📎 Log file uploaded as Gist (3110KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 09ab593.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
publish-to-crates.mjsscript with retry logic and post-publish verification against the crates.io APIrust.ymlworkflow (both auto-release and manual-release) to use the new scriptRoot Causes Found
v0.8.0 — False Positive (GitHub release created, crate never published)
At commit
b1d0d1d, the workflow had nocargo publishstep in the auto-release job. The flow went:cargo build --release→Create GitHub Release(skippingcargo publishentirely).The
Create GitHub Releasestep was gated onshould_release == 'true'(not onpublished == 'true'), so it ran regardless of whether the crate was published.Verified:
link-assistant-agentreturns 404 on crates.io — it was never published.v0.9.0 — Correct Failure (cargo publish failed due to dirty Cargo.lock)
The
cargo publishstep was added in a subsequent PR, but it failed becausecargo build --release(run in the workflow after the commit step) modifiedCargo.lock, leaving it dirty.Fix
New
scripts/publish-to-crates.mjs(modeled afterpublish-to-npm.mjs):cargo publish --verbose --allow-dirtywith retry logic (3 attempts)published=trueonly after successful verificationThe
--allow-dirtyflag prevents theCargo.lockissue, while the post-publish verification ensures the crate actually made it to crates.io.Test Plan
experiments/test-crates-io-verification.mjslink-assistant-agentis NOT on crates.io (404)agentcrate is owned by different user (liangshuai)cargo publishwith valid token (will be tested on next release)Documentation
docs/case-studies/issue-255/README.md— Full case study with timeline, root causes, and evidencedocs/case-studies/issue-255/ci-log-excerpts.md— Relevant CI log excerpts from 3 runsFixes #255
🤖 Generated with Claude Code