mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 18:06:46 +00:00
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry Introduce one domain-owned TargetFailure value whose kind alone derives the public code, category, retryability, recovery and details, for CLI and MCP alike. Selected-file malformed and truncated refusals are the first area on it: AnalysisMalformedTargetError is replaced by AnalysisTargetFailureError, and ParseFailure's byte-structure variants are TargetFailure variants rather than a parallel type. The shared stableArtifactParserFailureCli loop is replaced by a declarative registry (tests/support/targetFailure/readers/*.ts) and one generated suite that runs every registered case through the CLI and MCP. BREAKING CHANGE: selected-file malformed and truncated refusals add details.failure_kind, and a truncated target's remediation now says to re-acquire the complete file instead of choosing another target. Codes are unchanged. Affected operations: every operation that refuses a selected file's malformed or truncated bytes, including the ELF, PE, Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel module, binary hardening, managed PE/CLI and IL2CPP readers. * test(managed): name the target failure error in the merged status test * docs(reference): name the error CSV instead of linking a non-page file * fix(tests): expect the path reason for non-regular dyld inputs #14225 refuses a non-regular dyld input as ArtifactReaderFailure("path"); dylibFileLifetime still expected "format" and fails on main's shard 9. * fix(tests): expect io, invariant and path where #14225 reclassified stableArtifact expected "format" for an impossible descriptor byte count (now io) and an invalid chunk size (now InternalInvariantError); directoryArtifactReaderOpen expected "format" for a non-file entry (now path, the same change as #14238). All three fail on main. * fix(errors)!: raise container reader byte faults as malformed or truncated targets Delete the ambiguous `format` reason from ArtifactReaderFailure and ArtifactOperationError. Each container reader now raises its owner's fact once, through malformedArtifact / truncatedArtifact, with format, offset, field and measured extents. Short reads inside a measured extent are read-coverage integrity failures, path-kind refusals are `path`, foreign or recovery-requiring inputs are `unsupported`, host tool output is `io`, and REA defects are InternalInvariantError. The trace, NTFS journal, release exposure, web capture, native macOS and web artifact adapters project the reader's parsed facts as AnalysisTargetFailureError instead of invalid_request. Inventory malformed, truncated, unsupported and cancelled reasons take their code from the TargetFailure projection table, so a truncated container is unsupported_target with failure_kind "truncated" on both paths. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact, analyze_javascript_application, inspect_desktop_application, inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg, trace_dylib_resolution, trace_web_module_imports and trace_web_source_location report damaged container bytes as unsupported_target (details.reason "malformed" or "truncated", with failure_kind and format) instead of artifact_operation_failed with reason "format", and a truncated container as unsupported_target instead of truncated. inspect_playwright_trace, inspect_ntfs_journal, audit_release_exposure, the web capture inspection operations and the caller-selected import and source maps report damaged selected bytes as unsupported_target instead of invalid_request. The `format` reason no longer appears in details.reason. * test(artifacts): expect target failure codes in compiled CLI and MCP suites * fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures The SQLite engine's `format` reason is renamed to `malformed` at its owner (SQLITE_INSPECTION_REASONS), and its refusal becomes an AnalysisTargetFailureError at the selected path with format "sqlite". The pwntools and EVM worker replies keep their wire reason "format", which their workers define, and the adapters translate it once into a malformed target failure with the profile's format (elf, elf-core, evm-bytecode) instead of an invalid_format argument issue. SQLite joins the target-failure conformance registry. BREAKING CHANGE: inspect_sqlite_database, inspect_binary_layout, inspect_recorded_crash and inspect_evm_interface report a selected file's malformed bytes as unsupported_target with details.failure_kind "malformed", format_failure, format and path, instead of invalid_request with an invalid_format issue on path. * fix(errors): give the integrity kind a schema-valid code and list the reference page artifact_integrity_mismatch's projection schema requires declared and calculated digests, which a TargetFailure of kind integrity does not carry, so the kind now projects artifact_operation_failed with category integrity_mismatch. The model test validates every kind's projection against analysisErrorProjectionSchema. The reference page joins the documentation sidebar. * fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local A Bun or Node SEA short read inside a range already checked against the measured size meant the file changed, not that it was truncated. The carrier range reader and Bun's readExact now raise read-coverage integrity for it, and keep 'outside the file' as the truncated case. DesktopFileInspection records an unsupported managed-metadata probe as a row issue again, so later file checks still run. * test(errors): expect target failure facts in the pwntools and EVM reply suites The literal-replacement scenario now reads the failure's detail instead of an issues[] message, and a malformed reply wrapped by cleanup failure reports category unsupported_target. * test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit signatures) and the truncated Apple IPS body move into the conformance registry, which runs them through the CLI and MCP and now also checks that a refusal leaves the selected file unchanged. The per-command tests keep only their valid-image controls. * test(sqlite): drop the malformed-database provider test the conformance registry covers inspect_sqlite_database/not-a-database in the target-failure registry runs the same non-SQLite bytes through the CLI and MCP, asserts the malformed target facts and checks the selected file is unchanged. * feat(errors)!: make failure_kind the identifier and derive code and retry from it Apply the owner review on #14239 to the TargetFailure model: - remove details.format_failure; failure_kind is the only identifier; - give integrity, conflict and io their own codes (target_integrity_mismatch, input_conflict, host_io_failed) and derive inventory malformed, truncated and unsupported codes from the same table; - add a retry hint (none, backoff, after_change) derived from the kind, with io refined by its transient errno fact; retryable stays the unchanged-retry flag and is true exactly for backoff; - rename the limit-cut result code and category truncated to partial; - drop cancelled and resource from the target kinds and spell identifiers in American English (unrecognized); - return a target failure a tool handler throws as a projected isError result instead of letting the SDK flatten it to text. BREAKING CHANGE: details.format_failure is removed (read details.failure_kind). The truncated result code and category are now partial. Target integrity failures report target_integrity_mismatch, host read failures host_io_failed and disagreeing inputs input_conflict. Inventory operations (inventory_artifact, inspect_artifact, extract_artifact and the other inventory callers) report truncated container bytes as unsupported_target. Every target failure carries a top-level retry hint. * test(sqlite): expect a malformed target for non-database bytes in the CLI suite * fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart PyInstaller reads inside the measured size, and .NET bundle manifest refills, now raise read-coverage integrity on a zero-byte read instead of truncated. A .NET bundle field and a Godot PCK directory entry that extend past the file are truncated (with offset and extents) instead of malformed. An absent or invalid ASAR packed offset is malformed; only a valid range past the archive is truncated. The .NET manifest string offset is reported in file coordinates. * fix(pwntools): report a short ELF header as a truncated target The layout and recorded-crash workers raise a distinct truncated reason when the file ends inside the ELF identification or header, and the decoder projects it as failure_kind truncated instead of inferring it from the message. * fix(errors)!: report managed coverage gaps and IL2CPP pair conflicts as target failures Managed readers interpret an issue code once, in managedIssueTargetFailure: a coverage gap is an unsupported target, every other rule violation is a malformed target, and the inventory metadata status is derived from that same fact. managedInspectionTargetFailure now returns only AnalysisTargetFailureError. An IL2CPP binary that parses but does not link to its metadata is a conflict target failure that lists both inputs and blames neither, in place of an invalid_request with two issue entries. Metadata version 108 is an unsupported target. The CLI spells each conflict input's field by the command's option name. BREAKING CHANGE: inspect_managed_artifact, inspect_managed_members, inspect_managed_native_boundaries and the managed comparison operations report unsupported metadata or signature forms as an AnalysisTargetFailureError (failure_kind unsupported, format pe-cli, field, offset) instead of a bare unsupported target. inspect_il2cpp_metadata reports a binary/metadata pair that does not link as code input_conflict with failure_kind conflict and details.inputs, instead of invalid_request with details.issues, and metadata version 108 with failure_kind unsupported. * fix(artifacts): verify the carrier before blaming a short read on the bytes The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and .NET bundle members now re-verify the source before reporting a short stream as malformed, so a file that changed during the read reports the change. The truncation site builds the model's measured extent. * fix(errors)!: report inventory refusals as target failures of the selected path An inventory, inspection or extraction refused damaged or unsupported container bytes as an ArtifactOperationError whose reason repeated the format owner's kind. It carried no path or retry hint, so the conformance registry could not express container cases. translateArtifactFailure now takes the selected path and returns the reader's TargetFailure as an AnalysisTargetFailureError. The malformed, truncated and unsupported reasons, their classification rows and their presentation branch are deleted from ArtifactOperationError. Readers' unsupported refusals carry their format facts through unsupportedArtifact. Container cases move into the conformance registry, which now opens the target first for session tools such as inspect_artifact. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the bundle readers report a refused container as a target failure of details.path with a top-level retry. details.reason is the owner's description and details.detail is removed. * docs(il2cpp): describe pair conflicts as input_conflict with both inputs * docs(android): name unsupported_target for truncated boot image structures * fix(errors)!: report a target that changed during the read as failure_kind changed Inventory integrity failures whose check means the target moved under the read (container, member and unpacked-entry identity, read coverage, traversal coverage) now take the model's changed projection: code artifact_changed, retry backoff and details.failure_kind changed. A selected target that no longer matches the one the session admitted gets its own admitted-identity check and keeps its reopen recovery. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the other inventory operations report a target that changed during the read as artifact_changed (retryable, failure_kind changed) instead of artifact_operation_failed. Admission-identity refusals report integrity_check admitted-identity instead of container-identity. * test(artifacts): raise the cleanup fixture's decode refusal with its format facts * fix(errors)!: report unsupported and unrecognized targets on the TargetFailure model AnalysisUnsupportedTargetError carried a free-text reason and remediation beside the TargetFailure model, so unsupported refusals had no format, failure_kind or retry hint, and their recovery was prose written at each producer. The class is deleted. Producers raise unsupportedTarget or unrecognizedTarget with the owner's format, and consumers read targetFailureOfKind. The projection table renders the recovery and names the operations the owner lists in related.operations. The foreign-bytes identity loop moves into the conformance registry. BREAKING CHANGE: unsupported and unrecognized targets report failure_kind, format and retry. Their remediation comes from the target-failure table; producer-written remediation sentences are folded into details.reason or replaced by details.related_operations. * test(artifacts): expect admitted-identity for selections replaced before admission A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split. * test(go): name the fixture and result when an MZ carrier is not refused through MCP * style: format the migrated target-failure tests * test(errors): expect the PE readers' native-binary format label for foreign bytes * test(verify): expect target failures for damaged ELF, core and EVM inputs in real-provider verifiers The binary-layout, recorded-crash and EVM verifiers still expected invalid_input for malformed or truncated selected bytes. The pwntools and EVM adapters now report those as unsupported_target with failure_kind; a missing path remains invalid_input. * test(web): expect the partial code for a refused source-map admission The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling. * fix(artifacts): keep refusal facts on DMG verdicts and the selected bundle path hdiutil's "image not recognized" verdict raised the unsupported reason without the owner's facts, so the inventory translation treated it as a reader defect. It now carries an unsupported dmg target failure, and the reader-failure constructor requires facts for every target reason. A bundle resource refusal names the caller's selected bundle path rather than its resolved target. The real-provider verifiers and the Android, source-location acceptance tests expect the model's target-failure categories and codes. * test(errors): assert unsupported refusals' kind and format, and align verifiers and the Electron guide * test(errors): check the MCP target failure as the text clients receive The stdio transport removes the private structured carrier from every isError result, so the conformance suite asserted a field that never reaches clients and failed every case. The projected diagnostic is checked from the JSON text instead. * test(errors): raise main's new unsupported-target fixtures through the model * test(artifacts): expect artifact_changed when selected bytes change after inventory Bundle resources replaced after open and unselected JavaScript sources rewritten after inventory now fail a change check, so they report artifact_changed with retry backoff rather than artifact_operation_failed. * fix(errors): report a session digest mismatch as admitted-identity The digest the session admitted does not change when the same request is repeated, so targetDigestChangedFailure was inviting a backoff retry that fails the same way. It now names admitted-identity, which stays artifact_operation_failed and not retryable, and tells the caller to reopen. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): classify unused PyInstaller compressed input as layout zlib stops at the first complete stream, so a declared span that arrives intact but is not fully consumed is trailing junk or a second stream, not a file that changed. A source that ends before that span stays read-coverage. The cached-carrier test replaces the file with a different size so a shared timestamp cannot hide the rewrite. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(applications): expect unsupported_target for a damaged trace stream A trace member whose CRC fails is a malformed zip target. The partial Evidence assertion now checks that code, failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(artifacts): assert Android refusal kinds and drop the SEA registry case details.reason is the owner's description, so the boot-image refusals assert failure_kind and format. A malformed SEA blob inside an ELF stays an outer-format inventory with a recognition limitation, which the Node SEA reader tests already cover, so it is not an inspect_artifact refusal. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): pass the selected path into translated target failures translateArtifactFailure names the caller-selected path on a format refusal. Directory inspection and a retained artifact scope both know that path and now supply it. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): charge global pax records against the tar metadata budget Repeated pax global headers were copied into one map without a charge, so each header could stay inside the extended-header allowance while the map grew without a bound. The retained metadata budget is charged for the merged map's keys, values and entries before that map is allocated. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(dylib): expect admitted-identity when the opened target is replaced The session keeps the digest it admitted, so replacing the executable and repeating trace_dylib_resolution is not a retryable container change. Co-authored-by: morluto <morluto@users.noreply.github.com> * style: format the inventory path translation and conformance suite * fix(artifacts): keep the unsupported-target migration in files the inventory merge replaced * test(errors): expect target failures for ZIP inventory refusals and input_conflict for an unlinked IL2CPP pair * test(artifacts): expect a malformed target failure for an ISO 9660 directory cycle * test(web): expect a malformed target failure on the captured source path * test(artifacts): expect a malformed ZIP target failure for a corrupt Zstandard member * test(javascript): read the owner's input facts from details.reason and recovery from the projection * test(iso9660): assert the malformed target failure fields details.reason is the owner's description. The compiled CLI refusal is identified by failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(errors): assert selection and unsupported view fields A desktop root that is not a directory is a selection failure, so the CLI reports invalid_request. An analysis view the parent cannot supply is unsupported evidence; the tests read failure_kind, format, field and related_operations. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(errors): keep binary plist UID facts on unsupported targets Pass the reader's UnsupportedBinaryPlistUidError failure through instead of rebuilding a bplist refusal that drops field and undecodedContent. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(errors): keep oversized binary plist UID facts on keyed archives Assert the reader projects format, field, and undecoded content from the parser failure instead of a rebuilt bplist refusal. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
353 lines
22 KiB
Markdown
353 lines
22 KiB
Markdown
# Electron file-page observation
|
|
|
|
REA can attach to an Electron/Chromium CDP endpoint and inspect existing `file://` renderer pages without evaluating JavaScript or invoking Electron APIs. The request supplies the endpoint directly; REA accepts only literal-port loopback HTTP endpoints. Selecting an endpoint exposes every Electron target it serves, including local file paths and page metadata.
|
|
|
|
Disconnecting the inspection's page session can clear caller-owned
|
|
`navigator.platform` emulation inside Chromium. REA cannot restore another
|
|
client's complete user-agent/client-hint configuration. Use a disposable target
|
|
or let the owning client reapply its configuration; see the shared
|
|
[CDP state limitation](../web/browser-observation.md#provider-authorities).
|
|
|
|
This passive runtime surface is distinct from the target-free static
|
|
[`analyze_javascript_application`](javascript-artifact-reconstruction.md)
|
|
workflow. Static analysis reads a local ASAR or extracted directory without
|
|
executing application code. Passive observation inspects an existing Electron
|
|
page. The results keep static inferences and runtime observations distinct.
|
|
Packaged fuse state is a separate static read:
|
|
[`inspect_electron_fuses`](../../electron-fuses.md) reports whether this binary will
|
|
honor Inspector flags, `ELECTRON_RUN_AS_NODE`, embedded ASAR integrity, and
|
|
`app.asar`-only loading.
|
|
Use the separate
|
|
[`reconcile_javascript_runtime`](javascript-runtime-reconciliation.md) workflow
|
|
when both Evidence sets already exist.
|
|
|
|
## Target boundary
|
|
|
|
The request supplies a literal-port loopback endpoint and, for inspection, a
|
|
target ID. REA accepts local hostless `file://` URLs that resolve to regular
|
|
files, including pages a packaged application serves from inside `app.asar`.
|
|
For those, the first `.asar` path component that is a regular file is the
|
|
archive, the remainder must name a regular file in its header, and the reported
|
|
path is the canonical archive path joined with that member. Remote hosts,
|
|
encoded separators in the pathname, ASAR directories or links, and nonexistent paths are
|
|
rejected. The endpoint exposes every eligible target and its local path
|
|
metadata. Query strings and fragments do not participate in filesystem path
|
|
admission, including their encoded separator text. Listing and inspection
|
|
Evidence both retain the observed browser product/revision; host platform and
|
|
architecture remain explicitly unknown.
|
|
|
|
Cancellation stops further file authorization after an already-started filesystem
|
|
operation settles. ASAR descriptor-close failures remain typed incomplete cleanup
|
|
with an exact retryable owner; they are not treated as a missing or unauthorized
|
|
page. A later authorization and provider shutdown retry retained descriptors
|
|
before reporting their release. Failed listing retains its already-authorized
|
|
target prefix and explicit remaining-target uncertainty through cleanup errors
|
|
and exact-owner retries.
|
|
|
|
## Workflow
|
|
|
|
`list_electron_targets` returns every eligible target served by the supplied endpoint in one inline array.
|
|
|
|
For the MCP follow-up call, pass the same literal-loopback endpoint and the selected target ID to `inspect_electron_page`. REA rediscovers targets and validates the ID against the live endpoint before inspection.
|
|
|
|
```bash
|
|
rea list-electron-targets http://127.0.0.1:9223 --json
|
|
rea inspect-electron-page http://127.0.0.1:9223 TARGET_ID \
|
|
--observation-ms 100 --json
|
|
```
|
|
|
|
Script content is excluded by default. Setting `include_script_sources` in the
|
|
request returns the selected target's script sources:
|
|
|
|
```bash
|
|
rea inspect-electron-page http://127.0.0.1:9223 TARGET_ID \
|
|
--include-script-sources \
|
|
--json
|
|
```
|
|
|
|
The normalized result contains canonical local paths, frame and DOM
|
|
structure, resource metadata, stable script/resource identities, explicit
|
|
completeness, and content-addressed script artifacts. Resource sizes are unknown
|
|
when omitted or invalid; supplied invalid sizes also produce an explicit
|
|
completeness diagnostic.
|
|
|
|
DOM node indices retain their snapshot positions. Invalid rows are omitted with
|
|
completeness diagnostics, so `total_nodes` can exceed the retained node count
|
|
and a parent index can refer to an omitted source node.
|
|
|
|
`dom.node_value_length_unit` is `utf8-bytes`: each node's `node_value_length`
|
|
counts the bytes needed to encode its value as UTF-8, not characters. Web
|
|
observations instead declare `utf16-code-units`. These existing measurements
|
|
are preserved; the unit is reported once for the whole DOM, without retaining
|
|
text values. Historical captures without the unit leave it unknown; reading
|
|
them does not infer a unit or convert their stored lengths.
|
|
|
|
Script metadata retains its execution-context frame ID when CDP supplies one and
|
|
records admission separately in `frame_scope`. An `authorized` scope refers to
|
|
the observed document generation; `unknown` retains the known frame ID without
|
|
claiming authorization and makes script coverage attach-limited. Historical
|
|
captures may omit this field, which leaves that admission fact unknown.
|
|
Scripts from document generations whose frames were explicitly excluded by
|
|
local-file policy are omitted before script-source reads. Frame identity can
|
|
come from the script event's own auxiliary data or its observed execution
|
|
context; contradictory identities are not aligned.
|
|
`frame_claims.script_event_frame_id` and
|
|
`frame_claims.execution_context_frame_id` preserve the actual observed claims
|
|
from those two sources. Both remain available when their disagreement leaves
|
|
the resolved `frame_id` null and `frame_scope` unknown. An omitted claim is
|
|
unobserved, not proof that a frame was absent.
|
|
Frames describe the current inventory; script observations can retain earlier
|
|
authorized frames that have since detached.
|
|
|
|
`has_source_url` preserves CDP's sourceURL declaration flag as true, false, or
|
|
unknown (`null`, or omitted in historical captures). A script's canonical
|
|
`file_path` is the admitted local-file URL or supplied sourceURL label. It does
|
|
not verify that the runtime bytes came from that disk file; captured source
|
|
bytes have their own digest. `reported_url` retains the original URL or label
|
|
before canonical path admission. Labels remain distinct from filesystem provenance.
|
|
The capture also
|
|
inventories worker, service-worker, and shared-worker targets with
|
|
validated opener-target and parent-frame IDs. Worker discovery uses passive
|
|
target metadata; REA does not attach to or execute code in those targets.
|
|
Script metadata uses the shared 8 MiB JSON-byte allowance for each retained
|
|
representation: incoming drafts and normalized capture metadata. Admission
|
|
counts escaped strings, frame claims, and provenance fields before retaining
|
|
them or serializing metadata for a digest. Exhaustion preserves earlier records
|
|
and reports counted `resource_budget_exhausted` script omissions; a later
|
|
smaller record may still fit. This allowance adds no script-count cap and is
|
|
separate from script-source bytes.
|
|
Script-source collection retains at most 32 MiB of UTF-8 text across scripts
|
|
and shares a 20-second collection deadline. Omitted sources retain their script
|
|
metadata and an explicit reason; later smaller sources may still fit after an
|
|
oversized source is omitted. The separate 64 MiB CDP response limit bounds one
|
|
wire message before retention admission, rather than total transient memory.
|
|
The source budget adds no script-count cap. Like every
|
|
target, frame, script, and resource, a worker URL must resolve to a local
|
|
file before it is retained. Relationship IDs improve
|
|
attribution but do not prove which static module started a worker or that its
|
|
work completed.
|
|
Missing opener and parent relationships leave worker ownership unknown. Such
|
|
targets are withheld with an `unattributed_target` exclusion and unavailable
|
|
`workers` coverage, even when their URL names a local file. Explicit foreign
|
|
relationships remain `out_of_target_scope`; malformed supplied relationship IDs
|
|
are `invalid_protocol_value`.
|
|
|
|
Inspection does not retain DOM values, execute renderer code, navigate, click,
|
|
invoke Electron IPC, close a target, or terminate the application.
|
|
|
|
## Active Electron scenarios
|
|
|
|
The scenario request supplies the Electron executable and application entry
|
|
point, plus any arguments and actions. The application root defaults to the
|
|
entry point's parent directory and can be supplied when the app uses a different
|
|
root. REA launches that executable through
|
|
the official Playwright Electron API and owns its lifetime. It accepts click/wait actions,
|
|
window-targeted renderer reload/crash actions, and synthetic `open-url` or
|
|
`second-instance` deep-link delivery. It records capture-scoped window and
|
|
WebContents identities, process metrics, and IPC channel and value-shape metadata.
|
|
Payload values are not retained.
|
|
|
|
For the exact Playwright launch sequence, the active hook removes only REA's
|
|
bootstrap arguments from the application-visible `process.argv`. The vector keeps
|
|
the selected entry point and every caller argument, in order, including repeated
|
|
hook paths, `.asar` filenames, and debug-like options. The private launch handoff
|
|
is consumed before application code runs. If the observed sequence cannot be
|
|
matched exactly, argv stays unchanged and capture coverage reports `hook_conflict`;
|
|
REA does not guess an entry point or remove arguments by filename patterns.
|
|
|
|
`window_index` selects from Playwright's current Page list at the start of each action. REA resolves that Page to its corresponding BrowserWindow once; the action's `target` uses the BrowserWindow's capture-scoped `window_id`, matching the window inventory. Reordering either enumeration after selection does not retarget the action. Handle cleanup failures retain the completed action records and remain owned for provider cleanup retry.
|
|
|
|
Once REA resolves the required window, the host clock controls the full wait even during a renderer crash.
|
|
|
|
Run the real fixture verifier with an operator-provided Electron runtime:
|
|
|
|
```bash
|
|
REA_ELECTRON_EXECUTABLE=/absolute/path/to/electron npm run verify:electron
|
|
```
|
|
|
|
This operation actively launches and interacts with the selected target. It is
|
|
not a passive CDP observation. The owned process keeps normal host filesystem
|
|
and network privileges, so lifecycle ownership does not make it a sandbox.
|
|
|
|
The app runs with the operator's real profile. If the app is already running,
|
|
or another capture of the same app is in progress, the launched instance can
|
|
fail to obtain the app's single-instance lock. Electron then hands the launch,
|
|
including its arguments, to the running instance. The active hook stops the
|
|
launched app at that call, and the capture fails with
|
|
`application_already_running` without observing or driving the running
|
|
instance. If the app requests the lock while actions run, the pending actions
|
|
stop and the capture fails the same way, keeping its final snapshot. Close the
|
|
running app, or wait for the other capture, and retry.
|
|
|
|
The CLI and MCP surfaces accept the same schema. For a JSON request file:
|
|
|
|
```bash
|
|
rea capture-electron-scenario scenario.json --json
|
|
```
|
|
|
|
The result records one status and target per declared action; actions after a
|
|
failed or cancelled action are not run and are recorded as `cancelled` with a
|
|
not-executed error. It also records correlated app/window/WebContents,
|
|
preload, session, navigation, shell, permission, popup, download, protocol,
|
|
native-addon, process, and IPC timeline events. IPC channels and argument-shape
|
|
metadata retain their observed lengths; payload values are never retained.
|
|
Renderer crash/restart and deep-link actions are synthetic
|
|
scenario controls; their attempted and observed outcomes remain in the
|
|
timeline. The active hook blocks and records the shell methods listed below
|
|
and selected navigation, permission, download, popup, updater, and
|
|
OS-integration APIs. These method patches do not contain direct filesystem,
|
|
network, native-addon, or other unpatched target effects. The timeline
|
|
is explicitly partial when attachment starts after application activity. The
|
|
startup, including the initial state snapshot, has a 60-second deadline.
|
|
Actions wait until completion or request cancellation; a click whose target
|
|
never appears, or a `wait` without `window_index` in an app that opens no
|
|
window, remains pending until cancelled. After cancellation, the final state
|
|
read has 5 seconds before REA keeps the initial snapshot instead; the
|
|
cancellation keeps the caller's reason and records that expiry in its
|
|
diagnostics. When the caller interrupted an action and the final Inspector read
|
|
fails, REA reports the cancellation with the initial snapshot, the action
|
|
records, and the Inspector failure as a secondary diagnostic.
|
|
The shell policy is owned by `blockedShellResults` in
|
|
`scripts/electron-active-hook-boundaries.cjs`. Its synchronous blocks are:
|
|
`showItemInFolder` returns `undefined` and `writeShortcutLink` returns `false`.
|
|
Their `shell-attempt` events record the blocked phase and argument shapes;
|
|
neither result means the requested host operation occurred. The existing
|
|
`openExternal`, `openPath`, and `trashItem` blocks reject their promises.
|
|
The `trashItem` block prevents that call from reaching the OS trash operation;
|
|
it does not intercept other ways the application can remove files.
|
|
Process rejection and uncaught-exception events are observed at dispatch without
|
|
adding exception handlers. The runtime and application retain their warning,
|
|
handler, and fatal-exit policies, including for rejected shell-block promises.
|
|
CLI SIGINT/SIGTERM requests cancellation and awaits owned-process cleanup.
|
|
Window IDs, URLs, and cached titles come from one main-process Electron snapshot,
|
|
so a crashed renderer does not require a successful renderer-side title query.
|
|
Window instrumentation uses Electron's window-created event, including runtimes
|
|
with a read-only `BrowserWindow` export. Preload configuration comes from the
|
|
window's runtime metadata, including Electron's optional internal preload
|
|
descriptor when web preferences omit it. This descriptor is verified on
|
|
Electron 44.7.0; runtimes that expose neither representation retain an unavailable
|
|
path. A configured path or working IPC handler does not prove preload execution.
|
|
If cleanup cannot be verified, the error retains collected observations in
|
|
`details.partial_observation` and marks their application cleanup `unverified`.
|
|
Cleanup uncertainty does not authorize signaling unrelated processes.
|
|
|
|
On Linux, Chromium-based processes can overwrite the initial environment memory
|
|
exposed through `/proc/<pid>/environ`. The environment may be readable while
|
|
`REA_PROCESS_RUN_ID` is absent, even if the application still sees it through
|
|
`process.env`. REA reports the missing marker and leaves lineage ownership and
|
|
cleanup unverified; the PID, executable, or parent relationship cannot replace
|
|
that ownership proof. This limitation can affect owned Electron captures on
|
|
native Linux as well as WSL. It does not establish that all Electron versions or
|
|
Linux environments behave the same way.
|
|
|
|
Main-process IPC recording keeps original-function removal for `on` and `once`
|
|
registrations and records a fired `once` callback once. Native Node.js owns
|
|
`once` registration, firing and callable dispatch as well as removal order and
|
|
traversal, including listeners registered by removal observers;
|
|
the hook translates only its own recording wrappers at the removal boundary.
|
|
Wrapper metadata uses weak keys and does not retain removed registrations.
|
|
Wrapper metadata operations, private collection methods and traversal constructors are captured
|
|
before target startup; later replacement of their global bindings does not
|
|
change listener registration or removal.
|
|
|
|
Native runtimes differ in whether `once` consults callback `.call` or `.apply`.
|
|
The hook observes actual callback entry without imposing another runtime's
|
|
property reads or argument-list representation. Application methods selected by
|
|
native dispatch keep their original receiver and argument-list object; opaque
|
|
methods produce a `custom-call` or `custom-apply` observation gap when callback
|
|
execution cannot be established.
|
|
|
|
If native wrapper creation or registration-method lookup could expose private
|
|
instrumentation through an application getter, setter or Proxy, registration
|
|
stays native and unwrapped. The `once-metadata` observation gap identifies that
|
|
unobserved registration attempt; it does not prove registration or delivery. The original callback,
|
|
metadata writes and native method receivers are preserved, including when
|
|
registration fails. Later registrations resume normal observation. Non-callable
|
|
`call`/`apply` properties produce failed observation gaps when native dispatch reads
|
|
them; callback entry is not fabricated.
|
|
|
|
An `on` listener's application-defined `.apply` receives the original argument-list
|
|
object unchanged. Borrowing the exposed method preserves its dynamic receiver.
|
|
Because that method owns argument interpretation and may not
|
|
invoke the callback, the hook records a bounded `ipc-observation-gap` timeline
|
|
entry with the registered channel rather than an IPC invocation. Its empty
|
|
`argument_shapes` means unobserved arguments, not a zero-argument callback;
|
|
callback execution and result remain unknown. Coverage and retention include
|
|
these gaps even when their individual records are dropped. Normal native
|
|
dispatch continues to record actual invocation frames. Evidence snapshots copy
|
|
retained arrays and counters without invoking application iterators or Array
|
|
species.
|
|
|
|
Listener-chain recognition distinguishes owned, unowned and unknown metadata.
|
|
Only a directly owned wrapper establishes hook dispatch. An application's data
|
|
link to an owned wrapper remains unknown: `.listener` can name that wrapper
|
|
without invoking it.
|
|
Data links may be inherited; absence is established only after completing the
|
|
bounded prototype lookup. Exhausting either walk, encountering a getter or seeing a Proxy leaves
|
|
ownership unknown. The hook preserves native registration without adding another
|
|
recording wrapper and retains a `listener-chain` observation gap after successful
|
|
registration. This gap does not prove IPC delivery. An existing inner recording
|
|
wrapper can still report its actual invocation; otherwise callback activity
|
|
remains unobserved. Setter-only properties have a known undefined read.
|
|
Data-descriptor parsing is shared with removal normalization.
|
|
|
|
This does not establish complete JavaScript function introspection equivalence.
|
|
Caller-defined `.listener` properties can change the identity exposed by
|
|
`listeners()` and meta-events; accessors and Proxy metadata are not followed for
|
|
wrapper recognition. Re-registering a raw recording wrapper on another channel
|
|
retains the original registration's channel attribution.
|
|
Mutating `.listener` on a raw recording wrapper can also prevent removal through
|
|
application decorators that bypass the hook's removal methods. When a removal
|
|
request reaches the hook's methods and its registration order is known, private
|
|
callback ownership preserves removal by the original function and the newest
|
|
matching registration when public metadata is changed or deleted. Native removal
|
|
still determines getter execution, exceptions and removal meta-events.
|
|
|
|
If registration or removal methods differ from the Node methods captured at hook
|
|
initialization, the hook leaves listener callbacks unwrapped and records a
|
|
`listener-registration` observation gap. The application keeps its original
|
|
callback and receiver; callback execution remains unobserved. This comparison
|
|
assumes Node's EventEmitter prototype has not itself been globally decorated
|
|
before hook initialization. The provider loads the hook before the application
|
|
and excludes `NODE_OPTIONS` from the child environment. It preserves selected
|
|
`DISPLAY`, `XAUTHORITY` and `WAYLAND_DISPLAY` values, including the caller-selected
|
|
X11 authorization-file path.
|
|
|
|
An opaque later listener or unsupported emitter state can prevent proof of
|
|
removal order. The hook then delegates removal
|
|
to the native method and records a `listener-removal` gap rather than claiming
|
|
which registration was removed. These gaps are distinct from dropped records
|
|
and do not establish IPC delivery or successful removal.
|
|
|
|
### Target fuse prerequisites
|
|
|
|
Active scenario capture requires that the target Electron executable honors Node CLI inspector flags (`--inspect` or `--remote-debugging-port`) so that Playwright can establish its DevTools protocol session.
|
|
|
|
When an Electron executable explicitly disables the `EnableNodeCliInspectArguments` fuse (or removes the capability), `capture-electron-scenario` fails immediately before process launch with an `unsupported_target` error whose `details.failure_kind` is `unsupported` and `details.format` is `electron` rather than waiting for the startup deadline. For targets with disabled inspector fuses, use passive CDP inspection via `inspect_electron_page` or run against an unrestricted development binary with the extracted `app.asar`.
|
|
|
|
The real verifier exercises compiled CLI and stdio MCP discovery, page/script
|
|
inspection, static/runtime reconciliation, active observation, and CLI SIGTERM
|
|
cleanup before checking the IPC, renderer crash/reload, utility/child-process,
|
|
deep-link, and blocked-effect fixture. A cleanup error keeps the full lane failed
|
|
even when the retained capture contains useful observations.
|
|
|
|
Active Electron Evidence can also be supplied to
|
|
[`reconcile_javascript_runtime`](javascript-runtime-reconciliation.md). That
|
|
projection is intentionally target-only and partial: it binds the selected
|
|
application path and capture outcome to the static graph, while frames, scripts,
|
|
workers, and execution claims remain unavailable until a separate passive runtime
|
|
capture provides them.
|
|
|
|
ASAR observation reads the header through one open file handle and validates its
|
|
declared lengths against the archive size. Header/index admission is the same
|
|
budget used by static ASAR reads: 16 MiB / 16777216 bytes by default, seeded by
|
|
`REA_ASAR_MAX_HEADER_BYTES` (at most 256 MiB). In MCP,
|
|
`update_analysis_settings` can override `asar.max_header_bytes` for new
|
|
operations without restarting REA. Cached headers are checked against each
|
|
operation's admission, including after a decrease. See the
|
|
[analysis settings and recovery](../../reference/limits-and-recovery.md#failure-and-retry).
|
|
An oversized header is
|
|
not parsed; selecting a member path does not bypass admission, and the page
|
|
stays unauthorized. The header cache separately retains at most that many bytes
|
|
of already-admitted encoded headers across eight archives. Evicting that cache does not raise admission.
|