Repository navigation
fix(rust): keep changelog/migration fragments out of the crate archive - #976
Merged
Merged
Conversation
RED. `packages/rust/Cargo.toml`'s `[package].exclude` covers `tests/` and the VitePress tooling under `docs/`, but not the fragment dirs, so `cargo package` ships all 57 of them -- roughly half the archive's 118 files. npm's `files` allowlist and maturin's wheel layout keep their fragments out structurally; cargo ships everything not excluded, so the crate needs the patterns named. Asserted against `cargo package --list` (the archive's own manifest) rather than against the exclude patterns, so a pattern that parses but matches nothing still fails. A third case pins `src/lib.rs` as present, so a `--list` that returned nothing cannot satisfy the two absence checks vacuously. Refs #939 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8dwtBuYy6sjaEYwNusb4z
Still RED. `cargo package --list` aborts outright when a packaged file is uncommitted, so the moment you edit `[package].exclude` to try a fix the test stops reporting on its assertions and fails on the VCS check instead -- all three cases, including the sanity anchor. `--allow-dirty` asks the question the assertions actually mean: what would the working tree ship. The two fragment cases still fail against the unmodified manifest. Refs #939 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8dwtBuYy6sjaEYwNusb4z
GREEN. `cargo package` drops from 119 files to 59: the 60 fragment files no longer ship. Verified on the real archive, not just the listing -- `tar -tzf target/package/dirsql-0.2.7.crate` has zero entries under either dir, and `Packaged 59 files, 799.3KiB (207.1KiB compressed)`. npm's `files` allowlist and maturin's wheel layout already dropped their fragments structurally, and release-ci.yml's path filters treat every package's fragment dirs as non-shipping. The crate manifest was the one place that had not been told. Fixes #939 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8dwtBuYy6sjaEYwNusb4z
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.
Fixes #939
packages/rust/Cargo.toml's[package].excludecoverstests/and the VitePress tooling underdocs/, but not the fragment dirs. cargo ships everything not excluded, so the published.cratecarried 60 fragment files — more than half its 119 entries — none of them read by a crate consumer.npm keeps its fragments out structurally (
"files": ["dist/", "docs/", "README.md", "LICENSE"]is an allowlist) and maturin's wheel layout does the same, so this is a cargo-only gap.release-ci.yml's path filters already treat every package'schangelog.d//migrations.d/as non-shipping (!packages/rust/changelog.d/**, …) — the crate manifest was the one place that hadn't been told.Test
tests/crate_contents.rsassertscargo package --list— the archive's own manifest — rather than theexcludepatterns, so a pattern that parses but matches nothing still fails. A third case pinssrc/lib.rsas present so a--listreturning nothing can't satisfy the two absence checks vacuously.--allow-dirtyis passed deliberately: without it cargo aborts on the VCS check the moment a packaged file is uncommitted, so editingexcludeto try a fix would stop the test reporting on its own assertions.RED is in this PR's history on purpose, per AGENTS.md — the failing test was pushed and observed red in CI before the fix:
7a73e31test1 passed; 2 failed, both fragment assertionsa446c70test hardening6e78117fixNote on the pointer stubs
packages/rust/CHANGELOG.md/MIGRATIONS.mdstill ship, and their relative links intochangelog.d/are now dead inside the archive (their link to the repo-rootCHANGELOG.mdalready was). Left deliberately: they're 13-line signposts to where history lives, which is still useful in a vendored crate, and excluding them is outside this issue.E2E Verification
packages/pythonuntouched; its e2e--scopeispackages/python/dirsql+packages/rust/src, neither of which this diff touchespackages/ts/src+packages/rust/src+packages/ts/napipackages/python/e2e-attestation.jsonrefreshed ifpackages/pythonchanged — N/A, unchangedpackages/ts/e2e-attestation.jsonrefreshed ifpackages/tschanged — N/A, unchangedcargo test --manifest-path packages/rust/Cargo.toml --features cli --testsvtab::unreadable_file_yields_null_content_without_erroring_the_row, whichchmods a file unreadable and asserts NULL content. The hosted sandbox runs as uid 0, and root bypasses the permission bits, so the read succeeds and returnsSome("classified"). Pre-existing and environmental — this diff touches nosrc/; the same test passes in CI's non-root runner (both RED runs' only integration failures were the two new assertions).Manual exercise (AGENTS.md — tests aren't sufficient): built the real archive rather than trusting the listing.
Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package —packages/rust/changelog.d/2026-08-20-crate-excludes-fragment-dirs.md<root>/<pkg>/migrations.d/(or: not required — additive/bugfix only) — not required: no public API break, no deprecation removed, no runtime behavior change. Only files that never should have shipped stop shipping.PARITY.md: not updated — no SDK public API surface changes, so this neither introduces nor restores parity drift.