Repository navigation
feat(native-network-logs): one compact row per request by default - #1413
blazejkustra wants to merge 6 commits into
Conversation
The tool returned the raw Network.* events, mostly dataReceived chunks, so a screen of traffic came back as a wall of text that could overflow the tool output limit while still not listing every request. Default to one row per request (method, url, status, mimeType, bytes, durationMs, error), with limit counting requests; format: "events" keeps the raw stream.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
There was a problem hiding this comment.
[Diplomat, Opus 5.5]: Ran this branch's tool-server E2E on an iOS 18.5 simulator. The Bloom dev-client hit a local server with redirect, 500, refused, slow and multi-MB endpoints, and I read both formats after each run. Covered claims vs code against the dylib's emitter (NetworkInspector.m / NativeDevtoolsURLProtocol.m), the JS and Chromium twins, non-happy paths, inputs, the 1000-event buffer, the merge with #1402, and mutations across the new branches. Findings are inline.
Two problems outside this diff that came up along the way are filed separately: #1424 (the network docs say Metro traffic is removed, but on the native layer it is not) and software-mansion/argent-private#47 (the dylib sends no terminal event for a cancelled request).
…request rows - finalUrl when the response came from another URL; url stays what the app asked for - failed requests keep bytes and durationMs - truncated: true once the log hit its 1000-event limit - format no longer required in the params type - describe what each format carries (request bodies, never response bodies) - execute-level tests for format, limit, totalRequests, clear and truncated
latekvo
left a comment
There was a problem hiding this comment.
[Diplomat, Opus 5.5]: Re-ran the review at 5369d35. I built the head, then ran the three native-network test files (97/97) and typecheck:tests. I checked the descriptions and docs against the dylib's emitter in argent-private (NetworkInspector.m and NativeDevtoolsURLProtocol.m) and against the view-network-logs twin. I also covered non-happy paths and inputs, reachability, the ring buffer and clear lifetime, and a local merge with main and #1402 (typecheck and tests pass). I ran 18 mutants across the new branches; the 4 survivors not raised below cannot be reached from the dylib's events. The earlier redirect, failure, buffer, stale-comment and typecheck findings are addressed. What remains is inline, plus replies on two earlier threads.
# Conflicts: # packages/docs/docs/features/network.mdx # packages/tool-server/src/tools/native-devtools/native-network-logs.ts
…quest rows - finalUrl only for a real redirect: compare parsed URLs, skip rows with no url - truncated: true only once the log evicted events, not when it is merely full - limit is a non-negative integer, and limit 0 returns no rows - say that most request bodies are missing and that clear drops the headers - tests for clear-after-read, fractional timestamps and limit 0
Problem
native-network-logsreturned raw events: several per request, plus many data chunks. While an Expo app loaded, its 32 requests came back as 220 events, 131 KB of text for the agent to piece together.Approach
The events are now folded into one row per request (method, URL, status, type, size, duration). This is the new default;
format: "events"keeps the old raw output.Tests
eventsmust now passformat: "events".urland addsfinalUrl; a failed request keepsbytesanddurationMs; the tool returns rows by default, raw events withformat: "events", the most recent requests underlimit, clears only when asked, and setstruncated: trueonce the log holds its 1000-event limit. Each fails with its fix reverted.typecheck:tests, eslint, prettier and knip pass.docusaurus buildpasses.executeand the description: whichever merges second keeps fix(native-network-logs): capture the launch after restart_required #1402's capture order and adds itsnoteto the rows result too.formatis optional in the params type, so fix(native-network-logs): capture the launch after restart_required #1402's new tests typecheck unchanged.Screenshots
No video: the change is in the text the tool returns. Two of the 32 new rows:
{ "requestId": "67824E57-…", "method": "GET", "url": "http://localhost:8086", "status": 200, "mimeType": "multipart/mixed", "bytes": 6726, "durationMs": 552 } { "requestId": "DEC1C1C8-…", "method": "GET", "url": "http://127.0.0.1:8086/index.ts.bundle?platform=ios&…", "status": 200, "mimeType": "multipart/mixed", "bytes": 23619397, "durationMs": 158 }Before, the same requests arrived as
requestWillBeSent(about 900 characters each),responseReceived, a run ofdataReceivedchunks andloadingFinished.