[codex] add sparse index diagnostics to cargo-mono publish#389
Closed
[codex] add sparse index diagnostics to cargo-mono publish#389
Conversation
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
This PR adds phase-aware diagnostics to
cargo mono publishsparse-index prefetching so we can tell whether failures happen during the request, response-status handling, body read/decompression, UTF-8 decoding, or JSON-line parsing.It also keeps the existing operator-facing warning compact while enriching the stored error details with low-noise context such as the sparse path, HTTP status, safe response metadata, and the flattened error source chain.
Why
We were seeing sparse-index prefetch failures that only surfaced as
failed to read sparse index response body: error decoding response body, which made debugging publish issues in downstream workspaces like/Users/kdy1/projects/swcunnecessarily hard.The root cause was that the prefetch path used
response.text()directly, which collapsed multiple failure modes into a single read/decode step and dropped most of the response context that would explain what actually went wrong.Impact
Maintainers can now rerun publish commands with
RUST_LOG=cargo_mono=debugand get actionable sparse-index diagnostics including:No publish retry policy, registry selection, concurrency behavior, or CLI surface changed.
Validation
git submodule update --init --recursivecargo +stable test -p cargo-monocargo +stable test/Users/kdy1/projects/swcwithRUST_LOG=cargo_mono=debug CARGO_MONO_PUBLISH_PREFETCH_CONCURRENCY=1 ...to confirm the new sparse-index debug fields appearNotes
The repository's pinned nightly toolchain currently fails early with
Missing manifest in toolchain 'nightly-2026-01-01-aarch64-apple-darwin', so the defaultcargo test -p cargo-mono/cargo testcommands could not be used in this environment. The stable-toolchain fallback passed cleanly.