Skip to content

fix(captures): exclude normalized native numeric values - #7998

Closed
ShuaixinHuang wants to merge 1 commit into
morluto:mainfrom
ShuaixinHuang:codex/resubmit-native-numeric-v2
Closed

ShuaixinHuang wants to merge 1 commit into
morluto:mainfrom
ShuaixinHuang:codex/resubmit-native-numeric-v2

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

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. Thus 1e-07 becomes 1e-7, and 1e+20 becomes 100000000000000000000, reintroducing excluded literals 1e-7 or 000000.

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:

  • Before the fix, two new reply regressions fail and seven controls pass. The actual Python project_record also reproduces both retained spellings; its imports use the existing source-owned mitmproxy test stand-ins, with no live engine claim.
  • Five complete related files: 202 passed, covering reply admission, HAR/qlog, the application service and MCP contracts. Includes numeric-sidecar omission, escaped pointers, arrays, own __proto__ data, root projections, unmarked producer literals, malformed JSON and invalid UTF-8.
  • The selected production-decoder boundary regression passes using real owned Node subprocesses, marked/unmarked controls and unchanged capture bytes. The other 38 boundary cases were unselected; this is a controlled producer, not mitmproxy engine verification.
  • The existing Linux real-provider verifier now exercises both number spellings, marked/unmarked, through compiled CLI and MCP using upstream mitmproxy 12.2.3 fixtures. JavaScript/Python syntax is checked locally; the real Linux engine lane was not run locally and must be established by hosted CI.
  • npm run check completed 5/6 tasks, then ordinary Knip failed only on unchanged HexRecordRegionMetadata. 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.
  • Architecture/module boundaries, production reachability reporting and typed lint passed separately. Normal pre-commit hooks and pre-push typecheck/lint passed (2/2 tasks).

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

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • One reproduced problem within existing offline capture inspection.
  • Explicit exclusions, original inputs, Evidence pointers and unmarked controls retained.
  • Related source/application/MCP and controlled-producer regressions checked.
  • Real-provider verification gap and independent baseline failure disclosed.
  • Current-head hosted code CI, title and human readiness complete.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T05:37:35.217907Z
We couldn’t complete this review. Comment @codex review to try again.
e3adff7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P1 Large redaction lists fail ▶
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.

Summary

The PR checks native capture numbers against their JavaScript spelling before retaining Evidence.

  • Native capture replies redact marked numbers using their JavaScript spelling.

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]
Loading

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Suggested change
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.

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.

1 participant