refactor(observation): internalize capture budgets

This commit is contained in:
morluto
2026-09-29 12:16:10 +08:00
parent 8c24272ee7
commit 7b3c797237
24 changed files with 202 additions and 466 deletions
+4 -3
View File
@@ -118,8 +118,9 @@ rea capture-web-screenshot http://127.0.0.1:9222 TARGET_ID \
```
The omitted observation window and capture options use conservative defaults.
Set an option only when the investigation needs that additional content; use
the `limits` object to override bounded collection budgets.
Set an option only when the investigation needs that additional content.
Collection budgets are applied internally and cannot be changed per call;
truncated sections and dropped counts make incomplete captures explicit.
Call `list_browser_targets` first because target IDs are browser-instance-specific. REA rechecks the selected target's current type and origin immediately before attaching.
@@ -146,7 +147,7 @@ prove static module ownership.
## Completeness and limits
The default observation window is 500 ms and the maximum is 10 seconds. Frames (200), DOM nodes (2,000), accessibility nodes (2,000), scripts (200), resources (2,000), workers (500), and each storage key/name inventory (1,000) have conservative defaults and caller-visible hard bounds. Script source bytes, network events, console events, and WebSocket events are bounded separately. The CLI exposes the same limits as kebab-case options such as `--max-frames` and `--max-storage-keys`.
The default observation window is 500 ms and the maximum is 10 seconds. Frames (200), DOM nodes (2,000), accessibility nodes (2,000), scripts (200), resources (2,000), workers (500), and each storage key/name inventory (1,000) have internal collection budgets. Script source bytes, network events, console events, and WebSocket events are bounded separately. These budgets are fixed by REA rather than caller-configurable; results identify truncated sections and dropped counts.
Every result distinguishes `complete_within_window`, `policy_filtered`, `attach_limited`, and `truncated` coverage. It names affected sections and reports sparse excluded-item and per-event-type dropped counts rather than implying exhaustive capture. Disallowed-origin entries are filtered before collection-limit accounting, so they cannot consume an approved origin's output budget.
+2 -2
View File
@@ -50,8 +50,8 @@ inventories authorized worker, service-worker, and shared-worker targets with
bounded opener-target and parent-frame IDs. Worker discovery uses passive
target metadata; REA does not attach to or execute code in those targets.
The default worker limit is 500 and the caller-visible maximum is 5,000. Like
every target, frame, script, and resource, a worker URL must resolve beneath an
The worker collection budget is 500 and is applied internally. Like every
target, frame, script, and resource, a worker URL must resolve beneath an
approved canonical root before it is retained. Relationship IDs improve
attribution but do not prove which static module started a worker or that its
work completed.
+4 -4
View File
@@ -79,10 +79,10 @@ targets belong to the same Electron application.
## Bounds and determinism
Every observation commits the window and exact limits for events, scripts,
execution contexts, per-location bytes, and total retained metadata bytes.
Limit hits increment dropped-event counts and set `capture.truncated`; they
never become completeness claims. Scripts are authorized after capture,
Every observation records the window and effective internal collection bounds
for events, scripts, execution contexts, per-location bytes, and total retained
metadata bytes. These bounds are not caller-configurable. Limit hits increment
dropped-event counts and set `capture.truncated`; they never become completeness claims. Scripts are authorized after capture,
deduplicated by stable metadata, and canonically sorted. Wall-clock timestamps
and protocol script IDs are excluded from the durable result, so identical
inputs and captured metadata produce the same Evidence ID.