Skip to content

Network log: response body silently dropped when entry rotates out before fetchRequestBodyUpdate arrives #1390

Description

@cliffhall

Problem

FetchRequestLogState.onFetchRequestBodyUpdate patches the response body onto the matching entry by id:

const idx = this.fetchRequests.findIndex((e) => e.id === id);
if (idx === -1) return; // silent no-op

The body read is deferred (fire-and-forget tee'd stream in fetchTracking.ts). On a chatty transport log, if ≥maxFetchRequests (default 1000) newer requests arrive between the fetchRequest append and the deferred fetchRequestBodyUpdate, the original entry is evicted by rotation, so the update finds idx === -1 and silently drops the body. The user sees (empty) in the Response Body section with no way to tell "body never came back" from "body was dropped after eviction."

Not a correctness bug (the entry is gone anyway) and irrelevant for auth traffic (sparse), but invisible.

Suggested fix

Emit a logger.debug at the early-return site so the drop is traceable — blocked on a logger being plumbed into the state managers (they don't have one today). Track that dependency here.

Context

Surfaced in the 7th-pass review of #1387 (#1386), which introduced the auth body-capture path. Out of scope for that PR.

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions