iter-126: canonical network JSON shape for navigate --with-network and network - #166
Merged
Merged
Conversation
…twork
`navigate --with-network` (and the standalone `network` command) returned an
inconsistent JSON shape: a `{entries, …}` object on busy pages but a bare array
on quiet ones, so `.results.network.entries` / `.total_requests` threw
`cannot index array` half the time, and the documented summary fields were
unreachable via `--jq` (which forces detail mode).
Introduce a shared `pub(crate) build_canonical_network` builder plus
`merge_summary_fields` in network.rs. `apply_network_controls` now returns ONE
canonical object on every path (busy/quiet, detail/summary, --all/default):
`{entries, shown, total, truncated, total_requests, total_transfer_bytes,
by_cause_type, slowest, timeout_reached, …}`. Summary counts always reflect the
full capture, never the truncated/field-projected view. The standalone
`network` detail envelope now carries the same summary fields alongside
`results` so `--jq` users can reach them.
Docs: args.rs help text documents the canonical shape with a bare-array
backward-compat note. Tests: 6 unit tests incl. a navigate/network parity
assertion, 3 new mock e2e tests, and 3 live tests in live_126_network_shape.rs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t note iter-126 inserted 6 lines earlier in args.rs (navigate/network help text), shifting the a11y-contrast `total` help-text line reference from 654 to 660. Also note the iter-126 parity-test / dogfood-compact-jq precedent as a design note so iter-127's fix pins exact field values, not just presence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
navigate --with-network(and the standalonenetworkcommand) returned an inconsistent JSON shape: a{entries, …}object on busy pages but a bare array on quiet ones..results.network.entries/.results.network.total_requeststhrewcannot index arrayhalf the time, and the documented summary fields were unreachable via--jq(which forces detail mode).pub(crate) build_canonical_network+merge_summary_fieldsbuilders innetwork.rs.apply_network_controlsnow returns a single object —{entries, shown, total, truncated, total_requests, total_transfer_bytes, by_cause_type, slowest, timeout_reached, …}— on busy/quiet, detail/summary,--all/default. Summary counts always reflect the full capture, never the truncated/field-projected view.networkdetail carries summary fields. The detail-mode envelope now merges the summary fields alongsideresults, so--jqusers are no longer cut off fromtotal_requests/total_transfer_bytes/slowest.args.rshelp text documents the canonical shape with a bare-array backward-compat note (both thenetworkoutput line and thenavigate --with-networklong_aboutsection).Test plan
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace -q— all clean (718 + 279 + … passing, 0 failures).cargo run -p xtask -- check-iteration-ready --plan kb/iterations/iteration-126-network-json-shape-consistency.md --base origin/main— 10/10 PASS (withFF_RDP_LIVE_TESTS=1).network_and_navigate_summary_fields_agree_field_for_field), truncation-math, and empty-page key-presence.navigate_with_network_detail_mode_is_object_not_array,..._all_keeps_object_shape, summary fields innetwork_detail_shows_requests).live_126_network_shape.rscovering the quiet/busy shape parity,--all, and standalonenetwork --jqsummary carry.{"t":"array","n":1,"truncated":false}; wikipedia (busy, 118 req) →{"t":"array","n":118,"shown":20,"truncated":true}— identical key sets, no shape flip; standalonenetwork --jqreturnstotal_requests: 118, total_transfer_bytes: 2025146.0.🤖 Generated with Claude Code## Claims vs code
<generated 2026-07-19T15:54:57Z by ralph-loop>
No claims extracted from commit messages.