Skip to content

[codex] add sparse index diagnostics to cargo-mono publish#389

Closed
kdy1 wants to merge 1 commit intomainfrom
kdy1/cargo-mono-sparse-index-diagnostics
Closed

[codex] add sparse index diagnostics to cargo-mono publish#389
kdy1 wants to merge 1 commit intomainfrom
kdy1/cargo-mono-sparse-index-diagnostics

Conversation

@kdy1
Copy link
Copy Markdown
Contributor

@kdy1 kdy1 commented Apr 18, 2026

Summary

This PR adds phase-aware diagnostics to cargo mono publish sparse-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/swc unnecessarily 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=debug and get actionable sparse-index diagnostics including:

  • request URL and sparse index path
  • status code and allowlisted response headers
  • content type and content encoding
  • byte counts and short safe previews
  • flattened source-chain details for the underlying error

No publish retry policy, registry selection, concurrency behavior, or CLI surface changed.

Validation

  • git submodule update --init --recursive
  • cargo +stable test -p cargo-mono
  • cargo +stable test
  • Manual dry-run validation from /Users/kdy1/projects/swc with RUST_LOG=cargo_mono=debug CARGO_MONO_PUBLISH_PREFETCH_CONCURRENCY=1 ... to confirm the new sparse-index debug fields appear

Notes

The repository's pinned nightly toolchain currently fails early with Missing manifest in toolchain 'nightly-2026-01-01-aarch64-apple-darwin', so the default cargo test -p cargo-mono / cargo test commands could not be used in this environment. The stable-toolchain fallback passed cleanly.

@kdy1 kdy1 closed this Apr 18, 2026
@kdy1 kdy1 deleted the kdy1/cargo-mono-sparse-index-diagnostics branch April 18, 2026 09:26
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