Skip to content

feat(browser): capture correlated network content and lifecycle evidence - #797

Merged
N0zoM1z0 merged 3 commits into
mainfrom
feat/website-network-evidence
Oct 6, 2026
Merged

N0zoM1z0 merged 3 commits into
mainfrom
feat/website-network-evidence

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

First implementation batch for the website reverse-engineering roadmap. Refs #774; the roadmap remains open for captured assets and later integrations.

  • Correlate request, response, completion, failure, and cutoff observations by capture-scoped request identity, including observed redirect predecessors.
  • Select request bytes, response bytes, and header values independently with capture.network. Defaults keep metadata alone; selected content also enables network observation.
  • Keep network readers and transaction collection in src/browser/network/, separate from event orchestration and provider-neutral evidence schemas.
  • Return exact retained base64 bytes, count, SHA-256, media type, redaction status, and source event references. Preserve duplicate headers; remove credential header values and caller-declared secret representations without decoding unrelated binary bytes.
  • Drain completed reads before cleanup, bound each read to five seconds, honor cancellation, and mark unfinished/unavailable responses explicitly. No refetch substitutes for the original response.
  • Compare content under matching selection and source-step attribution. Selection differences and unknown legacy network coverage return unknown with recovery guidance.

Example (CLI and MCP use the same object)

{
  "browser": { "mode": "launch", "executable_path": "/absolute/path/to/chromium" },
  "start_url": { "url": "http://127.0.0.1:3000" },
  "actions": [{ "step_id": "ready", "action": "wait_for", "locator": { "kind": "css", "selector": "#done" }, "state": "visible", "timeout_ms": 10000 }],
  "capture": { "network": { "request_body": true, "response_body": true, "header_values": true } }
}

Content records link to observed request/response events through transaction_id and source_event_sequence. Request bytes reflect what Playwright exposes; not_exposed does not prove absence or multipart file completeness. Responses contain browser-decoded bytes. Playwright scenario capture has no initiator-stack API; passive CDP retains its separate initiator evidence.

Verification

Linux x64, locally installed Chrome 153.0.8010.12, Node 24.18.0. Commands ran with one CPU and a bounded Node heap.

  • Focused source suite: 41 tests / 6 files covering schema integrity, concurrent same-URL association, redirects, binary/encoded-secret redaction, duplicate headers, independent selection, cutoff, cancellation, timeout/late completion, failures, empty/unexposed bytes, and comparison coverage.
  • npm run test:focused -- tests/boundary/mcp/toolSchemaValidity.test.ts tests/boundary/mcp/browserScenarioMcp.test.ts tests/boundary/cli/browserCli.test.ts: 8 tests passed, including every advertised canonical JSON Schema.
  • npm run check:fast, npm run docs:check, and git diff --check: passed.
  • Full real browser lane: passed passive analysis/source maps, launch/attach lifecycle, popup/shared-context isolation, and real PNG >8 MiB. New network oracle proved CLI/MCP content and connected-browser survival.
  • Final network oracle also passed against an npm-packed, separately installed package under /tmp, with lifecycle scripts disabled. This checked the final selection metadata, actual binary and gzip-decoded bytes, form/encoded-header redaction, redirects, streaming cutoff, no refetches, and profile cleanup through CLI/MCP.
  • The server-authored marker oracle rejects deliberately swapped same-URL response IDs. A form-encoding regression was observed failing before the redactor fix and passes afterwards.

The focused installed-package verifier observed zero live descendants at completion. The mixed full browser verifier's in-run lineage report was explicitly unavailable because a Chrome descendant omitted its run token; that recorded PID was gone after cleanup. These reports establish different observations.

Real Hopper/Ghidra verification was not run for this browser change.

CI follow-up

  • Corrected complete documented request and normalized capture-default assertions caught by CI; 38 focused tests passed.
  • Encoded body media-type metadata regression now passes; collector coverage is 15 tests.
  • Updated the continuously polling fixture oracle to accept only explicit request-unfinished cutoff coverage, reject other gaps, and retain detailed failure states. Full real browser verification passed again (launch and external attachment, CLI/MCP, network content, popups, screenshots).

Keep request identities and redirect relationships across ordered scenario events.
Capture selected browser-exposed bytes and duplicate headers through modular
readers, settle bounded reads before cleanup, and preserve unavailable states.
Keep content-selection mismatches and legacy network coverage unknown during
comparison. Verify real CLI/MCP, installed package, and browser lifecycle paths.

Refs #774

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Correct the complete documented request and legacy default expectation caught by CI. Cover and redact encoded declared values in captured body media types.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Accept incomplete event coverage only when the continuously polling fixture has explicit unfinished requests; retain failures for other missing or truncated sections. Include actual completeness and unfinished transactions in diagnostics.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
@N0zoM1z0
N0zoM1z0 merged commit f9eaf05 into main Oct 6, 2026
20 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/website-network-evidence branch October 6, 2026 20:35
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…nce (morluto#797)

* feat(browser): capture correlated network content and lifecycle evidence

Keep request identities and redirect relationships across ordered scenario events.
Capture selected browser-exposed bytes and duplicate headers through modular
readers, settle bounded reads before cleanup, and preserve unavailable states.
Keep content-selection mismatches and legacy network coverage unknown during
comparison. Verify real CLI/MCP, installed package, and browser lifecycle paths.

Refs morluto#774

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* fix(browser): align capture defaults and redact encoded media metadata

Correct the complete documented request and legacy default expectation caught by CI. Cover and redact encoded declared values in captured body media types.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)

* test(browser): verify polling capture cutoff completeness

Accept incomplete event coverage only when the continuously polling fixture has explicit unfinished requests; retain failures for other missing or truncated sections. Include actual completeness and unfinished transactions in diagnostics.

Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
@morluto morluto added enhancement New feature or request area: runtime Process capture and runtime observation labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants