[GH-ISSUE #5186] [Bug] Historical capture finalization drops completed facts and loses cleanup retry attribution #3183

Closed
opened 2026-10-31 00:37:35 +00:00 by bsakaguchi · 1 comment
Owner

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

Before submitting

  • Searched open and closed issues for HistoricalCaptureDecoder cleanup and historical partial cleanup.
  • Removed credentials and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

SOURCE-ONLY at main 9aca543f46085f502dbc5445002e129e5d2974e9: HistoricalCaptureDecoder.inspect drops its completed capture report when cancellation occurs during private-root close. A rejected root close returns a new cleanup error without completed facts or a typed primary and without binding that returned error to the retained root’s exact cleanup lease. Confirmed owner retry can therefore leave the caller’s error marked incomplete.

The proposed regression tests execute an inert HAR decoder command and real private roots with a controlled close boundary; they establish retained results and retry behavior for the fix, not an unmodified-baseline runtime reproduction.

Reproduction

Inspect finalization at the pinned revision: the successful decoded report in result.value is not supplied to either error, and the failed release lease is not bound to the returned error. NOT_ENOUGH_INFO: no natural root-removal denial or baseline runtime reproduction was executed.

Expected behavior

Retain the completed capture under cancellation/cleanup, preserve earlier typed failures, and resolve cleanup status only when the exact retained owner confirms release. Shared application projection must apply the same record selection and explicit sensitivity rules to retained facts as to success.

Impact and scope

Source-derived loss of completed facts and stale cleanup diagnostics at historical decoder finalization. NOT_ENOUGH_INFO: real-world frequency, Windows/Bun behavior, or persistent resource leakage. Related #5144 fixes the same ownership pattern in process capture; this producer has a separate finalization path.

REA version

Source 9aca543f46085f502dbc5445002e129e5d2974e9, package 6.7.0.

Runtime and platform

Darwin arm64; proposed controlled regressions use pinned Node 24.18.0.

Target and artifact context

Authored inert HAR capture and local private decoder root; no browser target execution.

Interface

Other — shared historical decoder and application boundary.

Earliest failure stage

Cleanup, cancellation, or lifecycle.

Relevant output or evidence

Pinned source above establishes the dropped report and missing error-to-lease binding. New controlled regression coverage is in tests/boundary/browser/historicalCaptureDecoder.test.ts and src/application/WebNetworkCaptureService.test.ts; validation and fix commit will be recorded separately.

Typed outcome or recovery expected

Exact-reason cancellation or typed incomplete cleanup, with selected safe Evidence and live cleanup resources that clear after owner retry.

Analysis or suspected cause

Finalization constructs replacement errors from cleanup diagnostics instead of composing the prior typed outcome and binding the release lease. Repeated sensitivity projection also clones errors, so its clones must retain the same cleanup completion dependency with redacted live resource labels.

Additional context

Found while tracing #5089’s cancellation-reason pattern into historical capture consumers. #4227 is the lifecycle umbrella. This does not claim a defect in HAR decoding itself.

Originally created by @morluto on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5186 ## Before submitting - [x] Searched open and closed issues for HistoricalCaptureDecoder cleanup and historical partial cleanup. - [x] Removed credentials and sensitive target data. ## Area Evidence, artifacts, or reconstruction ## Observed behavior SOURCE-ONLY at main `9aca543f46085f502dbc5445002e129e5d2974e9`: `HistoricalCaptureDecoder.inspect` drops its completed capture report when cancellation occurs during private-root close. A rejected root close returns a new cleanup error without completed facts or a typed primary and without binding that returned error to the retained root’s exact cleanup lease. Confirmed owner retry can therefore leave the caller’s error marked incomplete. The proposed regression tests execute an inert HAR decoder command and real private roots with a controlled close boundary; they establish retained results and retry behavior for the fix, not an unmodified-baseline runtime reproduction. ## Reproduction Inspect [finalization at the pinned revision](https://github.com/morluto/rea/blob/9aca543f46085f502dbc5445002e129e5d2974e9/src/browser/history/HistoricalCaptureDecoder.ts#L299-L330): the successful decoded report in `result.value` is not supplied to either error, and the failed release lease is not bound to the returned error. NOT_ENOUGH_INFO: no natural root-removal denial or baseline runtime reproduction was executed. ## Expected behavior Retain the completed capture under cancellation/cleanup, preserve earlier typed failures, and resolve cleanup status only when the exact retained owner confirms release. Shared application projection must apply the same record selection and explicit sensitivity rules to retained facts as to success. ## Impact and scope Source-derived loss of completed facts and stale cleanup diagnostics at historical decoder finalization. NOT_ENOUGH_INFO: real-world frequency, Windows/Bun behavior, or persistent resource leakage. Related #5144 fixes the same ownership pattern in process capture; this producer has a separate finalization path. ## REA version Source `9aca543f46085f502dbc5445002e129e5d2974e9`, package 6.7.0. ## Runtime and platform Darwin arm64; proposed controlled regressions use pinned Node 24.18.0. ## Target and artifact context Authored inert HAR capture and local private decoder root; no browser target execution. ## Interface Other — shared historical decoder and application boundary. ## Earliest failure stage Cleanup, cancellation, or lifecycle. ## Relevant output or evidence Pinned source above establishes the dropped report and missing error-to-lease binding. New controlled regression coverage is in `tests/boundary/browser/historicalCaptureDecoder.test.ts` and `src/application/WebNetworkCaptureService.test.ts`; validation and fix commit will be recorded separately. ## Typed outcome or recovery expected Exact-reason cancellation or typed incomplete cleanup, with selected safe Evidence and live cleanup resources that clear after owner retry. ## Analysis or suspected cause Finalization constructs replacement errors from cleanup diagnostics instead of composing the prior typed outcome and binding the release lease. Repeated sensitivity projection also clones errors, so its clones must retain the same cleanup completion dependency with redacted live resource labels. ## Additional context Found while tracing #5089’s cancellation-reason pattern into historical capture consumers. #4227 is the lifecycle umbrella. This does not claim a defect in HAR decoding itself.
bsakaguchi 2026-10-31 00:37:35 +00:00
  • closed this issue
  • added the
    triage
    bug
    labels
Author
Owner

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

Fixed on main in 2e5171e391.

Historical decoder finalization now owns one completed outcome through cancellation and cleanup. It preserves exact cancellation reasons, completed capture facts, and earlier typed failures, and binds reader/root cleanup errors to their exact leases. The application uses one validated projection for success and retained captures, applying caller record selection and explicit sensitivity rules to Evidence. Completed raw reports are attached after error composition so nested diagnostics cannot duplicate unselected raw records.

Redaction now preserves cleanup dependencies and redacts live resource labels and typed primaries, including after a second redaction or successful owner retry. Tests cover late cancellation, simultaneous cancellation/failed close, reader/root denial and retry, safe selected partial Evidence, malformed retained output with live cleanup, and pending/resolved redacted projections. Real private roots and inert HAR decoding are used with controlled finalization failures.

Validation on pinned Node 24.18.0: 696 passed, 5 skipped across 67 selected files; full npm run check, npm run docs:check, and test discovery passed (1,632 files discovered exactly once). Controlled filesystem/final-close seams and loopback HTTP/WebSocket peers establish the described boundaries; no real Chrome/Electron target, natural OS close failure, Windows, or Bun qualification is claimed.

<!-- gh-comment-id:6260836143 --> @morluto commented on GitHub (Oct 19, 2026): Fixed on main in 2e5171e391b83f8a467d0861fd452c1f78621fd8. Historical decoder finalization now owns one completed outcome through cancellation and cleanup. It preserves exact cancellation reasons, completed capture facts, and earlier typed failures, and binds reader/root cleanup errors to their exact leases. The application uses one validated projection for success and retained captures, applying caller record selection and explicit sensitivity rules to Evidence. Completed raw reports are attached after error composition so nested diagnostics cannot duplicate unselected raw records. Redaction now preserves cleanup dependencies and redacts live resource labels and typed primaries, including after a second redaction or successful owner retry. Tests cover late cancellation, simultaneous cancellation/failed close, reader/root denial and retry, safe selected partial Evidence, malformed retained output with live cleanup, and pending/resolved redacted projections. Real private roots and inert HAR decoding are used with controlled finalization failures. Validation on pinned Node 24.18.0: 696 passed, 5 skipped across 67 selected files; full `npm run check`, `npm run docs:check`, and test discovery passed (1,632 files discovered exactly once). Controlled filesystem/final-close seams and loopback HTTP/WebSocket peers establish the described boundaries; no real Chrome/Electron target, natural OS close failure, Windows, or Bun qualification is claimed.
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#3183
No description provided.