27 Commits
Author SHA1 Message Date
Entrpiandmorluto 721b25e20d feat(rizin)!: record which tool and version answered execute_rizin_command (#7487)
* refactor(process): share executable lookup with provider commands

Process capture owned the only spawn-equivalent PATH lookup, wrapped in
scenario-specific errors. Move the lookup into src/process as a result
type, so a provider command can resolve an executable once, hash it and
then run that same file. Process capture maps the result to its existing
errors unchanged.

* feat(rizin): record which tool and version answered execute_rizin_command

execute_rizin_command recorded version null and labelled any executable
selected by REA_RIZIN_COMMAND as Rizin, although radare2 also accepts
REA's argument list. Before the first command for each executable
digest, resolve the selected executable through PATH, hash it, run it
with -v and read its banner; the command then runs the same file. The
Evidence provider records the tool name and version, and the parameters
record the resolved executable path, its SHA-256 and the banner line.

A tool other than Rizin still runs, with a limitation; a failed, timed
out or unrecognized probe leaves the version unknown. Each digest's
reading, including a failure, is reused for the life of the process, and
concurrent first calls share one probe within the caller's
command_timeout_ms budget. A caller that stops waiting cancels the
probe only when no other caller needs it. A probe whose process cleanup
is incomplete stays retained for retry.

* fix(rizin): probe per call and reuse only completed probes

Sharing an in-flight version probe between callers let a joining call
outlive its own command_timeout_ms and inherit another caller's
cancellation, and the cache was keyed by digest alone, so byte-identical
launchers in different directories shared one reading. Remove the
sharing: each call runs its own probe under its own deadline and
cancellation. Reuse only completed probes (a banner, a non-zero exit or
a timeout), keyed by the resolved launch path and its SHA-256.

The executable lookup now honours the call's deadline and cancellation,
so a stalled PATH entry cannot hang a call or close(). A failed probe
records its exit status and bounded stdout and stderr in
provider_version_probe, and a cancelled probe keeps its captured output
on the error.

* fix(rizin): never let a later probe failure replace a successful reading

Concurrent first calls can each probe the same launch path and digest.
When one probe printed a banner and another later timed out or exited
non-zero, the failure overwrote the cached reading, so every later call
reported an unknown version for the life of the server. Route the cache
write through one rule: a failure never replaces a successful reading,
and a success replaces an earlier failure. Each call still reports its
own probe's outcome.

* docs(rizin): state what the executable digest and version observe

The guide said the command "runs the same file" as the version probe.
REA runs the same resolved path; the recorded SHA-256, tool and version
describe the file there when REA checked it. Say so, with the limit the
guide already states for artifact digests: they cannot prove the exact
bytes executed if the file changes before the launch.

* test(rizin): pin the banner a real Rizin 0.9.1 printed

Homebrew's Rizin 0.9.1 prints `rizin 0.9.1 @ darwin-arm-64, package:
0.9.1_2 (Homebrew)`, with a package suffix after the platform. The
identity test now uses that banner, so a parser that expects the line to
end at the platform fails; the other tests keep the plain form.

The test name and the probe comment now say REA runs the path it hashed
and reuses a completed probe per launch path and digest, as the guide
says since c73a0be9c.

* fix(rizin): replace the service's lookup and execution together

Tests that injected a fake runner still resolved `rizin` through the host
PATH. With Rizin installed, the version probe took the fake runner's
first canned result, and three tests in reverseEngineering.test.ts
failed. CI has no Rizin, so they passed there.

The service now takes one `processes` option: the executable lookup with
either a runner or the owned-process primitive. It replaces `run` and
`runOwned`, so a fake runner cannot be paired with the host lookup.
Omitting it keeps the host lookup and owned execution. The lookup no
longer reads the service's `stat` seam.

The test service pairs a fake runner with a lookup that finds nothing
unless the test passes one; the identity tests pass the real lookup
explicitly. A new test puts an executable `rizin` first on PATH with a
fake runner and checks that each command gets its canned result, and
that the options type rejects a runner without its lookup.

* fix(rizin): end the call when hashing the executable reaches the deadline

When hashing the resolved executable reached command_timeout_ms,
digestFile rejected with ETIMEDOUT and the service recorded an unknown
identity, then launched the caller's command with a fresh deadline. A
caller-selected, possibly side-effecting command ran after its
preflight deadline had passed.

The hash deadline now returns AnalysisTimeoutError with phase
executable_digest, as the lookup's deadline already did, and the timeout
guidance names executable identification among the phases. A test
stalls the executable's stat past a 50 ms deadline and checks that
nothing runs.

* fix(rizin): bound kept version probes and keep only complete readings

The probe cache kept one entry per launch path and digest and never
evicted one, and a kept banner could be as long as the 16 MiB capture.
It now keeps the latest completed probe per launch path with the digest
it read; a new digest replaces it, and a later failure still never
replaces a successful reading of the same digest. The service reads the
banner (the first stdout line, trimmed), keeps at most 2,048 characters
of it and records provider_version_banner_truncated; the provider's
parser now reads that bounded banner, so everything a probe keeps is
bounded.

A -v output that was not valid UTF-8 was parsed anyway, so replacement
characters could become provider.version. It now leaves the version
unknown, with a limitation saying the output is not valid UTF-8.

An owned probe whose output was not fully collected was labelled failed
when it carried a numeric exit status, and cached. A collection failure
is now checked first: the probe is unfinished, is not kept, and its
diagnostics report no exit status.

Tests cover a digest change replacing the kept probe, a capped banner,
undecodable output and a collection failure that is probed again.

* fix(rizin): keep only probe outcomes that describe the executable

A timed-out version probe was kept for its launch path and digest, so a
later call with a longer command_timeout_ms reused it without probing:
its Evidence said the probe reached the command deadline, and the
version stayed unknown until the executable changed. A timeout is a fact
about one call's deadline, not about the file.

Each probe outcome now carries its scope in its type: a reading, a
failed exit and undecodable output describe the executable and are
kept; a timeout and unfinished output describe the call and are not.
The cache accepts only executable-scoped outcomes, so the call site no
longer filters. Both runners report a deadline as ETIMEDOUT, which the
probe checks before any signal, so a stopped probe is always timed-out.

A test times out a probe through the owned runner's deadline failure,
then checks that a call with a longer deadline probes again and reads
the version.

* fix(rizin): flag invalid UTF-8 in version-probe diagnostics

When -v exited nonzero or timed out with output that was not valid
UTF-8, provider_version_probe kept the decoded text, replacement
characters included, with no flag. Undecodable output's stderr had the
same gap.

The failure capture (execFileOutputFailure) now reads the runner's
stdoutInvalidUtf8 and stderrInvalidUtf8, as it already reads
collectionFailure. The probe diagnostics record them for every outcome
that keeps output, as stdout_invalid_utf8 and stderr_invalid_utf8,
following gdb Evidence's stderr_invalid_utf8. The command path takes its
flags from the same capture instead of reading the owned failure
directly. The guide names the two fields.

Tests cover failed and timed-out probes with invalid stdout or stderr,
undecodable output on both streams, and a failed command whose stdout
is not valid UTF-8, which pins the command path's flags to the capture.

* fix(rizin): mark the provider as assumed when no banner identifies it

When the -v banner did not match, identifyRizinTool returned Rizin's
identity with no limitation, so Evidence named Rizin although nothing
identified the tool; the limitation qualified only the version and
formats. Failed, timed-out and undecodable probes, and an executable
that could not be located or read, named Rizin the same way.

The Evidence provider schema requires a name, so the tool cannot be
recorded as unknown. The parser now returns no identification for a
banner it does not recognise. Wherever no banner identified the tool,
the service keeps the configured identity, sets provider_identity to
"assumed" and adds the probe's assumed-identity limitation, which the
Rizin probe owns; an identified tool gets provider_identity "banner".
The guide and the tool description say so.

Tests cover an empty first line and a Usage: banner; two composition
tests now count the added limitation.

* fix(rizin): keep invalid UTF-8 flags in typed errors' captured output

A cancelled or cleanup-incomplete version probe carried captured output
from execFileFailureCapturedOutput, which dropped the runner's
invalid-UTF-8 flags, so its replacement characters looked like provider
output. The command path's own captured output had the same gap when
cancellation ended a run or a failure was captured.

AnalysisCapturedOutput gains stdout_invalid_utf8 and
stderr_invalid_utf8, set to true only when the runner reported invalid
UTF-8, as command observations mark output_invalid_utf8. The shared
projection fills them through capturedInvalidUtf8, and the command
path's two captured outputs use the same helper, so every consumer of
a runner's failure report keeps them. The guide mentions the markers.

Tests cover a cancelled and a cleanup-incomplete probe, and a command
cancelled during and after its run, each with invalid UTF-8 output.

* fix(rizin): probe the executable before every command

A launcher such as a version-manager shim keeps its path and SHA-256
while the tool it delegates to changes, so a reading kept for that path
and digest could name a tool the command no longer runs. A shim's
delegate cannot be observed, so no kept reading can be checked for
freshness.

Every call now probes in its own environment and under its own deadline
before the command, and nothing is reused. The cache, its keep and
replace rules and the outcome scopes that existed only for it are
removed; without a cache, an unfinished probe is reported as failed, and
its diagnostics still give no exit status when output was not fully
collected. The per-call digest stays in Evidence. The guide and the
tool description say each call probes.

On this Mac (Homebrew rizin 0.9.1) a probe costs about 180 ms through
REA's owned-process runner, of which rizin -v itself takes about 15 ms
warm: the price of identifying the answering tool on every call.

A test runs a launcher whose bytes stay the same while the tool it runs
changes, and checks that each call reports the tool that answered.
Tests that only covered the cache are removed; the rest now expect a
probe per call.

* test(rizin): restore the per-caller probe deadline test

dd06ad27c removed the cache-only tests with a script that also removed
"runs each caller's probe under its own deadline and cancellation",
which covers per-call probing: two concurrent calls each probe under
their own deadline and signal, and cancelling one stops only its probe.
Restore it without the reuse check that only the cache needed.

* fix(rizin): read the working directory only when the lookup needs it

The service passed process.cwd() to the executable lookup on every call.
If the server's working directory had been removed, process.cwd() threw
ENOENT before the lookup looked at an absolute REA_RIZIN_COMMAND, and
executeRizinCommand rejected instead of returning its Result.

lookupExecutable now takes a function for the working directory and
reads it only for a relative command or PATH entry, or on Windows, where
an absolute path can still depend on the working directory's drive. A
failed read is a typed no-working-directory status, which the service
records as an executable it could not locate, so the call still
resolves to a Result. Process capture, whose working directory is
already resolved, maps it to its working-directory input error.

Tests make process.cwd() throw ENOENT: an absolute command and target
identify and run without reading it, and a relative command or PATH
entry gets a Result with an assumed identity.

* fix(rizin): cut probe banners and diagnostics between code points

The banner and a failed probe's two diagnostic streams were cut at
2,048 UTF-16 code units, so a cut could leave a lone surrogate. REA
already owns this cut: boundedUtf8Text keeps text within a UTF-8 byte
budget without splitting a code point, as other providers' probes use
it.

The banner and both streams now go through it with a 2,048-byte budget,
and provider_version_banner_truncated and output_truncated come from
its truncated flag. The guide states the limits in UTF-8 bytes.

Tests cut an astral banner and astral diagnostic streams at the
boundary; an ASCII banner keeps its 2,048 bytes.

* fix(rizin): keep diagnostics for a banner that identifies no tool

When -v exited 0 but its banner identified nothing, Evidence recorded
only provider_version_banner: the probe's exit status, stderr and later
stdout lines were dropped, although the guide promises
provider_version_probe for any probe without a usable banner, and that
is when the assumed identity needs explaining.

Such a probe is now its own unrecognized outcome. It keeps the banner
and versionProbeDiagnostics(0, output), like the other unusable
outcomes, and Evidence records both; a recognized banner remains read.

Tests cover an empty first line with an explanatory stderr and a
Usage: banner followed by more lines.

* fix(rizin): identify nothing from a banner cut at its byte limit

identify ran on the banner even when boundedUtf8Text had cut it, so a
version token running past the 2,048-byte cut was published as an exact
provider.version.

A real banner is about 40 characters, so one guard is enough: a cut
banner identifies nothing. It becomes the unrecognized outcome, with the
probe's diagnostics and the assumed identity; no separate token parser
is added. The guide says so.

A test cuts a first line inside its version token; the banner-cap test
now expects no version from a cut banner.

* fix(rizin): accept only the -v banner Rizin and radare2 print

The banner pattern ^(\S+) (\d\S*) read any first line with a digit token
as an identity, so `Warning: 123 …` became tool "Warning:", version 123.

identifyRizinTool now accepts only the first-line form Rizin and
radare2 print: a plain tool token, a version, any build tokens, then
`@ <os>-<arch>-<bits>` and an optional `, <package>` suffix. The real
banners on this Mac fix the form: Rizin 0.9.1 (Homebrew) prints
`rizin 0.9.1 @ darwin-arm-64, package: 0.9.1_2 (Homebrew)`, and radare2
6.1.8 prints `radare2 6.1.8 +0 abi:110 @ darwin-arm_64`. Anything else
is unrecognized, with the assumed identity and the probe's diagnostics;
a well-formed radare2 banner keeps its non-Rizin limitation. The guide
gives the form.

Tests cover `Warning: 123 …`, a status line before the banner, a banner
without the @ suffix, and the real Rizin and radare2 banners. Two
fixtures that printed `@ test` as the platform now print a real form.

* fix(rizin): keep the probe's identification when the command fails to start

After a successful -v probe, a command that failed to start, such as an
oversized command the host refused with E2BIG, returned its typed error
without the tool, version, path, SHA-256 or banner the probe had
observed: only Evidence carried the identification, and these failures
build none.

The identification now records whether a probe ran. When one did, the
launch failure keeps `provider` and the provider_* parameters in its
diagnostics; the Evidence limitations, which describe command output,
stay out. A probe that is cancelled or whose cleanup is incomplete
keeps the executable path and SHA-256 it ran from. An executable that
was not located or could not be read adds nothing, since nothing about
it was observed.

A real-process MCP test probes a fake rizin, then fails the launch with
a real E2BIG (a 2 MiB command) and with ENOENT (the probe removes the
executable after a banner that identifies no tool). The probe
cancellation test checks the path and SHA-256. The guide says where the
facts appear.

* test(rizin): move tool-identity cases to boundary and process-global projects

The tool-identity cases run the real executable lookup and file digest,
which crosses the production filesystem boundary, so they move from the
shared-worker composition project to tests/boundary/filesystem. The two
cases that replace process.cwd move to tests/process-global, whose
isolated forks keep that process-global state from leaking into other
files. The fixture, fake runner and probe count they share move to
tests/support/rizinToolIdentity.ts.

* fix(process): resolve each PATH entry only when the lookup reaches it

Candidate construction resolved every PATH entry up front, so a relative
entry after the match (PATH=/opt/rizin/bin:.) read the working directory
before the absolute entry was checked. With that directory removed, the
lookup reported no-working-directory and skipped hashing and probing,
while the bare command still ran from /opt/rizin/bin with an assumed
identity. Each entry now resolves when the search reaches it.

* fix(rizin): run the found executable when it cannot be read for hashing

When the lookup found an executable that the hash could not read, such
as a native binary with mode 0111, identification fell back to the bare
command name. The command then searched PATH again instead of running
the file the lookup selected, so another executable could answer, and
Evidence lost the path that was observed. The fallback now keeps the
found path for the launch and as provider_executable_path, without a
SHA-256 or probe. The flag that keeps these facts on a launch failure
is renamed from probed to observed, since it now also covers a lookup
whose hash failed.

* fix(rizin): leave the version unknown when probe stderr is not valid UTF-8

An exit-0 probe with a valid stdout banner and malformed stderr was
accepted as a banner, and the read outcome dropped the probe's
diagnostics, so Evidence published the version while losing stderr and
its stderr_invalid_utf8 marker. The documentation says output that is
not valid UTF-8 leaves the version unknown; the probe now checks both
streams before reading a banner.

* fix(process): report no exit status for output that was not fully collected

execFileFailureCapturedOutput published a failed run's numeric exit
code even when its output was not fully collected. The command path and
the version probe's diagnostics already report null for that status, so
a probe that lost output and whose cleanup also failed carried
conflicting completion facts: null in provider_version_probe, a number
in the error's captured_output. The shared projection now owns the
rule, which also applies it to the ADB, Ghidra launcher, Doctor, Apple
asset catalog and Darwin process-token failures that use it.

* fix(rizin): bound the version banner as printed before trimming it

The probe trimmed the first line before applying its 2,048-byte budget,
so a line with more than 2,048 bytes of leading whitespace before a
valid banner lost that prefix unrecorded and was identified, with
provider_version_banner_truncated false, although the documented budget
covers the banner line. The budget and the recorded banner now cover
the line as printed; only identification reads a trimmed copy.

* fix(process): continue the PATH search past an unreadable relative entry

With the working directory removed and PATH starting with "." or an
empty entry, the lookup stopped at that entry with no-working-directory.
A spawned search finds nothing under a removed directory and moves on,
so the command still ran a later match by its bare name, while Evidence
reported an assumed identity without path, digest or version. The
lookup now skips such an entry and reports the unread working directory
only when no later entry matches; an explicit relative command still
reports it at once.

* fix(rizin): keep the found executable path when hashing it ends the call

When the hash of a PATH-selected executable reached the deadline or was
cancelled, the typed error kept only its phase. The call returns no
Evidence then, so the caller lost the provider_executable_path the
lookup had observed and could not tell which PATH location stalled,
although a cancelled probe and a failed hash keep that path. Both
errors now carry it in details.diagnostics beside the phase.

* fix(rizin): keep the PATH candidate a stalled lookup was checking

When the stat or access of a PATH candidate reached command_timeout_ms
or was cancelled, the lookup reported only that it was interrupted, so
the typed error carried phase executable_lookup and nothing else. The
caller could not tell which PATH location stalled, as on a slow network
mount. The interrupted lookup now returns the candidate it was checking,
and both errors carry it as executable_lookup_candidate.

* fix(rizin): state that the executable digest precedes both launches

REA hashes the selected executable before the -v probe and the command
run, so a file replaced in between gives a SHA-256 of the old file
beside the identity and output of the new one. The documentation said
so, but inline Evidence did not. Evidence that records
provider_executable_sha256, identified or assumed, now carries a
limitation saying the digest was read before both launches and does
not prove the bytes that ran.

* fix(process): check an unreadable relative PATH entry as written

12244b7a3 skipped a relative PATH entry whose working directory could
not be read, assuming nothing under a removed directory is reachable.
The kernel still resolves `..` from a removed directory, so with
PATH=../bin:/usr/bin a spawned search runs ../bin/rizin while the
lookup selected /usr/bin/rizin, and the service probed and ran that
other tool. Such an entry is now checked as written, against the
process's working directory: an entry without the executable lets the
search continue, and a match there ends the lookup with
no-working-directory, so the launch by name follows PATH order.

* test(rizin): join the hash-interruption call before teardown

The hash-interruption test waited for its gate with a bounded wait and
only released the gate and aborted the caller in finally, so a failed
wait left the call running past teardown. It now waits through
awaitAcknowledgement, keeps the call in pending, and in finally
releases the gate, aborts, joins the call and closes the service, as
the stalled-lookup test does.

* fix(rizin): keep the selected executable when the command fails to start

When the command failed to start after identification, for example with
E2BIG, the error kept the provider, the resolved path, the digest and
the banner, but not the executable the caller selected. Evidence records
it as provider_executable, and only the ENOENT launch branch carried it
as command; an E2BIG resource constraint carries just argument_bytes, so
a bare alias or configured path was lost. The retained diagnostics now
include provider_executable beside the lookup, hash and probe facts.

* fix(rizin): keep the selected executable on every error before Evidence

7a003942a kept provider_executable only on a launch failure after
identification. The lookup's, the hash's and the probe's errors also
end the call before Evidence exists, as does a launch failure without
identification facts, and none of them kept the executable the caller
selected, so a bare alias or relative spelling was lost. The service
now adds provider_executable to an identification error where it
returns, and to every launch failure, with the observed facts only when
there are some. inspect_with_objdump's launch failures keep it too.

* fix(rizin): mark a version probe whose completion is unknown

When the owned runner reported a collection failure with completed
cleanup and the partial streams fit the 2,048-byte cut, the probe's
diagnostics showed output_truncated false and no completeness field;
only the nulled exit code hinted that bytes were missing. The probe's
diagnostics now carry completion_status with the command's own rule:
unknown when output was not fully collected or the probe was killed,
signalled or left no exit code, and complete otherwise.

* fix(process): end the PATH search at errors a spawned search stops at

The lookup moved past every PATH candidate whose stat failed. A spawned
search moves past only a missing file, a non-directory and a denied
directory; at any other error, such as a symlink loop (ELOOP), it stops
and the launch fails. With PATH=<loop>:/usr/bin, the lookup selected
/usr/bin/rizin and the service hashed, probed and ran it, although a
launch by name fails. The search now ends there, reporting the error in
checked, so the launch by name fails as a spawned search would. A
non-executable file earlier on PATH still lets the search continue.

* fix(process): end the PATH search at execute-check errors a spawn stops at

c1d66e52f classified only stat failures: the execute check still moved
past any error, so an EIO from a failing network-backed PATH entry let
the lookup select a later executable that a launch by name would not
reach. Both checks now use one rule, searchMovesPast: a spawned search
moves past ENOENT, ENOTDIR and EACCES and stops at any other error. The
execute check is injectable beside stat, so the EIO case is tested.

* fix(rizin): state that the version banner, too, precedes the command

a2fc5a11f qualified only the executable's SHA-256 as a pre-launch
observation. The -v banner, and so the recorded tool and version, is
also read before the command runs, so a package update in between
attributes the command's output to the old version. The limitation,
renamed EXECUTABLE_OBSERVATION_TIMING, now says the SHA-256 and any -v
banner were read before the command launched and do not prove the bytes
or the version that ran; the documentation says so too.

* fix(process): skip PATH entries a spawned search cannot hold

c1d66e52f ended the search at any error a spawned search does not move
past, including ENAMETOOLONG. But glibc's execvp on Linux and libuv's
own search on macOS skip a PATH entry of at least PATH_MAX bytes (4,096
and 1,024) before trying it, so with a 5,000-byte entry first, a launch
by name ran /usr/bin/true while the lookup reported it missing, and
capture_process_scenario rejected a command that worked. Such entries
are now skipped before they are checked; a shorter entry with an
over-long component still stops the search with ENAMETOOLONG, as a
launch by name does. On Linux the search also moves past ESTALE, ENODEV
and ETIMEDOUT, as glibc's execvp does.

* test(rizin): check the timing limitation through its constant only

The regex added in 85eb3b6c0 froze the limitation's wording, which
docs/testing.md rules out: guidance delivery is checked against the
owning constant, beside independent assertions for the facts. The test
keeps the EXECUTABLE_OBSERVATION_TIMING delivery check and its
provider, path, digest and banner assertions; a harmless rewording now
passes.

* fix(process): skip long PATH entries only where the host's limit is known

3e32a4422 used a 1,024-byte limit on every host other than Linux, so on
Android (Termux), where execvp has a 4,096-byte buffer, a valid
1,500-byte PATH entry was skipped and a later rizin ran. The length skip
now applies only on Linux (4,096 bytes, glibc and musl) and macOS (1,024
bytes, libuv); elsewhere an over-long entry stops the lookup, and the
launch by name lets the host's own search decide. By the same rule, the
lookup no longer moves past ESTALE, ENODEV and ETIMEDOUT on Linux: glibc
does but musl does not, so the lookup stops there too, leaving the tool
unidentified rather than possibly wrong.

* fix(rizin): keep a probe's timeout when its cleanup is also incomplete

When the -v probe reached command_timeout_ms and stopping it left
cleanup incomplete, the incomplete-cleanup branch ran first and returned
an AnalysisOutputError, so the error said only that cleanup remained and
lost the timeout and its remediation, even after a cleanup retry. The
command path keeps the AnalysisTimeoutError and attaches the cleanup;
the probe now does the same, so the timeout stays the failure, the call
still ends, and the owner is retained until it stops.

* fix(rizin): keep the target's path and digest on errors before Evidence

The lookup, hash and probe errors, and launch failures, end the call
before Evidence exists, after the target was already resolved and
hashed, but kept only the selected executable and provider facts. The
caller could not bind the failed attempt to the artifact it submitted.
Every such error now also keeps artifact_path and artifact_sha256 for a
call with a target, beside provider_executable.

* test(rizin): expect the long PATH entry skip only on Linux and macOS

The long-entry case required a skip on every POSIX host, but the length
skip applies only on Linux and macOS; on Android and other hosts the
lookup stops with ENAMETOOLONG instead, so the test failed there although
the lookup behaved as intended. It now expects the skip on Linux and
macOS and the stop elsewhere.

* fix(rizin): defer an unstartable file to the host and bound stalled I/O

The lookup took an executable regular file as the match, but a spawned
PATH search also moves past a file that fails to start with ENOENT,
such as a script whose interpreter is missing. Pinning the probe and
the command to that file failed calls that the host would run. When
the version probe does not start, the command now runs as selected,
with the version unknown, and a limitation names the file.

A lookup that stops waiting for a stalled stat or access leaves the
call running, and later lookups of the same path now share it instead
of starting another, so retries no longer add calls on an unresponsive
mount. digestFile ends at its deadline or on cancellation even while
the file's open is pending; a destroyed stream reports its error only
after that open returns. A lookup the host refuses to inspect runs the
resolved path and keeps it as provider_executable_path, also when the
launch fails.

Process capture verifies the file it launches, so it still rejects a
scenario where native searches disagree; its docs now say so.

* docs(rizin): say the lookup stops where any native search stops

The lookup stops at every error other than a missing file, a
non-directory or a denied directory, because at least one native
search stops there; musl's stops at each of them. At a symbolic link
loop or an I/O error the searches agree, so "do not agree" was wrong
there. The process-capture docs and resolveExecutable's comment now
state the same rule.

* fix(rizin): bound stalled hash opens and defer EACCES launches

The interruptible hash let each timed-out retry start another open on a
stalled mount, outside the eight-operation cap. A later hash of the same
path now waits, within its own deadline and cancellation, for an earlier
open that has not returned, and hashes share a stalled stat through the
helper lookups use, now src/process/SharedFileCall.ts.

A probe launch that fails with EACCES, as for a script whose interpreter
is not executable, is one a native PATH search moves past, like ENOENT,
so the command now runs as selected. The shared-check test bounds its
gate wait and joins its started checks in teardown.

* test(rizin): return stalled opens and join their streams in finally

The open-gate test returned its stalled open only after its assertions
passed, and the deadline and cancellation test never returned its open,
so a failed assertion, or every run, left a stream waiting on a pending
open. docs/testing.md asks for held work to be released and joined in
finally. A shared helper now holds each stalled open; both tests return
it, destroy the stream and wait a bounded time for its close in finally,
so a failed assertion is still reported as itself.

* refactor(rizin): own the version-probe types in the domain layer

RizinCommand.ts imported ProviderToolIdentification and
ProviderVersionProbe from the application port, so the Rizin provider
depended on the application layer; the architecture has Rizin depend on
the domain only. Move both neutral types into
src/domain/reverseEngineering.ts beside the command inputs. The port,
the service and the Rizin adapter import them from there.

* fix(rizin): hold a hashed path until its stream closes

A hash released its path when the file's open returned. A read that a
stalled mount then held kept its libuv worker after the digest timed
out, while the next hash of the same path opened the file again, so
repeated hashes could start stalled reads without bound. Keep each
stream registered until it closes: a file stream closes only after its
pending open or read returns, so a later hash of the path waits for it,
and stalled opens and reads stay bounded by the paths.

* fix(rizin): make hashes wait only for streams an earlier hash gave up

13515107a kept every hash's stream registered until it closed, so a
hash waited for every earlier hash of the same path, healthy ones
included, and concurrent calls on one target could spend their deadline
waiting and time out before they launched. Register a stream only when
its hash gives up while its open or a read is pending, and keep it until
it closes. Later hashes of that path wait for those streams, so abandoned
I/O stays bounded by the paths, while hashes that have not given up no
longer wait for each other.

* fix(rizin): keep an explicitly selected path the lookup does not accept

An explicitly selected command that resolved to a file without execute
permission ended the lookup as missing, with its absolute path only in
the checked strings. The command then ran by its relative name, and the
launch failure lost provider_executable_path. A missing lookup now
reports the path an explicit selection names, and the service runs that
path and keeps it, as it does for a path the host refuses to inspect.
Process capture ignores the field and still rejects such a file as an
invalid selection.

* fix(rizin): keep an explicit path's facts when its probe does not start

When the version probe of an explicitly selected path failed to start,
as a script with a missing interpreter does, the command ran the
selection as written and kept nothing the lookup and hash observed, so
its launch failure lost the resolved path and SHA-256. An explicit
selection has no later PATH candidate for the host to try. The lookup
now marks a found explicit path with selectedPath, and the service runs
that path and keeps its observations, while a PATH match still runs by
name for the host's search to decide.

* fix(rizin): launch a selection the lookup did not accept as spelled

73554211b launched the absolute path an explicit selection names
whenever the lookup did not accept it. A relative selection that fits
the host's path limit can have an absolute spelling that does not, so a
command that launched before failed with ENAMETOOLONG. Launch the
selection as the caller spelled it again, and keep the resolved path in
Evidence and launch failures as provider_executable_path. A path the
host refused to inspect still launches as resolved.

* test(rizin): release and join the concurrent hashes in their test

The concurrent-hash test left both hashes running when its wait for the
second open failed, so their later rejections could hide that failure.
Wait with awaitAcknowledgement, settle both hashes together, and destroy
the streams and join the hashes in finally.

* fix(rizin): let the host's search decide after ESTALE or ENODEV probes

When the version probe of the file the lookup found failed to start
with ESTALE or ENODEV, the service recorded a failed probe and ran that
file again, although glibc's PATH search moves past such a file and
musl's stops there. Treat both like the errors every search moves past:
the command runs by name and the host's search decides, as the lookup
does where native searches differ. ETIMEDOUT stays the probe's deadline,
which both runners report with that code.

* fix(rizin): keep a call's place until its abandoned file streams close

A call that ended at its deadline while a hash's stream was stalled on
an unresponsive mount freed its place among the eight concurrent
operations, though the stream's read or close still held a libuv worker,
so calls on different files could pile up stalled file work without
bound. A successful hash also completed at its stream's end, before a
close that could stall. A hash now completes when its stream closes, so
a stalled close reaches the deadline as a stalled read does, and each
stream a hash gives up on is reported to the service, which keeps the
call's place until those streams close. The capacity error counts such
calls as operations_awaiting_file_close.

* test(rizin): keep disk reads and prose out of two tests

The admission test for abandoned file streams called the real
digestFile once its files closed, reading the disk in a composition
test; its fake now returns a fixed digest. Two assertions matched the
not-started limitation's whole phrase; they now check that a
limitation names the skipped file and its launch error, so rewording
the limitation does not fail them.

* fix(rizin): give file work that a call gives up on one owner

A lookup or hash that reached its deadline while a stalled mount held a
stat or access check gave the call's place among the eight concurrent
operations back, although that check still held a libuv worker. Streams
were already held, through a separate map, a callback threaded through
three layers and a second set in the service, while stat and access
checks were shared through a third, module-level map.

FileWork now owns all of it. Each call runs its stat, access and stream
steps through a scope of the service's FileWork under one deadline. A
step the deadline or cancellation interrupts is left with the scope that
started it, later work on that path waits for it instead of starting
more, and the service keeps the call's place until what it left has
returned. A call that only waited for another call's work leaves nothing
and keeps no place. The capacity error counts held calls as
operations_awaiting_file_work.

digestFile takes its bounds as one object, like lookupExecutable.
SharedFileCall, the stream map, the onAbandoned callback and the
per-step deadline helpers are removed, and the two edge-case tests that
probed the gap between the old stat and stream listeners now check the
single deadline instead.

* fix(rizin): let a call that stops waiting for left file work detach

A call waiting for file work left behind on its path raced a
Promise.all over that work against its deadline. When the deadline won,
the reactions stayed attached to the stalled work's promises, so retries
on a stalled path kept about 2 KiB each until the mount answered: 207 MiB
over 100,000 interrupted waits. Each waiting call now adds a wake
function to the path's left work and removes it when it stops waiting,
and the last left step on the path wakes the waiters that remain. The
same measurement retains 2.5 MiB, and 4.5 MiB over 400,000 waits.

* fix(rizin): keep where a stopped PATH lookup stopped

When the lookup of a bare command stopped at a candidate whose error at
least one native search stops at, such as ELOOP, EIO or ESTALE, the
command ran by name, but Evidence and launch failures said only that
the executable could not be located. The candidate and its code existed
only as display text in the lookup's checked list. The lookup now
returns them as stoppedAt, and the service names them in the limitation
and keeps them as executable_lookup_candidate and executable_lookup_code.

* fix(rizin): report held file work when the service closes

close() aborted active calls, awaited their results and retried process
cleanup, then resolved, although a call that had returned could still
hold a stat, access or stream step that an unresponsive mount had not
answered. Waiting for that work could hang shutdown on a mount that
never answers, so close now fails instead with a cleanup error that
names file_system_work and counts the calls holding it
(operations_awaiting_file_work), and a later close checks again, as it
does for retained provider processes.

* fix(rizin): keep stalled file work out of close

ad4a22b32 made close() fail while a call still held file work that a
stuck mount had not returned. That error could not clear once the work
returned, it hid behind a process-cleanup failure, and the CLI replaced
the command's own error and Evidence with it. Close cannot release that
work anyway: it cannot be cancelled, joining it would hang shutdown on a
mount that never answers, and the runtime keeps the process alive until
it returns. close() again aborts active calls, awaits them and retries
process cleanup; the call keeps its slot until its file work returns.

* fix(rizin): bound stalled file work by the thread pool

Each stalled stat, access or stream step holds a thread of libuv's pool,
which Node sizes at 4, while the eight-call cap allowed eight on distinct
paths. Four would stall every other file, DNS and compression call in the
process. The pool belongs to the process, so FileWork now has one
process-wide owner, HOST_FILE_WORK, with a budget of 2 held steps. Past
it a new step starts nothing: the service reports a retryable capacity
error with file_steps_held and max_held_file_steps, and the lookup returns
saturated, which capture reports too. A step on a path that already has
stalled work waits and takes no thread. The service takes its owner as an
option, and test services get their own.

* fix(cli): exit after a command while a stalled file step is held

A pending system call keeps Node's event loop alive, so a CLI command
that timed out on a stalled mount wrote its result and then stayed
running until the mount answered, which may be never. The launcher now
asks the CLI runtime whether the process holds stalled file work and, once
the result is delivered and stdout has drained, exits explicitly. Runs
that hold no stalled work end as before.

* fix(rizin): reserve the file-step budget before a step starts

The budget counted only steps already left behind, so calls that stalled
together all started while it read zero, and eight concurrent stats could
exhaust the pool. A step now reserves the budget before it starts and
releases it when the underlying work settles. A step waits within its
deadline while running steps fill the budget, and is refused once
left-behind steps fill it. The budget is half of libuv's pool as
UV_THREADPOOL_SIZE sizes it, with at least one step, instead of a fixed 2.
A refused target preflight also keeps its path as artifact_path.

* fix(rizin): keep unbounded file work out of the shared budget

Process capture's executable lookup has no deadline, so a stalled check
would stay running forever, fill the shared budget and make healthy
captures wait without end. A lookup or hash that is given no owner now
joins no budget, so capture behaves as it does on main, and only the
service, whose calls have deadlines, shares the process-wide owner.
Tests that count steps fix their budget instead of inheriting the host's
UV_THREADPOOL_SIZE, and the concurrent-step tests use bounded waits and
release their work in finally.

* Revert "fix(cli): exit after a command while a stalled file step is held"

This reverts commit 4a4bb74bc. It did not work: process.exit() also
hangs while a pool thread is stuck in a system call, because Node joins
the pool at exit. Its test passed only because the simulated stall held
no thread. The docs now state the limit: a CLI command prints its result
and then stays alive until the mount answers. A real exit path needs a
process-wide design and goes to the maintainer proposal.

* fix(rizin): keep a found file that did not start as a candidate

When the file a bare command's lookup found did not start, the command
ran by name, and a failed launch then lost that file's path, digest and
launch error. Evidence and launch failures now keep them as
executable_lookup_candidate, executable_lookup_candidate_sha256 and
executable_lookup_code, without claiming that the candidate ran.

* fix(rizin): keep why a post-run digest or lookup gave no answer

A post-run hash that the file-step budget refused was reported as an
artifact that could not be read. Evidence now keeps the command output
with artifact_digest_after_refused and a limitation saying the artifact
was not read. A lookup that needed an unreadable working directory also
lost that outcome when the launch by name failed; it now keeps it as
executable_lookup_outcome and executable_lookup_code.

* test(rizin): compare the post-run limitation through its owner

The refused post-run digest test froze one explanatory phrase and banned
another. It now keeps the structured refusal facts and checks that the
unreadable-artifact limitation, an exported constant, is absent.

* fix(rizin): keep preparation failures' output and cleanup

Ownership preparation throws its own failure, or an interruption wraps
it, and runOwnedCommandOutput recognized neither. The compiler output
was lost and a retained helper could not be retried, for the version
probe and for the command. Normalize both shapes at that boundary, so
preparation is a launch failure that carries its output, and its
cleanup reaches retryCleanup through the same stop contract.

* refactor(rizin): drop the shared file-work pool from tool identity

A maintainer asked to separate the shared FileWork pool from this PR
until the lifetime design in #8860 settles. The pool kept a call's place
while file work it gave up on was running, made later work on that path
wait for it, reserved half of libuv's pool as a budget of stalled steps,
and refused new steps with a capacity error once that budget was held.

The lookup and hash now run each stat, access and stream step under one
deadline and cancellation listener (FileDeadline). A step the call stops
waiting for keeps running until its mount answers, untracked, as main's
stat already did. The call returns and gives back its place. The
saturated lookup outcome, FileWorkSaturatedError, the
operations_awaiting_file_work count and artifact_digest_after_refused
are removed, with the tests that covered them. New tests check that a
call gives back its place at its deadline, and that a hash ends at its
deadline on a stalled open, read or close while a later hash of the
path starts its own read.

The pool is kept on the fork branch rizin-filework-pool.

* fix(rizin): keep the PATH candidate a launch by name is denied

When a bare REA_RIZIN_COMMAND finds only a file without execute
permission or a candidate under an unsearchable directory, the lookup
records it only as display text, and the by-name launch then fails with
EACCES. The capability error kept neither selectedPath nor stoppedAt, so
it lost the file whose permissions need repair. The lookup now reports
the first PATH candidate it moved past with EACCES as deniedAt, and the
service keeps it as executable_lookup_denied_candidate in Evidence and
launch failures, with a limitation naming it.

* fix(rizin): keep a non-regular PATH candidate a launch by name is denied

A launch by name also fails with EACCES when the only PATH match is a
directory or another non-regular file, which execve refuses; the lookup
kept that candidate only as checked display text. deniedAt now covers it
and carries its reason, permission or not-regular-file, which the service
keeps as executable_lookup_denied_reason beside the candidate and names
in its limitation.

* fix(process): mark invalid UTF-8 where execFileBytes decodes a failure

execFileOutputFailure projects stdoutInvalidUtf8 and stderrInvalidUtf8,
but execFileBytes decoded a failed command's buffers without setting
them, so direct runner callers such as adb reported replacement
characters without the stdout_invalid_utf8 and stderr_invalid_utf8
markers. The failure now validates each buffer when it decodes it, on
both the execFile and owned-spawn routes, and execFileOutput's result
marks invalid streams the same way, as the owned process runner does.

* test(process): expect the invalid UTF-8 marker on compiler failures

The Darwin token reader's compiler capture now reports stderr_invalid_utf8
for a replaced byte, and the decoding tests get their own block under the
150-line function limit.

* fix(reverse): report a post-run digest deadline with its recovery

A post-run hash that reached command_timeout_ms, for example at a close a
stalled mount holds, fell into the empty catch and was reported as an
unreadable artifact. It now adds a limitation naming the deadline
(ETIMEDOUT) and how to raise command_timeout_ms, and the command's Evidence
is kept. The deadline-raising sentence is shared with the timeout error.

* refactor(rizin): retain version-probe preparation through main's inspection owner

main's #10113 owns ownership-preparation failures for the command: it
maps them to analysis errors and retains their cleanup in the service's
inspection scope. This branch had its own copy in runOwnedCommandOutput
(630610d30), so a retained helper now had two owners, and the copy no
longer typechecked against the inspection-failure union.

The runner returns to main's version. Main's two inline mappings become
one ownershipPreparationError, which the command and the version probe
share: a preparation that fails or stops during the probe ends the call
as it would for the command, and its cleanup joins the same scope, so
retryCleanup closes the helper once. A deadline that interrupts Darwin
preparation keeps the compiler output, as a failed preparation does.

The preparation tests read the primary error under the cleanup wrapper;
main's two new collection-failure tests use this branch's processes
option.
reverseProviderLaunchErrors.test.ts returns to main's version: the
retry assertions this branch added there expected a cleanup failure with
no owner to be retried by polling its state, which main's owner does not
retain; the error still reports the cleanup as incomplete.

* refactor(rizin): parse an ownership preparation failure once before mapping it to an error

* test(rizin): expect PATH entries on search candidates and the launched path in launch failures

* refactor(process): take the host platform of an executable lookup from its caller

* test(rizin): register the renamed Rizin cancellation test for lifecycle coverage

The cancellation test now covers the command and the version probe as
"waits for a Rizin process cancelled during its %s to exit before
returning", so the lifecycle coverage registry names that title.

* test(rizin): assert the facts a post-run digest deadline names, not its wording

The limitation must name the setting that stopped the hash, its value and
the error code; the recovery sentence belongs to nativeDeadlineRecovery,
whose wording may change.

* fix(rizin): keep host capacity during version-probe preparation retryable

When the ownership helper's compiler could not start for EAGAIN, EMFILE,
ENFILE or ENOMEM, the version probe mapped the failure to a non-retryable
ownership-preparation error with setup remediation, while the command
path classifies the same condition as a retryable resource constraint.
Run the shared preparationHostCapacityFailure owner first in the probe,
as the command does, and test each of the four codes.

* test(rizin): create the abandoned-stat fixture with createTestTempDirectory

The fixture root came from mkdtemp before the try block, so a setup failure
skipped its removal. createTestTempDirectory registers the cleanup when it
creates the root.

* test(rizin): align tool identity assertions with normalized_result and clean up lookup

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-24 14:22:27 +00:00
morluto 609b58b109 perf(debugger): stop repeating command results as raw_result (#14146)
* perf(debugger): stop repeating command results as raw_result

GDB console/startup, Rizin debug, Cutter and reverse-engineering command
Evidence set rawResult to a copy of result, contrary to the raw_result
contract. Every interactive debugger reply therefore carried its records
and output twice. Omit rawResult where no distinct provider
representation exists; tests assert the same facts on normalized_result.

Closes #14145

* test(debugger): assert command results on normalized_result in remaining suites

The composition, CLI delivery, acceptance and MCP suites still read
command output through raw_result, and one fixture built a parent
Evidence record that repeated its result as raw_result. They now assert
the same fields on normalized_result and that raw_result is null.
2026-11-23 17:55:57 -05:00
morluto 9899c6659a test(reverse): consolidate command outcome coverage (#12776) 2026-11-20 12:34:17 +00:00
385e5d228f test: own temporary directories through createTestTempDirectory in remaining tests/ (#12727)
* test: own temporary directories through createTestTempDirectory in remaining tests/

Give per-test directories in the remaining tests/ suites to
createTestTempDirectory so onTestFinished removes them through
removeTestWorkspace. Keep suite-scoped roots and child-process directories
whose removal is the assertion.

* test: drop empty cleanup callbacks and keep the capture skip reason visible

Remove the no-op withVerifierCleanup steps left after directory removal
moved to createTestTempDirectory. Put the native capture skip explanation
in the Linux sample test name, because it.skipIf only tests truthiness.

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>
2026-11-19 23:22:53 -05:00
morluto 53fa95317a test: prove deadline sharing and early observation end without elapsed-time bounds (#11664)
The preflight digest case runs on a fake clock and asserts the timeout at exactly 200 ms. The fatal-protocol observation case uses a window longer than any test deadline, so waiting it out fails as a deadline instead of passing a 5 s bound.
2026-11-15 21:25:53 -05:00
morluto dbb4bc29f0 fix(process): classify every launcher failure once by errno in the shared launch owner (#11615)
* fix(process): classify every launcher failure once by errno in the shared launch owner

* fix(process): keep the launch owner's syscall, cause and facts in RE and pwntools unavailable reports
2026-11-16 08:24:39 +08:00
morluto 2430b081c9 refactor(providers): bind provider refusals' per-call controls instead of naming CLI flags (#11455)
* refactor(native): bind producer_limits and max_input_bytes as the per-call controls of pwntools and Apple dispatch refusals

producerLimitControl in src/domain/producerResourceLimits.ts names one producer budget as producer_limits.<field>; the shared provider outcome classifier now carries a resource signal's limit. Pwntools file-size, CPU and output refusals and the Apple dispatch input refusal bind their control, and their remediation no longer names CLI flags.

* fix(native): report the selected output allowance as the omitted file_bytes default

* fix(native): bind producer_limits.diagnostic_bytes as the pwntools command output-limit control

* refactor(rust): bind producer_limits as the per-call control of Rust input and report refusals (#11458)

* refactor(rust): bind producer_limits as the per-call control of Rust input and report refusals

* test(rust): cover the complete-report refusal's producer_limits control

* refactor(browser): bind caller-selectable browser deadlines as per-call controls instead of naming CLI flags (#11466)

* refactor(rust): bind producer_limits as the per-call control of Rust input and report refusals

* test(rust): cover the complete-report refusal's producer_limits control

* refactor(browser): bind caller-selectable browser deadlines as per-call controls instead of naming CLI flags

deadlineParameterLimit in src/domain/analysisResourceLimits.ts owns the millisecond deadline control that nativeDeadlineRecovery and the browser recoveries share. CDP command and discovery, web bundle per-script and total, network capture and source-map decode deadlines now carry it; browserDeadlineIncrease no longer takes CLI flag text.

* fix(browser): record a per-script deadline's parameter control in partial web bundle results

* refactor(providers): bind Wabt, SQLite, EVMole, Apktool and Go controls instead of naming CLI commands (#11472)

* refactor(providers): bind Wabt, SQLite, EVMole and Apktool deadline and byte controls instead of naming CLI commands

These remediation strings named rea commands and flags through template text the cli-option guard did not count. Wabt byte refusals and output limits bind max_input_bytes, max_tool_bytes or max_output_bytes while a larger value is selectable; SQLite worker_timeout_ms, EVMole timeout_ms and Apktool decode_timeout_ms bind through deadlineParameterLimit; the shared provider outcome classifier now carries an output limit's control.

* refactor(go): bind Go analysis budgets as per-call controls instead of naming CLI flags

* fix(providers): keep the typed primary when Wabt, EVMole or pwntools command cleanup fails

* ci(guards): count template-built CLI option and command text outside the CLI layer (#11478)

* refactor(providers): bind Wabt, SQLite, EVMole and Apktool deadline and byte controls instead of naming CLI commands

These remediation strings named rea commands and flags through template text the cli-option guard did not count. Wabt byte refusals and output limits bind max_input_bytes, max_tool_bytes or max_output_bytes while a larger value is selectable; SQLite worker_timeout_ms, EVMole timeout_ms and Apktool decode_timeout_ms bind through deadlineParameterLimit; the shared provider outcome classifier now carries an output limit's control.

* refactor(go): bind Go analysis budgets as per-call controls instead of naming CLI flags

* fix(providers): keep the typed primary when Wabt, EVMole or pwntools command cleanup fails

* ci(guards): count template-built CLI option and command text outside the CLI layer

The cli-option-text-outside-cli pattern now also matches "(CLI ...", "on the CLI", "or use rea ..." and backticked `rea <command>` references, so remediation built from a template such as --${name} or rea inspect-... <path> is counted. Doctor.ts is exempt: setup and doctor run only through the CLI. The baseline records the newly counted pre-existing sites (22 -> 45 across 21 files).

* ci(guards): extract the CLI text matcher, exempt host-only commands with written reasons, and test each spelling

* ci(guards): exempt a host-only command and its own arguments in any matched CLI phrase

* fix(native): bind producer_limits.output_bytes for oversized pwndbg debugger replies through one owner

* fix(cli): name an Evidence target source failure's control by the source option that sets it

* feat(cli): render the flags of result-recorded controls in the full-output envelope (#11507)

* feat(cli): render the flags of result-recorded controls in the full-output envelope

* fix(cli): collect result controls only for a full-output envelope, in its requested format, past undefined values

* ci(guards): end a host-only command's arguments before the next CLI command

* refactor(reverse): record the output budget that stopped a one-shot command as a parameter control (#11528)

* fix(cli): read result controls only at positions the output schema declares as recorded controls

* refactor(providers): record the controls that bounded Rust compiler paths and kernel module text instead of naming CLI options (#11532)

* refactor(rust): record the control that bounded compiler-path coverage instead of naming CLI options

* refactor(native): record the controls that omitted kernel module .modinfo text instead of naming CLI options (#11534)

* fix(rust): describe compiler coverage from the retained result after report trimming

* refactor(providers): record managed representation and JavaScript semantic ceiling controls instead of naming CLI options (#11537)

* refactor(managed): record the representation budget on a resource-limit issue instead of naming its CLI option

* refactor(javascript): record the semantic retention ceilings that stopped a graph instead of naming CLI options (#11540)

* fix(cli): name a composed command's source options for the controls its result records

* fix(cli): read result controls from the delivered Evidence when a summary wraps it

* fix(rust): keep the report-byte control recorded when trimming omits every compiler path

When the complete-report allowance left room for no compiler path, rustc_commit became null and its coverage.limit was lost, so --full-output could not name the option that raises the allowance. The report now records rustc_commit_omission { reason, limit } outside the dropped record, and the summary view carries it.

* refactor(flutter): record the string-pool budgets that left a projection partial instead of naming the CLI option (#11541)

* refactor(flutter): record the string-pool budgets that left a projection partial instead of naming the CLI option

* test(flutter): assert the complete set of recorded string-pool budgets

* feat(cli): name the options of controls a failure's partial Evidence records (#11557)

meta.cli_controls was collected only from a successful result. A failure whose partial observation is Evidence of the command's own operation is now read the same way, at the positions the output schema declares as recorded controls; Evidence of another operation or a retained reference is not read. When --evidence_output publishes the partial, the delivery records it before replacing it.

* refactor(javascript): record the evaluator budgets that limited sources instead of naming the CLI option (#11564)

Per-value unknown reasons and the Electron wrapper limitation named --semantic-precision. The static examination now records the semantic_precision controls that limited a source (examination.controls), and analyze_javascript_application's semantic_graph.coverage.controls records every evaluator budget that limited any source (examination and semantic IR coverage), beside the retention ceilings. The CLI renders --semantic-precision from those records in meta.cli_controls; the reason texts name only the contract field.
2026-11-16 07:12:16 +08:00
morluto 1f24b3fa57 feat(evidence)!: name the Evidence subject by its target identity (format revision 2) (#11416)
* feat(evidence)!: name the Evidence subject by its target identity (format revision 2)

The Evidence subject carries subject.identity (kind, sha256, format,
architecture, selection) and the Evidence ID commits to it, so raw/DOL
entry points and ESP flash offsets of the same bytes are different
subjects. Every record declares evidence_format: 2; revision 1 bundles,
standalone records and snapshots are refused with the recreate guidance.
binaryTargetIdentity is the one projection of an open target, used by
Evidence and snapshot comparison.

BREAKING CHANGE: Evidence format revision 2. Evidence IDs commit to the
subject's target identity (subject.identity, including the raw/DOL entry
point or ESP flash offsets), and every record declares evidence_format: 2.
Evidence bundles, records and analysis snapshots from earlier releases are
refused; recreate the observations with this release.

* refactor(analysis-view): read parent subjects through the Evidence identity accessors (#11423)

Analysis views compare their parent's file identity (evidenceFileTarget)
and take path and digest from evidenceSubjectTarget instead of reading
the subject's digest, format and architecture members, which duplicate
subject.identity until they are removed. A counted guard
(evidence-subject-declaration-read) keeps new direct reads out and
records the 20 remaining files.

* fix(evidence): carry format refusals through Evidence readers and bind target selections

- safeParseEvidence/safeParseImmutableEvidence return the format refusal as
  an expected failure; every consumer maps it to the one integrity refusal
  with the recreate guidance. An unmarked object is an earlier record only
  when it has every member records have always carried.
- ArtifactProvider inventory roots and provider subjects that name the
  target's own bytes carry the target's selection (ESP flash offsets).
- Snapshot rows bind only Evidence whose identity, selection included,
  matches the snapshot target.
- Entry-point selections use the raw-binary entry point form.

* fix(evidence): refuse unauthenticated or earlier-format records instead of reading them as absent

- recognizeEvidence (evidenceValidation) replaces tryParseEvidence: input
  without an evidence_id is not Evidence (ok(undefined)); a record that names
  one but fails authentication or is from another format revision is an
  EvidenceIntegrityError carrying the recreate guidance, never undefined.
- Direct analysis retains that refusal as a secondary failure instead of
  silently skipping source capture; cleanup projection, source-closure
  annotation and the flutter, debugger and release-exposure recoveries use
  the same owner (the last three previously read the unauthenticated schema).
- A desktop capture.json from an earlier format is refused with the recreate
  guidance instead of "not desktop application capture Evidence".

* fix(evidence): advertise revision 2 ledger examples and rank delivery omissions by serialized size

- The obligation ledger and reconstruction coverage examples named
  evidence_format 1, which revision 2 refuses; they now use
  EVIDENCE_FORMAT_REVISION.
- MCP delivery chose which unretained recovery to omit by a parsed-storage
  lower bound clipped at the response budget. Once revision 2 subjects made
  the source record's estimate cross the budget, both candidates tied at the
  clip and the smaller source was omitted ahead of the larger completed
  observation. Candidates are now ranked by serialized size, which is what
  the budget counts.

* refactor(native): compare function snapshots by their Evidence target identity (#11450)

Function snapshots carry the subject's file target identity instead of the
duplicated subject declaration. Call paths and function comparisons compare
targets through sameTargetIdentity, so the same bytes opened at a different
raw entry point or ESP flash offset no longer count as one coordinate space:
build_call_path refuses the mix, and compare_functions no longer matches
entries by address across selections. Structural candidates and native
function matching read the architecture and digest through
evidenceFileTarget.

Refs #11417

* refactor(artifacts): compare artifact and WASM summaries by their Evidence target identity (#11461)

Artifact comparison authenticates a summary against its retained inventory
through sameTargetIdentity and rebinds the alias with the whole target,
selection included, so a flash-selected inventory summary taken under an
alias path is no longer refused. WASM comparison, the analysis view
artifact projection and the inventory root check read the digest, format
and display path through the Evidence identity accessors.

Refs #11417

* refactor(evidence): read record subjects through the identity accessors in JS, managed, ledger and bundle readers (#11470)

JavaScript application graphs, runtime reconciliation, managed inspection
and native verification sources, the record summary filter, the ledger's
residual-unknown target and bundle scope selection read the subject digest,
format and display path through evidenceFileTarget and
evidenceSubjectDisplay. No comparison changes: each reader matches one
record's facts against its own payload or a caller filter.

Refs #11417

* refactor(evidence)!: name the Evidence subject only by its target identity (#11497)

* refactor(evidence)!: name the Evidence subject only by its target identity

The subject keeps `identity` and the display facts `name` and `local_path`.
The duplicated `digest`, `format` and `architecture` members are removed; the
format-owned declaration now validates the identity itself. Readers the type
checker found move to the owner accessors; untyped reads in verify scripts,
the efficiency harness and test matchers move to `subject.identity`. The
`evidence-subject-declaration-read` text guard and its baseline are deleted.

Fixes #11473
Refs #11417

BREAKING CHANGE: the Evidence subject no longer has `digest`, `format` or
`architecture`; read `subject.identity.sha256`, `subject.identity.format` and
`subject.identity.architecture`. A record that still carries them is refused.

* test(evidence): give the Flutter verifier fixture the identity subject and check the DOL declaration without the ID

* test(evidence): drop the removed subject members from the declaration matrix and tamper fixtures

* feat(evidence)!: give every Evidence record an explicit subject identity (#11536)

* feat(evidence)!: give every Evidence record an explicit subject identity

A producer that cannot name a file passes an `unknown` target identity
with a closed reason (derived-from-linked-evidence, not-observed,
unsupported-subject) instead of no subject. The subject is non-null;
unknown subjects have no display facts. The generic missing-subject
limitation and `subjectUnavailableReason` are removed; producer-specific
explanations are ordinary limitations. Comparison identity requires the
derived unknown, and null-subject consumers ask the owner accessors.

Refs #11417

BREAKING CHANGE: every Evidence record has a subject. A record without a
file target names `subject.identity` `{ "kind": "unknown", "reason": … }`
with `name` and `local_path` null, instead of `subject: null` and the
limitation "Artifact identity is unavailable for this observation.".
Their Evidence IDs change.

* fix(evidence): name explicit unknown subjects in JavaScript callers and keep a managed graph's file subject

The verification scripts are not type-checked, so five createEvidence
callers still passed undefined (or a missing first target) after the subject
became required. They now pass unknownTarget("not-observed").

A managed application graph chose the first present input subject. Every
subject is now present, so an unknown artifact subject hid a file subject on
the member or boundary Evidence. The graph now takes the first input subject
that names a file.

* test(evidence): assert the subject kind instead of a presence the type now guarantees

Every Evidence record has a subject after this change, so test guards and
assertions that checked it for null always passed. Each now checks that the
fixture subject names a file, or is removed where a later fileIdentity,
fileSubjectTarget or fileSubjectDisplay call already requires that. Non-null
assertions on Evidence subjects are removed; analysis-view inputs, whose
subject is optional, keep an undefined check.

* test(evidence): expect the Evidence subject format under its identity

Two boundary tests still matched subject.format, which slice 2e moved into
subject.identity. toMatchObject is not type-checked against the Evidence
shape, so they failed only when run (the signature test on macOS).
2026-11-16 06:28:01 +08:00
morluto 39537b95af refactor(reverse): let objdump and Rizin own their Evidence limitations and name the provider a deadline bounded (#11113) 2026-11-15 20:49:24 +08:00
morluto 7826e9688d refactor(reverse): fake objdump and Rizin commands only through the owned supervisor (#11076)
* refactor(reverse): fake objdump and Rizin commands only through the owned supervisor

* test(reverse): fake launch refusals and failed exits as the owned supervisor reports them

* refactor(reverse): name objdump and Rizin command repairs through the command port (#11080)
2026-11-15 20:06:13 +08:00
morluto 422cff00ab refactor(process): give POSIX PATH search order one owner (#10891)
* refactor(process): give POSIX PATH search order one owner

Program lookup, the packet-tool locator and Jadx's Java lookup each split
PATH and resolved empty and relative entries themselves. They now take the
candidates from posixPathCandidates in src/process/executableSearch and keep
only their own probe and failure reporting. A counted architecture guard
keeps new PATH splits from returning; the remaining Windows and Ghidra
searches are baselined.

* refactor(process): move the colon-split PATH searches onto the search owner

REA's launcher-alias lookup and Ghidra's macOS Java lookup split PATH on
":" and skipped relative entries themselves; they now use
posixPathCandidates with relativeEntries: "skip", and the guard counts
colon splits of PATH as well.

* fix(process): produce PATH candidates lazily so an unused entry cannot fail an earlier match

* refactor(process): give Windows PATH/PATHEXT search order the executable search owner (#10916)

* refactor(process): give Windows PATH/PATHEXT search order the executable search owner

* fix(process): keep later PATH entries searchable after a stray quote or a removed working directory

* fix(reverse): refuse a Windows objdump or Rizin command that PATH does not find (#10953)

* fix(reverse): refuse an objdump or Rizin command Windows PATH does not find instead of launching the bare name

* fix(reverse): report a Windows lookup refusal after cancellation and to capability discovery

* fix(desktop): search a Windows host's PATH as Windows does when doctor looks up a program

programOnPath sent every host through the POSIX PATH search, so on Windows a
relative PATH entry reached absoluteCallerPath with platform linux and the
Windows working directory, which resolved against itself until the stack
overflowed. programOnPath now searches PATH and PATHEXT through
windowsPathCandidates on a Windows host, and absoluteCallerPath refuses a
non-POSIX working directory with a TypeError instead of recursing.
2026-11-15 18:24:04 +08:00
Kaoru0822 3b006841e2 fix(rizin): qualify process completion in command evidence (#10377)
* fix(rizin): expose command validity limits in observations

* test(rizin): compare guidance with its owning contract
2026-11-13 10:48:35 -08:00
morluto dcee59f273 test: strengthen independent oracles and consolidate boundary coverage
Require delivered facts, exact cancellation and malformed-input boundaries, and independent metadata expectations. Transfer unique assertions into stronger keepers before removing duplicate cases and overwritten fixture writes; preserve all consumed core fixture bytes.

Validation: 1,190 focused tests passed with 39 platform-dependent skips; 134 composition and conformance tests passed. Typecheck, lint, formatting, discovery and Knip passed. Independent preservation reviews and targeted regression controls passed.
2026-11-10 17:03:59 -05:00
morluto a4da4e7230 docs(mcp): clarify tool selection and recovery guidance (#9817)
* docs(mcp): clarify tool selection and recovery guidance

* test(mcp): prune wording assertions and preserve scope checks
2026-11-10 07:49:23 -05:00
morluto cb4e5cfbff feat(analysis): make resource budgets recoverable across CLI and MCP (#9706)
* refactor(analysis): centralize resource budgets and recovery facts

* feat(analysis): expose ASAR and Ghidra runtime admission controls

* feat(artifacts): expose reader admission and preserve limited recognition

* feat(javascript): expose recoverable semantic precision budgets

* feat(web): add recoverable source-map budgets and compact retained views

* feat(web): make historical capture decoding budgets recoverable

* fix(desktop): enforce selected view policies across capture and export

* feat(runtime): make Frida and LLDB retention budgets selectable

* feat(native): expose diagnostic budgets and preserve exhaustion causes

* feat(managed): expose recoverable snapshot and representation budgets

* feat(metadata): make Go and Rust inspection budgets recoverable

* feat(wasm): expose representation and producer admissions

* feat(evm): expose per-call worker resource budgets

* feat(android): make resource and string-pool omissions recoverable

* feat(producers): expose command and recorded-capture budgets

* docs(analysis): record recovery contracts and integrated validation

* fix(docs): link calibration oracle from published verification pages

* fix(docs): restore desktop task anchors and receipt links

* test(analysis): align fixtures with selectable budget contracts

* fix(analysis): remove source-location projector dependency cycle

* test(analysis): refresh budget recovery and verifier regressions

* test(analysis): preserve format and publication recovery expectations

* test(windows): align conformance with owned runtime admission

* fix(desktop): preserve selected alias kinds in exported state

* test(analysis): align provider fixtures with recoverable budgets

* test(desktop): validate emitted alias metadata structurally

* fix(ghidra): classify bounded Windows endpoint refusals

* test(cli): assert selectable artifact admission recovery

* fix(cli): preserve capture provenance in environment builds
2026-11-10 05:11:20 -05:00
morluto 5044e20171 test: focus diagnostics and evidence checks on behavior (#9303)
* test: focus configuration diagnostics on their owners

Preserve shape errors, selected paths, recovery guidance, and unchanged-file behavior across parser, setup, and uninstall boundaries.

* test: focus artifact and evidence checks on behavior

Retain format, identity, malformed-input, and cleanup coverage while removing fixed prose and closing the admitted test source.

* refactor(debugger): use configured session admission limits

* test: focus evidence and diagnostics on behavior

* fix(test): restore verifier export and formatting

* test(config): verify debugger limit ranges

* test(rizin): keep fixture executable authoritative

* test(rizin): isolate debugger fixture environment
2026-11-08 16:39:20 +00:00
Entrpi 81f9f71f6d feat(rizin): select the decoder and map address for one-shot commands (#8991)
* feat(rizin): select the decoder and map address for one-shot commands

execute_rizin_command and rea execute-rizin-command accept optional
asm_arch, asm_bits, asm_cpu and base_address (CLI --asm-arch,
--asm-bits, --asm-cpu and --base-address). REA passes them to Rizin
before the artifact path as -a, -b, -e asm.cpu= and -m. Rizin 0.9.1
refuses -e asm.arch= and -e asm.bits= at startup, while -a and -b work
in 0.7.4 and 0.9.1. Rizin applies -e settings after -a and -b.
base_address is the address of file offset 0, as in REA's raw-binary
inputs.

REA checks only the spelling, because Rizin owns the arch and CPU
vocabulary and its builds differ. The Homebrew build of Rizin 0.9.1
has no xtensa or riscv plugin; the official static Linux build of
0.7.4 has both. Evidence records each input and the complete argument
list. When any input is set, Evidence also states that REA does not
confirm the decoder or map that Rizin used: Rizin uses another value
for one it cannot apply and exits 0. Rizin 0.9.1 keeps its default and
reports the value on stderr, and Rizin 0.7.4 turned -b 8 for arm into
16 without a message. Calls without these inputs keep their argument
list and Evidence.

The real-provider gate tests/boundary/providers/RizinDecoderInputs.test.ts
checks the effect of each flag through MCP with Rizin's own e asm.*,
omlj and byte reads. It skips when no Rizin is on PATH. It passes with
Rizin 0.9.1 (Homebrew, macOS arm64) and 0.7.4 (official static build,
Linux x86_64).

* docs(rizin): map multi-segment ESP32 images with om

An ESP32-family app or bootloader image holds several segments, each
loaded at its own address, so one base_address cannot map it. The
recipe removes the default map with om-* and adds one om map per
segment, using the segment offsets from the image format or from
esptool image-info. It does not depend on an ESP image reader in REA.

The offsets were checked against esptool 4.12.0 image_info on a
synthetic two-segment ESP32 image. Rizin 0.9.1 and 0.7.4 mapped its
segments at their load addresses. Rizin 0.7.4, whose static Linux
build has the xtensa plugin, decoded the IRAM segment as nop.n, nop.n,
ret.n and nop.n.

* fix(rizin): read the file at base_address when a loader would claim it

On Rizin 0.9.1, base_address could read 0xff at the mapped address with
exit 0. -m maps the file, but Rizin still runs its format loaders, and
a loose one can claim a raw image. Rizin 0.9.1's AVR loader matches
when bytes 1 and 3 look like rjmp and turns io.va off, so reads use
file offsets. The BIOS loader, in 0.7.4 and 0.9.1, matches a 64 KiB
file with a jmp 16 bytes from its end and maps it at another address.
An acceptance run on a raw ESP32-S3 segment hit the first case.

With base_address, REA now passes -n together with -m. Rizin then skips
the loaders and maps the whole file at the address: rizin.c calls
rz_io_map_new at the -m address and leaves io.va at its default. The
input therefore means a raw image, and Rizin loads no sections, symbols
or entry point, even from an ELF file. Evidence states this in its own
limitation, and the decoder limitation no longer covers the map.

The real-provider gate adds an AVR-like and a BIOS-like image and reads
below the base, at it, at the end of the image and past it. Without -n
it fails on Rizin 0.9.1. It passes with Rizin 0.9.1 (Homebrew, macOS
arm64) and 0.7.4 (official static build, Linux x86_64). The ESP om
recipe now starts with e io.va=true, because reads use the maps only
while io.va is on.

* fix(rizin): advertise name patterns that compile in v mode

The asm_arch and asm_cpu pattern ended its character class with an
unescaped '-', which JavaScript's v (unicodeSets) mode rejects, so
clients compiling advertised patterns in that mode could not use
execute_rizin_command's schema. Escaping it keeps the same names valid
in every mode, as main's own patterns write it.

* fix(rizin): state what the decoder and map inputs leave unconfirmed

The base_address limitation reported a map REA never observes and left
out that -n keeps Rizin's default arch, bits and byte order. The asm_*
limitation implied Rizin replaces a bad CPU, but e asm.cpu echoes any
value. Compact schemas drop property descriptions, so the tool
description now carries the raw-loading warning. The real-provider
gate checks that asm_cpu changes a decode, and a base_address-only call.

* docs(rizin): record the gate's full run on Rizin 0.7.4

* test(rizin): follow the test guide in the decoder input tests

Focused tests resolve execute_rizin_command from its contract family,
the harness owns the temporary directory before setup can fail, and
guidance is compared with its owner, not with sentences from it.
2026-11-06 20:48:59 +08:00
Christopher Pruijsen abdbaa544a fix(rizin): report the output cap instead of a provider signal (#9033)
Attribute REA capture-limit failures at the shared Rizin/objdump execution boundary. Preserve raw signals, output prefixes, unknown completion and incomplete-cleanup facts; report a termination request without claiming confirmed exit.

134 focused tests, check:fast and actual Rizin CLI controls over an owned ELF and /usr/bin/ls pass. Original proposal by cpruijsen.

Fixes #9031.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
2026-11-06 11:20:43 +00:00
morluto c3647ade1e fix(objdump)!: preserve unknown executable identity (#8824)
* fix(objdump)!: preserve unknown executable identity

* fix(objdump): avoid claiming rejected architecture output

* fix(objdump): align launch errors with command identity

* test(objdump): avoid coupling identity checks to wording

* test(objdump): align launch failure expectations
2026-11-04 02:01:44 +08:00
morluto 60149282fc test: strengthen integration oracles and verification (#8295)
* test: strengthen integration oracles and verification

* test: bound lifecycle gates and strengthen workflow checks

* test: verify complete paged and extracted results

* test: preserve bytecode and cancellation evidence

* test: strengthen retained evidence and fixture cleanup

* test: require cross-projection bridge identities

* test: retain fixture owners through cleanup failures

* test: verify graph examples and project selectors

* test: tighten provider and lifecycle regressions

* test: consolidate hex coverage and bound cutter cleanup

* test: bound subprocess output waits and strengthen graph checks

* test: check mcp recovery and preserve cleanup owners

* test: verify structured mcp argument failures

* test: preserve artifact cleanup and gdb limit evidence

* test: preserve evidence identities and bound provider gates

* test: retain browser and comparison cleanup owners

* test: bound startup and strengthen fixture oracles

* test: bound lifecycle gates and verify recovered evidence

* test: verify public outcomes and lifecycle ownership

* test: assert precise evidence and release lifecycle gates

* test: verify selected facts and bound cleanup waits

* test: check retained evidence and decoded records

* test: verify final reports and retain cleanup ownership

* test: bound reviewed startup gates and retain cleanup

* test: verify PE errors and preserve MCP cleanup

* test: preserve MCP fixture cleanup ownership

* test: release provider gates before late startup
2026-11-01 00:15:28 +08:00
morluto f2fa951c00 fix(cancellation): retain caller reasons across digest and startup 2026-10-25 07:31:31 +08:00
morluto d9660eb032 fix(verifiers): share package command and workspace ownership
Join canonical owned command cleanup before releasing package verifier workspaces. Replace raw package command wrappers, the updater supervisor, WASM cleanup composite, and boolean-only retention with explicit capability ownership.

Preserve selected environments, npm arguments, no-deadline calls, clean exit status, and distinct aggregate/per-stream output budgets. Exercise actual timeout descendants, cancellation, retained cleanup retry, and workspace admission.
2026-10-24 16:58:18 +08:00
b1ff86832c fix(windows): align path handling across Hopper, Electron, and ADB (#5235)
* fix(hopper): keep macOS and Linux launcher paths POSIX

* fix(hopper): keep Linux and macOS bundle paths POSIX

Linux package archives and macOS app-bundle launcher paths describe the target host, not the host running the test. Build them with path.posix so exercising these installers from Windows produces the same paths as the target platform.

* fix(electron): follow Windows symlink targets with native separators

readlink returns backslash-separated targets on Windows. Splitting only on '/' kept a whole relative target as one component, so nested links were not followed and a relative target could pass the framework-root check without being walked. Split on both separators on Windows and add a regression for an escaping target.

* test(windows): align host-specific path and lifecycle expectations

Compare generated skill and provider-command paths with native joins, bind ADB device-path validation to an explicit platform, and prepare simulated POSIX Ghidra install roots on Windows. Skip POSIX-only Hopper lease, permission-bit, and symlink-parent cases, assert Windows' unsupported Hopper state instead, and cover the Windows Ghidra native-source admission step before snapshot replay. Launch Node child seams with SystemRoot available and expect Windows close-failure resource retention.

* test(windows): close review coverage gaps

---------

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-10-23 05:36:22 +08:00
dbd556043c fix(providers): name JEB, IDA, and one-shot command deadlines (#6014)
* fix(providers): name JEB, IDA, and one-shot command deadlines

Wire JEB catalog discovery to REA_JEB_MCP_TIMEOUT_MS, name the IDA
registration timeoutMs, and add command_timeout_ms for one-shot objdump
and rizin. Debugger, Frida, and Cutter caps stay fixed and say so.

Refs #5910

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(providers): pass remaining deadlines and name the cap that fired

Catalog discovery now sends the JEB budget still remaining to the SDK on
connect and every tools/list page. Objdump and rizin preflight share one
command_timeout_ms across stat and digest; the command still receives that
budget again. Architecture Evidence keeps a selected timeout, and Frida and
Rizin name the capture limit that actually stopped output.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(frida): preserve non-timeout device lookup failures

getDeviceById is a lookup deadline only when Frida rejects with
"Device not found" after the wait. A device-manager or backend failure
stays a capability error. Align the assertions that still expected the
previous capacity and capture sentences.

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>
2026-10-22 04:01:02 +08:00
morluto c284168c4b fix(objdump): scope debug-link limitations to DWARF requests 2026-10-20 17:18:21 +08:00
gensokyo-devandKaoru0822 2dd5effe2a fix(rizin): default one-shot output to plain presentation (#5269)
Default native one-shot Rizin presentation to plain text before collection while preserving caller colour overrides, literal output, recorded argv and shared CLI/MCP Evidence.

Fixes #4488

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-20 01:12:35 +08:00
4aa51bfe19 fix(reverse): reconcile cleanup ownership and mutation diagnostics (#2799)
* feat(process): add owned debugger shutdown lifecycle

* feat(reverse): add local inspection commands

* feat(gdb): add persistent debugger integration

* feat(cutter): add Cutter bridge integration

* test(reverse): enforce complete integration coverage

* fix(process): preserve debugger shutdown ownership

* fix(reverse): retain evidence across interrupted commands

* fix(gdb): honor captured provider environment

* test(process): cover debugger shutdown retries

* fix(reverse): retain evidence for interrupted providers

* test(process): cover debugger shutdown retries

* fix(reverse): retain evidence for interrupted providers

* fix(server): snapshot provider environment at creation

* fix(reverse): close review gaps with complete coverage

* fix(reverse): address inspection review findings

* fix(gdb): bound sessions and retain cleanup ownership

* fix(ci): require reverse-tools quality lane

* fix(process): unref inherited debugger output pipes

* fix(reverse): address remaining PR 1960 findings

* fix(gdb): address remaining PR 1961 findings

* fix(reverse): account for unrestricted provider execution

* fix(process): retain debugger ownership until safe shutdown

* fix(process): preserve replacement debugger sessions

* fix(reverse): preserve admission and output provenance

* fix(process): retain exited debugger until output settles

* fix(mcp): bound provider admission and debugger cleanup

* fix(reverse): preserve failure provenance and classify E2BIG

* fix(gdb): preserve startup cleanup and detach safety

* fix(process): retain debugger ownership after detach failure

* fix(reverse): preserve mutation and failure provenance

* fix(gdb): address debugger review findings

* fix(reverse): rebind sessions after external mutation

* fix(process): cap debugger output after exit

* fix(gdb): protect one-shot detach verification

* feat(debugger): add reverse tool coverage gate

* test(debugger): cover integrated failure paths

* fix(gdb): bound and preserve session observations

* fix(gdb): address review regressions

* style: format merged integration files

* fix(reverse): preserve session and output evidence

* refactor(gdb): share repeated test and partial result setup

* fix(gdb): invalidate TTY proof for Python aliases

* fix(reverse): retain failure output byte counts

* test(process): synchronize late debugger output

* fix(gdb): invalidate TTY proof for wrapped commands

* fix(gdb): recognize wit command abbreviation

* test(reverse): wait for cancelled descendant readiness

* test(reverse): bound descendant cancellation cleanup

* style(reverse): format integration tests and adapters

* style: format reverse engineering integration files

* test(reverse): remove duplicate environment harness

* test(gdb): share session startup assertions

* fix(gdb): invalidate output proof for command abbreviations

* test(reverse): share composition edge case scenarios

* fix(ci): recognize verification and mutation tool entries

* test(rizin): cover successful fake inferior detach

* test(cli): align full output failure envelope

* test(cli): isolate reverse command lifecycle service

* test(process): share debugger output fixture setup

* fix(binary): preserve high-bit Windows signature bytes

* style(binary): format Windows signature parser

* test(mcp): preserve call coverage in unchanged comparison

* fix(ci): include reverse tools Vitest configs in lint cache

* fix(mcp): preserve target content on delivery errors

* ci: align duplication ceiling with expanded suite

* test(reverse): allow signal admission mutants

* fix(reverse): bound retained cleanup failures to process owners

* fix(test): replace drifting mutation ranges with owned selectors

* fix(reverse): admit persistent commands and retain cleanup ownership

* fix(cutter): recover timed-out commands from exact receipts

* fix(cutter): reject unsupported bridge request kinds

* fix(ci): repair client format and shared verification fixtures

* fix(native): preserve debugger cleanup ownership and bridge authentication

* test(native): retain diagnostics without perfect coverage requirements

* chore(licenses): refresh locked dependency inventory and notices

* fix(test): exclude transient command locks from mutation sandboxes

* fix(gdb): admit only platforms with safe detach verification

* fix(cutter): retain bounded completion receipts until acknowledgement

* fix(cutter): acknowledge commands rejected before UI dispatch

* test(reverse): fail cancellation checks before fixture teardown

* test(gdb): clean up the retained broken-stdin fixture owner

* docs(test): clarify focused provider verification scope

* fix(rizin): retain close cleanup failures

* fix(gdb): wait for inferior stop and bound MI buffering

* fix(cutter): retain failed receipt acknowledgements

* fix(rizin): return retained session identity on rebind failure

* fix(gdb): preserve startup cancellation and lossy status

* fix(rizin): retain launch provenance and assemble frames once

* fix(cutter): recover receipts across callers and bound discovery

* docs: describe debugger evidence and bridge recovery

* fix(process): keep cleanup incomplete while writers remain

Stopping a debugger no longer reports success when inherited output
streams stay open, so BinarySession cannot reopen a binary a child is
still changing. Concurrent Cutter cleanup retries share one receipt
acknowledgement instead of treating a consumed receipt as failure.

* fix(debuggers): recover cleanup with captured process identities

* fix(analysis): retire sessions after unrestricted commands

* fix(cli): preserve completed evidence after cleanup recovery

* fix(cutter): bound frame collection and coalesce cleanup

* fix(windows): resolve selected provider paths absolutely

* fix(gdb): report decoding loss in failed startup evidence

* fix(rizin): scope decoding loss to collected command frames

* test(mcp): cover snapshot retirement in reverse tools CI

---------

Co-authored-by: Daniel Gonçalves Araujo <47118053+dandgabr@users.noreply.github.com>
Co-authored-by: REA Maintainers <noreply@github.com>
Co-authored-by: OpenAI Codex <codex@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-14 04:47:34 +08:00