fix(trace-viewer): pretty-print JSON without losing precision - #42297
Conversation
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
|
I don't think this is a good mitigation:
|
Test results for "MCP"1 failed 8109 passed, 1341 skipped Merge workflow run. |
|
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
DetailsOverall: 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
Triaged by the Playwright bot - agent run |
c377b7f
into
microsoft:main
Summary
JSON.parse/JSON.stringify, rounding integers beyondNumber.MAX_SAFE_INTEGER(e.g. 64-bit ids) and normalizing literals like1.0and1e3.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