Repository navigation
fix(publish): retry the sigstore signing exchange and cap it with fetch-timeout - #13245
Conversation
The v11.17.0 release run aborted with ERR_PNPM_PROVENANCE_SIGN after a single dropped request to the sigstore timestamp authority (https://timestamp.sigstore.dev/api/v1/timestamp), even though the eight packages published before it signed fine. The TypeScript CLI signs through sigstore-js, which wraps every Fulcio / TSA / Rekor request in make-fetch-happen with its default retry policy (2 retries, factor 2, 1 s floor), so a transient sigstore hiccup never aborts a publish there. pacquet called sign_raw_statement exactly once, turning any single network flake into a failed release. Retry the whole signing exchange in the Host SignProvenance impl with the same policy. The exchange is idempotent (fresh ephemeral key, certificate, timestamp, and transparency-log entry per attempt), so re-running it is safe. The retry sits below the DI seam, matching where sigstore-js keeps it on the TypeScript side, so the generate_provenance contract and its fakes are unchanged. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
📝 WalkthroughWalkthroughThe publish crate now applies ChangesProvenance signing retries
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ProvenanceGeneration
participant sign_with_retry
participant SigningContext
ProvenanceGeneration->>sign_with_retry: sign statement with fetch-timeout
sign_with_retry->>SigningContext: signing attempt
SigningContext-->>sign_with_retry: success or failure
sign_with_retry->>sign_with_retry: timeout, warn, and exponential backoff
sign_with_retry-->>ProvenanceGeneration: signed bundle or final error
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoRetry sigstore provenance signing on transient publish failures
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains within the scope of the previous review threads. Reviews (4): Last reviewed commit: "refactor(publish): drop sign-retry doc c..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm/crates/publish/src/provenance_gen.rs`:
- Around line 145-174: The retry warning in sign_with_retry currently logs the
ProvenanceGenError display text without sanitization. Sanitize the rendered
error before passing it to tracing::warn!, reusing an existing redaction helper
such as redact_url_credentials where applicable or adding a provenance-specific
helper that removes embedded secret headers and URL credentials; preserve the
retry behavior and warning context.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 732f1d71-943b-417c-ae50-c5f6a721a8ac
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (4)
.changeset/retry-provenance-signing.mdpnpm/crates/publish/Cargo.tomlpnpm/crates/publish/src/provenance_gen.rspnpm/crates/publish/src/provenance_gen/tests.rs
Co-Authored-By: Claude Fable 5 <[email protected]>
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Default signing timeout too low
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The sigstore-rust clients build their reqwest clients with no request timeout, so a stalled connection hangs the publish until the OS drops the socket (~78 s in the failed v11.17.0 release run). sigstore-js instead runs every request under the caller's timeout option, which pnpm's TypeScript CLI wires to fetch-timeout (default 60 s), falling back to sigstore-js's 5 s default when unset. Mirror that: generate_provenance forwards fetch-timeout to the signer, and the Host impl caps each signing attempt with it (5 s fallback), converting an elapsed deadline into a retryable signing error so the existing retry loop picks it up. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 44e37b2 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit bab8385 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/publish/src/provenance_gen.rs (1)
151-154: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse regular comments only where they add implementation rationale.
pnpm/crates/publish/src/provenance_gen.rs#L151-L154: change///to//; this explains a private implementation decision, not a public API contract.pnpm/crates/publish/src/provenance_gen/tests.rs#L326-L327: remove the comment; the test name already states the behavior.As per coding guidelines, “Use rustdoc comments for public API contracts and regular comments for implementation rationale” and “Do not duplicate test behavior in documentation.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/publish/src/provenance_gen.rs` around lines 151 - 154, The comment near the provenance generation implementation is rationale for private behavior, so change its rustdoc markers to regular comments in pnpm/crates/publish/src/provenance_gen.rs lines 151-154. Remove the redundant behavior-explaining comment in pnpm/crates/publish/src/provenance_gen/tests.rs lines 326-327; the test name already documents the behavior.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/crates/publish/src/provenance_gen.rs`:
- Around line 151-154: The comment near the provenance generation implementation
is rationale for private behavior, so change its rustdoc markers to regular
comments in pnpm/crates/publish/src/provenance_gen.rs lines 151-154. Remove the
redundant behavior-explaining comment in
pnpm/crates/publish/src/provenance_gen/tests.rs lines 326-327; the test name
already documents the behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 43ce4bb3-fe75-423d-8a78-ef5636ef1d32
📒 Files selected for processing (4)
.changeset/retry-provenance-signing.mdpnpm/crates/publish/src/provenance_gen.rspnpm/crates/publish/src/provenance_gen/tests.rspnpm/crates/publish/src/publish_packed_pkg/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/retry-provenance-signing.md
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13245 +/- ##
==========================================
- Coverage 86.94% 86.92% -0.03%
==========================================
Files 528 528
Lines 90472 90516 +44
==========================================
+ Hits 78661 78678 +17
- Misses 11811 11838 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
The v11.17.0 release run (job 89266951584) failed with
ERR_PNPM_PROVENANCE_SIGNwhile publishing@pnpm/resolving.parse-wanted-dependency: a single request to the sigstore timestamp authority (https://timestamp.sigstore.dev/api/v1/timestamp) errored, and the whole publish aborted — after eight packages had already signed and published fine.The TypeScript CLI is not affected because it signs through sigstore-js, which runs every Fulcio / TSA / Rekor request under
make-fetch-happenwith its default retry policy (2 retries, factor 2, 1 s floor) and under the caller'stimeoutoption — which pnpm wires tofetch-timeout(default 60 s), with sigstore-js's own 5 s default as the fallback. pacquet calledsigstore_sign'ssign_raw_statementexactly once, with no retry and no request timeout (the sigstore-rust clients build barereqwest::Clients), so any transient sigstore network error killed the release, and a stalled connection hung until the OS dropped the socket (~78 s in the failed run).This PR closes both gaps:
SignProvenanceimpl retries the signing exchange with sigstore-js's policy. Thesigstore_signcrate issues each HTTP request once and exposes no per-request retry hook, so the retry wraps the boundary pacquet owns: the whole signing exchange. Every step of that exchange is idempotent (a fresh ephemeral key, certificate, timestamp, and transparency-log entry per attempt), so re-running it is safe.generate_provenanceforwardsfetch-timeoutto the signer, and each signing attempt runs under that deadline (5 s fallback when unset, matching sigstore-js'sDEFAULT_TIMEOUT). An elapsed deadline becomes a retryable signing error, so the retry loop picks it up instead of the publish hanging.Placing both below the DI seam mirrors where sigstore-js keeps them on the TypeScript side and leaves the
generate_provenancecontract and its test fakes unchanged (the fakes only gained the pass-throughtimeoutparameter).The retry loop reuses
pacquet_network::RetryOptsfor the backoff math (the retry module's docs already bless purpose-specific loops that reuseRetryOpts, e.g. the tarball fetcher);retry_asyncitself was not reused because its warn log line is specific to body-read failures and would mislead someone debugging a release. Retry warnings go throughtracingonly, not theRequestRetryreporter event, because the TypeScript CLI's sigstore retries are likewise invisible in the reporter stream — emitting the event here would diverge the two stacks' output.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting. (Rust-only:the TypeScript CLI already retries and applies
fetch-timeoutviasigstore-js; this brings pacquet to parity.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-fable-5).
Summary by CodeRabbit
New Features
Documentation