[GH-ISSUE #2609] fix(browser): retain request inventory changes with unavailable shapes #927

Closed
opened 2026-10-15 18:29:38 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @coygeek on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2609

Summary

Offline comparison of normalized captures with complete request inventories omits request additions and removals when selected JSON body shapes are unavailable. The missing shape evidence prevents the comparator from returning a proven inventory difference, even though request coverage is explicitly complete in both accepted inputs.

Steps to reproduce

  1. At the source baseline below, start with the single-script page-inspection fixture in src/domain/webBundleAnalyzer.test.ts. Set completeness.status to "complete_within_window", set completeness.conditions to ["complete_within_window"], clear attach_limited_sections, and leave network and WebSocket inventory coverage complete.
  2. Put this request in the first inspection's network inventory. Leave JSON shapes selected by having no json_body_shapes exclusion with reason not_approved.
{
  request_id: "request-a",
  url: "https://app.example.test/a",
  origin: "https://app.example.test",
  method: "GET",
  resource_type: "Document",
  status: 200,
  mime_type: "text/html",
  encoded_data_length: 10,
  initiator: {type: "parser", url: null, line: null, column: null},
  body_shapes: {status: "unavailable", request: null, response: null}
}
  1. Clone that inspection and add an otherwise identical request with ID request-b and URL https://app.example.test/b. Keep WebSocket inventories empty.
  2. Parse {before: {inspection: before}, after: {inspection: after}} with compareWebCapturesInputSchema, call compareWebCaptures, and inspect dimensions.network. Reverse the inputs to test removal.

Expected behavior

Complete request inventories establish whether the second request was added or removed. The network dimension should report that observed inventory change without asserting body-shape equality or treating unavailable shapes as observed shape differences.

Actual behavior

Both directions returned unknown with zero changes and a reason that network capture or selected shape coverage was incomplete. The production comparison provider also accepted the union-schema input and returned that unknown network result. With shape capture marked unselected in the same fixtures, the comparison returned changed with one added request. Identical selected-unavailable inputs stayed unknown.

Evidence

  • Expected source: src/domain/webCaptureDiff.ts:39-44 distinguishes observed changes from incomplete absence proofs; docs/browser-observation.md:176 says unavailable selected shape coverage makes equivalence unknown while observed differences still report changed; src/domain/browserCaptureComparison.ts:17-49 accepts and dispatches normalized passive captures.
  • Failure source: src/domain/webCaptureDiff.ts:313-321,354-363 folds shape coverage into inventory completeness, then src/domain/webCaptureDiff.ts:74-76 suppresses added and removed request identities. src/browser/CdpBrowserProvider.ts:260-271 returns the same result through the production comparison adapter.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

A focused test first checked the domain comparator, then reran with the production union-schema/provider acceptance check. Each run passed one observation test while asserting the faulty results and controls. This is a complete offline normalized-input reproduction. Current live CDP capture starts with attach-limited network inventory at src/browser/CdpCaptureEvents.ts:39-45; a live capture with complete inventory was not produced or claimed. The JSON-shape producer can represent the shown unavailable state for non-JSON requests, but that alone does not establish complete inventory coverage. CLI and MCP transport were not exercised.

Restoration check

For the complete-inventory fixtures, report the added and removed request while preserving uncertainty about unavailable shapes. Keep identical selected-unavailable inputs unknown and retain the unselected-shape control. Keep the unavailable, partial, and truncated shape controls in tests/boundary/browser/cdpJsonShapeComparison.test.ts:181-216 and do not infer request absence when inventory coverage itself is limited.

Runtime or environment

Source revision: 8b181716ac. Node.js v26.10.0, npm 11.19.1, and lockfile-installed dependencies. Inputs are schema-valid normalized capture fixtures, not newly recorded live-page captures.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: Accepted complete-inventory inputs lose proven request additions and removals from offline comparison. Other independently modified metadata may still report changed. Population frequency and live-page reachability were not established.
  • Workaround status: unverified
  • Workaround basis: Marking shapes unselected reports the inventory change in the control, but it removes caller-selected shape evidence and was not verified as an equivalent practical workaround.
Originally created by @coygeek on GitHub (Oct 13, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2609 ## Summary Offline comparison of normalized captures with complete request inventories omits request additions and removals when selected JSON body shapes are unavailable. The missing shape evidence prevents the comparator from returning a proven inventory difference, even though request coverage is explicitly complete in both accepted inputs. ## Steps to reproduce 1. At the source baseline below, start with the single-script page-inspection fixture in `src/domain/webBundleAnalyzer.test.ts`. Set `completeness.status` to `"complete_within_window"`, set `completeness.conditions` to `["complete_within_window"]`, clear `attach_limited_sections`, and leave network and WebSocket inventory coverage complete. 2. Put this request in the first inspection's network inventory. Leave JSON shapes selected by having no `json_body_shapes` exclusion with reason `not_approved`. ```js { request_id: "request-a", url: "https://app.example.test/a", origin: "https://app.example.test", method: "GET", resource_type: "Document", status: 200, mime_type: "text/html", encoded_data_length: 10, initiator: {type: "parser", url: null, line: null, column: null}, body_shapes: {status: "unavailable", request: null, response: null} } ``` 3. Clone that inspection and add an otherwise identical request with ID `request-b` and URL `https://app.example.test/b`. Keep WebSocket inventories empty. 4. Parse `{before: {inspection: before}, after: {inspection: after}}` with `compareWebCapturesInputSchema`, call `compareWebCaptures`, and inspect `dimensions.network`. Reverse the inputs to test removal. ## Expected behavior Complete request inventories establish whether the second request was added or removed. The network dimension should report that observed inventory change without asserting body-shape equality or treating unavailable shapes as observed shape differences. ## Actual behavior Both directions returned unknown with zero changes and a reason that network capture or selected shape coverage was incomplete. The production comparison provider also accepted the union-schema input and returned that unknown network result. With shape capture marked unselected in the same fixtures, the comparison returned changed with one added request. Identical selected-unavailable inputs stayed unknown. ## Evidence - Expected source: `src/domain/webCaptureDiff.ts:39-44` distinguishes observed changes from incomplete absence proofs; `docs/browser-observation.md:176` says unavailable selected shape coverage makes equivalence unknown while observed differences still report changed; `src/domain/browserCaptureComparison.ts:17-49` accepts and dispatches normalized passive captures. - Failure source: `src/domain/webCaptureDiff.ts:313-321,354-363` folds shape coverage into inventory completeness, then `src/domain/webCaptureDiff.ts:74-76` suppresses added and removed request identities. `src/browser/CdpBrowserProvider.ts:260-271` returns the same result through the production comparison adapter. - Evidence provenance: observed - Local verification: reproduced - Reproduction completeness: complete A focused test first checked the domain comparator, then reran with the production union-schema/provider acceptance check. Each run passed one observation test while asserting the faulty results and controls. This is a complete offline normalized-input reproduction. Current live CDP capture starts with attach-limited network inventory at `src/browser/CdpCaptureEvents.ts:39-45`; a live capture with complete inventory was not produced or claimed. The JSON-shape producer can represent the shown unavailable state for non-JSON requests, but that alone does not establish complete inventory coverage. CLI and MCP transport were not exercised. ## Restoration check For the complete-inventory fixtures, report the added and removed request while preserving uncertainty about unavailable shapes. Keep identical selected-unavailable inputs unknown and retain the unselected-shape control. Keep the unavailable, partial, and truncated shape controls in `tests/boundary/browser/cdpJsonShapeComparison.test.ts:181-216` and do not infer request absence when inventory coverage itself is limited. ## Runtime or environment Source revision: 8b181716aca2cb467be499cba226abfb5ae19141. Node.js v26.10.0, npm 11.19.1, and lockfile-installed dependencies. Inputs are schema-valid normalized capture fixtures, not newly recorded live-page captures. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: Accepted complete-inventory inputs lose proven request additions and removals from offline comparison. Other independently modified metadata may still report changed. Population frequency and live-page reachability were not established. - Workaround status: unverified - Workaround basis: Marking shapes unselected reports the inventory change in the control, but it removes caller-selected shape evidence and was not verified as an equivalent practical workaround.
bsakaguchi 2026-10-15 18:29:38 +00:00
Author
Owner

@morluto commented on GitHub (Oct 14, 2026):

Addressed on main in bffdd91053fb5d076b762cf1b325e8dcb5ab2d8c.

Network inventory membership completeness is separated from selected body-shape completeness, preserving known request changes.

Validation: Affected suites passed in the merged 65-file run (1169 passed, 2 explicit skips), with full static/architecture checks and documentation checks passing. Final installed-package verification is recorded separately in the audit.

Verification scope: Controlled source and production-boundary verification on macOS with pinned Node 24.18.0; real external engines and Windows hosts were not independently rerun. Closure covers the described source defect, not broader provider conformance or performance.

<!-- gh-comment-id:6159216405 --> @morluto commented on GitHub (Oct 14, 2026): Addressed on main in [bffdd91053fb5d076b762cf1b325e8dcb5ab2d8c](https://github.com/morluto/rea/commit/bffdd91053fb5d076b762cf1b325e8dcb5ab2d8c). Network inventory membership completeness is separated from selected body-shape completeness, preserving known request changes. Validation: Affected suites passed in the merged 65-file run (1169 passed, 2 explicit skips), with full static/architecture checks and documentation checks passing. Final installed-package verification is recorded separately in the audit. Verification scope: Controlled source and production-boundary verification on macOS with pinned Node 24.18.0; real external engines and Windows hosts were not independently rerun. Closure covers the described source defect, not broader provider conformance or performance.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#927
No description provided.