Skip to content

fix(retry): snapshot trace metadata - #239

Merged
ronag merged 4 commits into
mainfrom
codex/retry-trace-metadata-snapshot
Jul 11, 2026
Merged

fix(retry): snapshot trace metadata#239
ronag merged 4 commits into
mainfrom
codex/retry-trace-metadata-snapshot

Conversation

@ronag

@ronag ronag commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • lazily capture the retry trace writer and logical request id/method/bounded url on the first retry decision
  • prevent a custom retry strategy from moving undici:retry docs to mutated options before it invokes defaultRetry()
  • keep retry docs correlated with the immutable undici:request start/end pair without adding trace work to successful retry-eligible requests

Tests

  • adds a focused regression that mutates id, method, origin, and path before calling defaultRetry()
  • verifies the retry doc and request pair retain one identity
  • verifies a successful request that never retries does not read opts.trace
  • focused retry/trace matrix: 225 assertions passing
  • ESLint, Prettier, and git diff --check pass

ronag added 2 commits July 11, 2026 22:08
…adata-snapshot

* origin/main:
  fix(verify): snapshot trace metadata
  fix(body-factory): support on/off signals
  fix(body-factory): abort while queued

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures undici:retry trace documents remain correlated with the immutable undici:request start/end trace identity even when a custom retry strategy mutates the live request options before calling defaultRetry().

Changes:

  • Snapshot retry trace identity (id/method/bounded url) and trace writer once for use by retry trace emission.
  • Update retry trace emission to use the captured snapshot rather than live (mutable) dispatch options.
  • Add a regression test that mutates id, method, origin, and path inside a custom retry() callback and asserts trace correlation remains stable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/trace-retry-metadata-snapshot.js Adds regression coverage ensuring retry callback mutations do not break request/retry trace correlation.
lib/interceptor/response-retry.js Captures trace identity/writer and emits undici:retry docs from the snapshot to preserve correlation under mutated opts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/interceptor/response-retry.js Outdated
ronag added 2 commits July 11, 2026 22:18
…adata-snapshot

* origin/main:
  docs(dns): describe policy-scoped deduplication
  test(dns): yield during trace polling
  fix(url): validate object authorities
  fix(url): reject malformed object protocols
  perf(dns): streamline TTL policy keys
  refactor(pressure): rely on Node timer API
  fix(dns): scope cache by TTL policy

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@ronag
ronag merged commit 58140e8 into main Jul 11, 2026
1 check passed
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.

2 participants