Skip to content

fix(trace-viewer): pretty-print JSON without losing precision - #42297

Merged
Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
yury-s:fix-42261
Aug 19, 2026
Merged

fix(trace-viewer): pretty-print JSON without losing precision#42297
Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
yury-s:fix-42261

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • Pretty print in the network pane round-tripped bodies through JSON.parse/JSON.stringify, rounding integers beyond Number.MAX_SAFE_INTEGER (e.g. 64-bit ids) and normalizing literals like 1.0 and 1e3.
  • Preserve each number's source text via JSON.rawJSON, falling back to the previous behavior on engines without it (Baseline since March 2025: Chrome 114, Firefox 135, Safari 18.4).

References #42261

Pretty printing round-tripped the body through JSON.parse/JSON.stringify,
which turns every number into a double. Integers beyond
Number.MAX_SAFE_INTEGER were silently rounded and number literals were
normalized.

Keep the source text of each number via JSON.rawJSON, falling back to the
old behavior on engines that do not support it.

References microsoft#42261
@pavelfeldman

Copy link
Copy Markdown
Member

I don't think this is a good mitigation:

  • Either we suggest that users turn off application/json formatter for payloads that aren't parsed by the browser, or
  • Bring in the codemirror's formatter mod

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chrome] › mcp/config.spec.ts:203 › chromiumSandbox › --sandbox enables the sandbox @mcp-ubuntu-latest-chrome

8109 passed, 1341 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🟢 The one failure is a pre-existing flake — this PR looks clear

[chrome] › mcp/config.spec.ts:203 › chromiumSandbox › --sandbox enables the sandbox is the only failure, and it isn't yours. This PR only touches trace-viewer JSON number formatting; the MCP Chromium sandbox launch path is untouched, and across CI the same test flips verdict — it failed on unrelated PR #42294 (sha 4aa9163c) and passed on this branch. Nothing to fix here.

Details

Overall: the merged report lists 8109 passed, 1341 skipped, and a single failure. That failure has no plausible connection to the diff, and it fails on other people's SHAs too — so this PR is green.

Pre-existing flake / infra

  • [chrome] › mcp/config.spec.ts:203 › chromiumSandbox › --sandbox enables the sandbox @mcp-ubuntu-latest-chrome — flake. In the aggregated CI results this test flips final verdict across runs: it failed on PR fix(chromium): stop disabling BoundaryEventDispatchTracksNodeRemoval #42294 (sha 4aa9163c, 2026-08-18 17:42) and passed on this PR's own run (sha 4000f92b), same test on a SHA this PR can't be responsible for. The diff here is confined to networkResourceDetails.tsx (pretty-printing JSON via JSON.rawJSON) and its trace-viewer test — it never exercises MCP sandbox launching.

Triaged by the Playwright bot - agent run

@yury-s
Yury Semikhatsky (yury-s) merged commit c377b7f into microsoft:main Aug 19, 2026
40 of 44 checks passed
@yury-s
Yury Semikhatsky (yury-s) deleted the fix-42261 branch August 19, 2026 00:16
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.

3 participants