fix: ship docs/ascii_art.txt inside peeroxide-cli + add publish-check CI gate#21
Merged
Conversation
…can find it
The previous location 'docs/ascii_art.txt' was outside the peeroxide-cli
crate root and reached via include_str!("../../docs/ascii_art.txt") in
src/main.rs. cargo publish strips files outside the crate directory from
the tarball, so the release-plz verification compile failed with:
error: couldn't read `src/../../docs/ascii_art.txt`: No such file or
directory (os error 2)
Move the canonical asset to peeroxide-cli/src/ascii_art.txt and update
the include path to the in-crate location.
Add a publish-check CI job that runs 'cargo package --workspace' on
every PR. This runs the same verification compile release-plz runs at
publish time, against a tmp-registry built from sibling tarballs in
topological order, so it catches both this bug class (include_str!
paths that escape the crate root) and cross-crate API mismatches
before they reach the release PR.
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.
Why
The release-plz publish workflow for
peeroxide-cli 0.2.0failed with:peeroxide-cli/src/main.rswas reaching outside the crate root viainclude_str!("../../docs/ascii_art.txt").cargo publishpackages only files inside the crate directory, so the asset was absent from the tarball and the verification rebuild couldn't find it.The bigger problem:
cargo buildandcargo testboth passed against the live workspace tree where the file does exist, so CI happily merged the PR. The breakage only surfaced when release-plz ran the publish-equivalent verification compile against an unpacked tarball — at which point the broken state was already onmain.What
1. Fix the asset location. Move the file to
peeroxide-cli/src/ascii_art.txt(usinggit mvso history is preserved) and update the include path toinclude_str!("ascii_art.txt"). The asset is now inside the crate root and ships in the published tarball.The only programmatic consumer of the file was the
include_str!inmain.rs. The workspace README,peeroxide-cli/README.md, anddocs/src/introduction.mdall inline the ASCII art as literal text, so no doc/README changes are needed.2. Add a CI gate that would have caught this. New
publish-checkjob in.github/workflows/ci.ymlrunscargo package --workspaceon every PR. Empirically verified that this command:target/package/in topological ordertarget/package/tmp-registrycontaining the sibling tarballsSo it catches both:
include_str!/asset paths that escape the crate root — what bit us this timeThis is the same verification step release-plz runs at publish time. Running it on every PR catches publish-only failures before merge instead of after.
Verification
cargo build -p peeroxide-cli— greencargo package -p peeroxide-cli(full verify against unpacked tarball, same step that failed in CI) — greencargo package --workspace— green; verify steps unpack siblings from local tmp-registry as expectedNotes