Repository navigation
fix(captures): exclude normalized native numeric values - #7998
ShuaixinHuang wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The change affects retained evidence across the capture inspection workflow. Fix the large-list append before merging; it can reject valid captures during redaction. Findings
Fix with agent prompt### Issue 1
src/browser/history/HistoricalCaptureReply.ts:163
`projection.redactions.push(...redaction.redactions)` passes every new redaction as a separate argument. A native record with 200,000 copies of `1e-7` in a metadata array can fit the existing input and reply budgets. With `sensitive_values: ["1e-7"]`, Python retains those numbers because their producer spelling is `1e-07`. This pass then creates 200,000 redactions and exceeds Node's function-argument limit, rejecting an otherwise valid capture.
Append the entries with a loop instead.
```suggestion
for (const entry of redaction.redactions)
projection.redactions.push(entry);
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR checks native capture numbers against their JavaScript spelling before retaining Evidence.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Native capture] --> B[Python checks producer spelling]
B --> C[Reply schema checks]
C --> D[Check JavaScript number spelling]
D --> E[Replace matches with null]
E --> F[Remove numeric sidecars]
F --> G[Append redaction pointers]
G --> H[Retain Evidence]
Reviews (1) · Last reviewed commit: "fix(captures): exclude normalized native..." · Reviewed by Greptile |
| projection.numeric_literals = projection.numeric_literals.filter( | ||
| (number) => !excluded.has(number.pointer), | ||
| ); | ||
| projection.redactions.push(...redaction.redactions); |
There was a problem hiding this comment.
projection.redactions.push(...redaction.redactions) passes every new redaction as a separate argument. A native record with 200,000 copies of 1e-7 in a metadata array can fit the existing input and reply budgets. With sensitive_values: ["1e-7"], Python retains those numbers because their producer spelling is 1e-07. This pass then creates 200,000 redactions and exceeds Node's function-argument limit, rejecting an otherwise valid capture.
Append the entries with a loop instead.
| projection.redactions.push(...redaction.redactions); | |
| for (const entry of redaction.redactions) | |
| projection.redactions.push(entry); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/history/HistoricalCaptureReply.ts
Line: 163
Comment:
**Large redaction lists fail**
`projection.redactions.push(...redaction.redactions)` passes every new redaction as a separate argument. A native record with 200,000 copies of `1e-7` in a metadata array can fit the existing input and reply budgets. With `sensitive_values: ["1e-7"]`, Python retains those numbers because their producer spelling is `1e-07`. This pass then creates 200,000 redactions and exceeds Node's function-argument limit, rejecting an otherwise valid capture.
Append the entries with a loop instead.
```suggestion
for (const entry of redaction.redactions)
projection.redactions.push(entry);
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
This is a fresh resubmission of #7764 at the contributor's request. The human owner must re-review this current PR before formal maintainer review.
Problem and result
Native mitmproxy capture projection checked explicitly excluded numbers against Python's
repr, but the retained Evidence publishes JavaScript numbers. Thus1e-07becomes1e-7, and1e+20becomes100000000000000000000, reintroducing excluded literals1e-7or000000.The schema-validated reply boundary now checks the JavaScript spelling before Evidence retention, replaces matching values with null, removes their numeric sidecars and records the exact existing redaction pointer. It reuses the capture redaction owner, preserves unmarked values and producer literals, and leaves the bridge's original-literal exclusions intact. No schema, dependency, provider capability, target interaction or input mutation is introduced.
Related #2872 covers HAR/qlog projection; this addresses the separate Python/native reply boundary. Existing #2876 concerns headline indexing. Searches and current-main source checks found no equivalent native-number fix. No separate issue is needed for this directly reproduced correction.
Verification
Windows x64, pinned Node 24.22.1 / npm 11.16.0, base
60bad9ed:project_recordalso reproduces both retained spellings; its imports use the existing source-owned mitmproxy test stand-ins, with no live engine claim.__proto__data, root projections, unmarked producer literals, malformed JSON and invalid UTF-8.npm run checkcompleted 5/6 tasks, then ordinary Knip failed only on unchangedHexRecordRegionMetadata. An uncached Knip run with all six changed files restored to the exact base reproduces that sole failure; all working changes were restored afterward. Upstream fix: remove unused hex record metadata type #7718 already proposes that independent cleanup. This aggregate check is not green and that unrelated file is not changed here.The native Windows prerequisite is the existing verified REA 6.8.0 artifact (matching manifest and SHA-256), kept ignored. No external mitmproxy/browser run, Linux/macOS local run or full-suite pass is claimed. Hosted CI must validate this head independently.
Author readiness
Human owner: @ShuaixinHuang
Before merge