mirror of
https://github.com/morluto/rea.git
synced 2026-11-30 18:39:24 +00:00
+15





![dependabot[bot]](/assets/img/avatar_default.png)


299c592b63
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry
Introduce one domain-owned TargetFailure value whose kind alone derives
the public code, category, retryability, recovery and details, for CLI
and MCP alike. Selected-file malformed and truncated refusals are the
first area on it: AnalysisMalformedTargetError is replaced by
AnalysisTargetFailureError, and ParseFailure's byte-structure variants
are TargetFailure variants rather than a parallel type.
The shared stableArtifactParserFailureCli loop is replaced by a
declarative registry (tests/support/targetFailure/readers/*.ts) and one
generated suite that runs every registered case through the CLI and MCP.
BREAKING CHANGE: selected-file malformed and truncated refusals add
details.failure_kind, and a truncated target's remediation now says to
re-acquire the complete file instead of choosing another target. Codes
are unchanged. Affected operations: every operation that refuses a
selected file's malformed or truncated bytes, including the ELF, PE,
Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel
module, binary hardening, managed PE/CLI and IL2CPP readers.
* test(managed): name the target failure error in the merged status test
* docs(reference): name the error CSV instead of linking a non-page file
* fix(tests): expect the path reason for non-regular dyld inputs
#14225 refuses a non-regular dyld input as ArtifactReaderFailure("path");
dylibFileLifetime still expected "format" and fails on main's shard 9.
* fix(tests): expect io, invariant and path where #14225 reclassified
stableArtifact expected "format" for an impossible descriptor byte count
(now io) and an invalid chunk size (now InternalInvariantError);
directoryArtifactReaderOpen expected "format" for a non-file entry (now
path, the same change as #14238). All three fail on main.
* fix(errors)!: raise container reader byte faults as malformed or truncated targets
Delete the ambiguous `format` reason from ArtifactReaderFailure and
ArtifactOperationError. Each container reader now raises its owner's
fact once, through malformedArtifact / truncatedArtifact, with format,
offset, field and measured extents. Short reads inside a measured extent
are read-coverage integrity failures, path-kind refusals are `path`,
foreign or recovery-requiring inputs are `unsupported`, host tool output
is `io`, and REA defects are InternalInvariantError.
The trace, NTFS journal, release exposure, web capture, native macOS and
web artifact adapters project the reader's parsed facts as
AnalysisTargetFailureError instead of invalid_request. Inventory
malformed, truncated, unsupported and cancelled reasons take their code
from the TargetFailure projection table, so a truncated container is
unsupported_target with failure_kind "truncated" on both paths.
BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact,
analyze_javascript_application, inspect_desktop_application,
inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg,
trace_dylib_resolution, trace_web_module_imports and
trace_web_source_location report damaged container bytes as
unsupported_target (details.reason "malformed" or "truncated", with
failure_kind and format) instead of artifact_operation_failed with
reason "format", and a truncated container as unsupported_target instead
of truncated. inspect_playwright_trace, inspect_ntfs_journal,
audit_release_exposure, the web capture inspection operations and the
caller-selected import and source maps report damaged selected bytes as
unsupported_target instead of invalid_request. The `format` reason no
longer appears in details.reason.
* test(artifacts): expect target failure codes in compiled CLI and MCP suites
* fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures
The SQLite engine's `format` reason is renamed to `malformed` at its
owner (SQLITE_INSPECTION_REASONS), and its refusal becomes an
AnalysisTargetFailureError at the selected path with format "sqlite".
The pwntools and EVM worker replies keep their wire reason "format",
which their workers define, and the adapters translate it once into a
malformed target failure with the profile's format (elf, elf-core,
evm-bytecode) instead of an invalid_format argument issue. SQLite joins
the target-failure conformance registry.
BREAKING CHANGE: inspect_sqlite_database, inspect_binary_layout,
inspect_recorded_crash and inspect_evm_interface report a selected
file's malformed bytes as unsupported_target with details.failure_kind
"malformed", format_failure, format and path, instead of invalid_request
with an invalid_format issue on path.
* fix(errors): give the integrity kind a schema-valid code and list the reference page
artifact_integrity_mismatch's projection schema requires declared and
calculated digests, which a TargetFailure of kind integrity does not
carry, so the kind now projects artifact_operation_failed with category
integrity_mismatch. The model test validates every kind's projection
against analysisErrorProjectionSchema. The reference page joins the
documentation sidebar.
* fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local
A Bun or Node SEA short read inside a range already checked against the
measured size meant the file changed, not that it was truncated. The
carrier range reader and Bun's readExact now raise read-coverage
integrity for it, and keep 'outside the file' as the truncated case.
DesktopFileInspection records an unsupported managed-metadata probe as a
row issue again, so later file checks still run.
* test(errors): expect target failure facts in the pwntools and EVM reply suites
The literal-replacement scenario now reads the failure's detail instead
of an issues[] message, and a malformed reply wrapped by cleanup failure
reports category unsupported_target.
* test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies
The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit
signatures) and the truncated Apple IPS body move into the conformance
registry, which runs them through the CLI and MCP and now also checks
that a refusal leaves the selected file unchanged. The per-command tests
keep only their valid-image controls.
* test(sqlite): drop the malformed-database provider test the conformance registry covers
inspect_sqlite_database/not-a-database in the target-failure registry runs
the same non-SQLite bytes through the CLI and MCP, asserts the malformed
target facts and checks the selected file is unchanged.
* feat(errors)!: make failure_kind the identifier and derive code and retry from it
Apply the owner review on #14239 to the TargetFailure model:
- remove details.format_failure; failure_kind is the only identifier;
- give integrity, conflict and io their own codes
(target_integrity_mismatch, input_conflict, host_io_failed) and derive
inventory malformed, truncated and unsupported codes from the same table;
- add a retry hint (none, backoff, after_change) derived from the kind,
with io refined by its transient errno fact; retryable stays the
unchanged-retry flag and is true exactly for backoff;
- rename the limit-cut result code and category truncated to partial;
- drop cancelled and resource from the target kinds and spell
identifiers in American English (unrecognized);
- return a target failure a tool handler throws as a projected isError
result instead of letting the SDK flatten it to text.
BREAKING CHANGE: details.format_failure is removed (read
details.failure_kind). The truncated result code and category are now
partial. Target integrity failures report target_integrity_mismatch,
host read failures host_io_failed and disagreeing inputs input_conflict.
Inventory operations (inventory_artifact, inspect_artifact,
extract_artifact and the other inventory callers) report truncated
container bytes as unsupported_target. Every target failure carries a
top-level retry hint.
* test(sqlite): expect a malformed target for non-database bytes in the CLI suite
* fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart
PyInstaller reads inside the measured size, and .NET bundle manifest
refills, now raise read-coverage integrity on a zero-byte read instead of
truncated. A .NET bundle field and a Godot PCK directory entry that extend
past the file are truncated (with offset and extents) instead of
malformed. An absent or invalid ASAR packed offset is malformed; only a
valid range past the archive is truncated. The .NET manifest string
offset is reported in file coordinates.
* fix(pwntools): report a short ELF header as a truncated target
The layout and recorded-crash workers raise a distinct truncated reason
when the file ends inside the ELF identification or header, and the
decoder projects it as failure_kind truncated instead of inferring it
from the message.
* fix(errors)!: report managed coverage gaps and IL2CPP pair conflicts as target failures
Managed readers interpret an issue code once, in managedIssueTargetFailure:
a coverage gap is an unsupported target, every other rule violation is a
malformed target, and the inventory metadata status is derived from that
same fact. managedInspectionTargetFailure now returns only
AnalysisTargetFailureError.
An IL2CPP binary that parses but does not link to its metadata is a
conflict target failure that lists both inputs and blames neither, in
place of an invalid_request with two issue entries. Metadata version 108
is an unsupported target. The CLI spells each conflict input's field by
the command's option name.
BREAKING CHANGE: inspect_managed_artifact, inspect_managed_members,
inspect_managed_native_boundaries and the managed comparison operations
report unsupported metadata or signature forms as an
AnalysisTargetFailureError (failure_kind unsupported, format pe-cli,
field, offset) instead of a bare unsupported target. inspect_il2cpp_metadata
reports a binary/metadata pair that does not link as code input_conflict
with failure_kind conflict and details.inputs, instead of invalid_request
with details.issues, and metadata version 108 with failure_kind
unsupported.
* fix(artifacts): verify the carrier before blaming a short read on the bytes
The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and
.NET bundle members now re-verify the source before reporting a short
stream as malformed, so a file that changed during the read reports the
change. The truncation site builds the model's measured extent.
* fix(errors)!: report inventory refusals as target failures of the selected path
An inventory, inspection or extraction refused damaged or unsupported
container bytes as an ArtifactOperationError whose reason repeated the
format owner's kind. It carried no path or retry hint, so the conformance
registry could not express container cases.
translateArtifactFailure now takes the selected path and returns the
reader's TargetFailure as an AnalysisTargetFailureError. The malformed,
truncated and unsupported reasons, their classification rows and their
presentation branch are deleted from ArtifactOperationError. Readers'
unsupported refusals carry their format facts through unsupportedArtifact.
Container cases move into the conformance registry, which now opens the
target first for session tools such as inspect_artifact.
BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and
the bundle readers report a refused container as a target failure of
details.path with a top-level retry. details.reason is the owner's
description and details.detail is removed.
* docs(il2cpp): describe pair conflicts as input_conflict with both inputs
* docs(android): name unsupported_target for truncated boot image structures
* fix(errors)!: report a target that changed during the read as failure_kind changed
Inventory integrity failures whose check means the target moved under the
read (container, member and unpacked-entry identity, read coverage,
traversal coverage) now take the model's changed projection: code
artifact_changed, retry backoff and details.failure_kind changed. A
selected target that no longer matches the one the session admitted gets
its own admitted-identity check and keeps its reopen recovery.
BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and
the other inventory operations report a target that changed during the
read as artifact_changed (retryable, failure_kind changed) instead of
artifact_operation_failed. Admission-identity refusals report
integrity_check admitted-identity instead of container-identity.
* test(artifacts): raise the cleanup fixture's decode refusal with its format facts
* fix(errors)!: report unsupported and unrecognized targets on the TargetFailure model
AnalysisUnsupportedTargetError carried a free-text reason and remediation
beside the TargetFailure model, so unsupported refusals had no format,
failure_kind or retry hint, and their recovery was prose written at each
producer.
The class is deleted. Producers raise unsupportedTarget or
unrecognizedTarget with the owner's format, and consumers read
targetFailureOfKind. The projection table renders the recovery and names
the operations the owner lists in related.operations. The foreign-bytes
identity loop moves into the conformance registry.
BREAKING CHANGE: unsupported and unrecognized targets report
failure_kind, format and retry. Their remediation comes from the
target-failure table; producer-written remediation sentences are folded
into details.reason or replaced by details.related_operations.
* test(artifacts): expect admitted-identity for selections replaced before admission
A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split.
* test(go): name the fixture and result when an MZ carrier is not refused through MCP
* style: format the migrated target-failure tests
* test(errors): expect the PE readers' native-binary format label for foreign bytes
* fix(cli)!: spell a target failure's recovery with CLI commands and options
The target-failure recovery named MCP tools even when the CLI printed it,
and it could not name another provider. The projection table now renders
the owner's alternative operations and providers through an adapter
spelling: MCP by tool name and open_binary argument, the CLI by command
and --provider. The CLI output layer re-renders only the table's own text,
so appended guidance is kept.
BREAKING CHANGE: CLI target-failure remediation names commands (for
example `rea inspect-plist`) instead of MCP tool names, and errors gain
details.related_providers when the owner names a provider.
* test(verify): expect target failures for damaged ELF, core and EVM inputs in real-provider verifiers
The binary-layout, recorded-crash and EVM verifiers still expected invalid_input for malformed or truncated selected bytes. The pwntools and EVM adapters now report those as unsupported_target with failure_kind; a missing path remains invalid_input.
* test(web): expect the partial code for a refused source-map admission
The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling.
* fix(workers)!: name malformed worker replies by the model's kind (#14292)
* fix(workers)!: name malformed worker replies by the model's kind
The pwntools, EVM, UEFI LZMA, source-map and historical-capture workers
replied with reason "format" for bytes that break their format, a second
vocabulary for the TargetFailure kind. The workers and their reply schemas
now use "malformed" at the source, including the pwntools Python bridge
and its tests. pwndbg never sent "format", so its schema drops it.
The pwntools decoder maps the worker's malformed and truncated replies to
the target failure of the same kind in one branch.
BREAKING CHANGE: worker reply reason "format" is renamed "malformed" in
the pwntools, EVM, UEFI LZMA, source-map and capture decoder protocols.
* test(go): expect loader-equivalent PE header facts in the MZ diagnostics (#14293)
#14253 made the static PE readers read the optional header at its fixed
offsets and admit a declared directory count below 16, as the Windows
loader does. The Go MZ diagnostic fixtures still expected the older
refusals, so inspect_go_binary MCP and CLI diagnostics failed on main.
A short SizeOfOptionalHeader with an unknown magic at the fixed offset
is now an unsupported optional header, and a PE declaring one data
directory is admitted and keeps its build information, which the MCP
test now asserts.
* fix(tests): damage Deno PE resource framing the loader-equivalent reader reads
#14253 walks resource trees at their RVA whatever the directory Size
declares, so shrinking Size no longer made the 65,535-language table
malformed and the case reported the entry allowance instead. Point the
type directory's entry at a language directory outside the file-backed
resource bytes: its header cannot be read, which the reader reports as
malformed before counting rows against the allowance.
* test(go): check build information in a one-directory PE32 fixture (#14303)
* test(pe): distinguish unsupported DOS input from truncated input (#14302)
* ci: measure portable runner time for recorded selection predictions (#14304)
* ci: validate workflow anchors with actionlint 1.7.12 (#14298)
* ci: wait for static checks before broad PR test shards (#14299)
* ci: validate workflow anchors with actionlint 1.7.12
* ci: wait for static checks before broad PR test shards
* ci: record affected-test predictions above the live cutoff (#14300)
* ci: compare frozen selections with observed test failures (#14301)
* chore(deps): bump markdownify from 1.2.3 to 1.2.4 in /website (#14227)
Bumps [markdownify](https://github.com/matthewwithanm/python-markdownify) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/matthewwithanm/python-markdownify/releases)
- [Commits](https://github.com/matthewwithanm/python-markdownify/compare/1.2.3...1.2.4)
---
updated-dependencies:
- dependency-name: markdownify
dependency-version: 1.2.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump rcssmin from 1.2.2 to 1.3.0 in /website (#14229)
Bumps [rcssmin](https://github.com/ndparker/rcssmin) from 1.2.2 to 1.3.0.
- [Changelog](https://github.com/ndparker/rcssmin/blob/master/CHANGES)
- [Commits](https://github.com/ndparker/rcssmin/compare/1.2.2...1.3.0)
---
updated-dependencies:
- dependency-name: rcssmin
dependency-version: 1.3.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix(ci): retry recorded crash dependency acquisition without stale index cache (#14076)
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
* ci: publish the portable build cache only for selected consumers (#14307)
* ci: run the verified actionlint release binary (#14309)
* chore(deps): bump pyyaml from 6.0.3 to 6.0.4 in /website (#14228)
Bumps [pyyaml](https://github.com/yaml/pyyaml) from 6.0.3 to 6.0.4.
- [Release notes](https://github.com/yaml/pyyaml/releases)
- [Changelog](https://github.com/yaml/pyyaml/blob/6.0.4/CHANGES)
- [Commits](https://github.com/yaml/pyyaml/compare/6.0.3...6.0.4)
---
updated-dependencies:
- dependency-name: pyyaml
dependency-version: 6.0.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* refactor(views): reuse invalid-view results and row selectors (#14314)
* refactor(domain): share record and graph parsing across input paths (#14321)
* ci: shallow-checkout the classifier for qualification runs (#14312)
* refactor(tests): consolidate repeated CLI capture and fixture construction (#14311)
* refactor(tests): consolidate repeated CLI capture and fixture construction
* test(cli): keep overlapping schema and help cases in their existing PR
* refactor(application): consolidate configuration and observation helpers (#14322)
* refactor(application): consolidate configuration and observation helpers
* refactor(config): leave optional launch parsers to their existing change
* refactor(tooling): share verifier fixture and lint helpers (#14318)
* refactor(tooling): share verifier fixture and lint helpers
* test(clients): retain tool messages in verifier model substitutes
* build(deps): bump write-file-atomic from 7.0.0 to 8.0.0 (#8134)
* perf(nuget): stream .nupkg ZIP over FileHandle instead of buffering full archive (#13835)
* perf(nuget): stream .nupkg ZIP over FileHandle instead of buffering full archive
Closes #13834
* fix(nuget): check artifact stability after format rejection
* refactor(kuna): extract KunaSingleFunctionCache from KunaSessionClient (#13863)
Closes #13862
* perf(har): reuse normalized Base64 for retained response bodies (#13847)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
* refactor(application): migrate 7 standalone format services onto executeArtifactInspection (#13861)
Closes #13860
* refactor: prune 5 redundant single-call wrapper modules (#13807)
* refactor: prune 5 redundant single-call wrapper modules
* chore(ci): remove deleted providerEnvironment.ts from Stryker and CI scope configs
* fix(ci): retarget provider environment mutation coverage
* refactor(application): migrate 3 remaining artifact services onto executeArtifactInspection (#13867)
* refactor(rizin): extract RizinDebugEvidence from RizinDebugSessionManager (#13823)
* refactor(rizin): extract RizinDebugEvidence from RizinDebugSessionManager
* refactor(rizin): remove unused evidence imports
* fix(ci): follow extracted Rizin evidence in mutation checks
* docs: codify pagination, schema-flatness, DDIA, and flat-ownership guidance in tool-design docs and skills (#13865)
* docs: codify pagination, schema-flatness, DDIA, and flat-ownership guidance in tool-design docs and skills
Closes #13864
* docs: name the current provider operation runner
* feat(frida): add optional limit and offset paging to list_frida_processes (#13854)
* feat(frida): add optional limit and offset paging to list_frida_processes
Closes #13853
* fix(frida): stabilize paged process discovery
* docs(frida): scope paging claims to shipped discovery
* refactor(application): unify 5 pass-through analysis services into ProviderOperationService (#13856)
Closes #13855
* refactor(cli): extract contractCommandRunners from contractCommand (#13869)
* feat(tools): add optional limit and offset paging to find_xrefs_to_name (#13858)
* feat(tools): add optional limit and offset paging to find_xrefs_to_name
Closes #13857
* fix(tools): preserve xref discovery coverage in paged results
* feat(adb): add optional limit and offset paging to list_adb_features and list_adb_services (#13873)
* feat(adb): add optional limit and offset paging to list_adb_features and list_adb_services
* test(adb): verify feature and service paging guidance
* refactor(cli): extract contractCliSchemaProjection and contractCliDocumentDescription (#13871)
* fix(dwarf): reject PE long section names when PointerToSymbolTable is zero (#13889)
* perf(macho): streamline legacy rebase run marking (#13881)
* perf(erlang): stream BEAM IFF inspection over FileHandle (#13886)
* perf(erlang): stream BEAM IFF inspection over FileHandle
* fix(erlang): retain only decoded BEAM code headers
* refactor(kuna): extract KunaSessionEvidence from KunaSessionClient (#13879)
* refactor(kuna): extract KunaSessionEvidence from KunaSessionClient
* refactor(kuna): remove stale session evidence imports
* fix(objc): preserve class import reader failures (#13892)
* refactor(server): extract desktop build tool bindings (#13891)
* refactor(server): collapse inspect bindings and extract desktopBuildToolBindings
* fix(mcp): restore contract-checked inspect bindings
* fix(macho): preserve legacy bind stream bounds and target scope (#13874)
* fix(macho): preserve legacy bind stream bounds and target scope
* fix(macho): report unresolved legacy bind targets in coverage
* test(macho): consolidate legacy bind target coverage
* perf(pe): stream PE certificates over FileHandle (#13884)
* perf(pe): stream PE certificates over FileHandle
* fix(pe): share certificate table admission across readers
* perf(apple-ips): stream Mach-O join headers over FileHandle (#13894)
* perf(apple-ips): stream Mach-O join headers over FileHandle
* fix(apple-ips): retain only verified Mach-O joins
* perf(objc): streamline exact class identity projection (#13897)
* perf(pe): stream PE resource inspection over FileHandle (#13899)
* perf(pe): stream PE resource inspection over FileHandle
* fix(pe): bound streamed icon-group reads and restore lifetime coverage
* perf(swift): streamline symbol inventory classification (#13902)
* perf(apk-signature): stream APK signature inspection over FileHandle (#13877)
* perf(apk-signature): stream APK signature inspection over FileHandle
* fix(apk-signature): preserve bounded reads and file identity
* fix(apk-signature): handle deflate EOF and repair verifier bounds
* fix(apk-signature): recognize internal pipeline cancellation at EOF
* perf(release-exposure): stream PE CodeView/PDB inspection over FileHandle (#13896)
* perf(release-exposure): stream PE CodeView/PDB inspection over FileHandle
* fix(release-exposure): share and bound PE CodeView parsing
* refactor(server): simplify contractToolBindings types and handler dispatch (#13912)
* perf(macho): streamline slice selection diagnostics (#13905)
* fix(macho): preserve retained magic from valid FAT ranges (#13910)
* perf(pe): stream PE load-config inspection over FileHandle (#13901)
* perf(pe): stream PE load-config inspection over FileHandle
* fix(pe): admit empty section tables and batch TLS callback reads
* perf(elf): stream ELF note inspection over FileHandle (#13904)
* perf(elf): stream ELF note inspection over FileHandle
* fix(elf): validate full header extents and reuse aliased note reads
* fix(macho): keep header reads inside declared slices (#13913)
* perf(v8): stream V8 code cache inspection over FileHandle (#13907)
* fix(macho): correct encryption range VM mapping (#13918)
* perf(elf): stream kernel module inspection over FileHandle (#13917)
* perf(elf): stream kernel module inspection over FileHandle
* test(elf): exercise streamed kernel module reads and finalization
* refactor(providers): share offlineArtifactFailureDialect across offline providers (#13921)
* test(macho): consolidate fixed header and extent proofs (#13919)
* perf(macho): bound positional command string probes (#13925)
* refactor(server): replace server.close and onclose monkey-patching with lifecycle hooks (#13882)
* refactor(server): replace server.close and onclose monkey-patching with lifecycle hooks
* fix(mcp): keep deferred runtime cleanup out of protocol close
* test(mcp): verify materialized runtime hooks close once
* fix(cli): defer artifact AnalysisView loading until requested
* test(macho): consolidate native path framing proofs (#13926)
* perf(elf): stream ELF dependency inspection over FileHandle (#13915)
* perf(elf): stream ELF dependency inspection over FileHandle
* fix(elf): share dependency hash parsing and bound string reads
* perf(elf): reuse cached prefixes for short dependency names
* refactor(server): extract debugger and instrumentation tool bindings (#13909)
* refactor(server): extract debugger and instrumentation tool bindings
* test(server): track extracted debugger bindings in reverse tools coverage
* fix(cli): defer artifact AnalysisView loading until requested
(cherry picked from commit e58fda3f26)
* refactor(macho): use binary facts for native diagnostic admission (#13929)
* perf(macho): streamline native export inventory merging (#13932)
* perf(elf): stream ELF debug-link inspection over FileHandle (#13928)
* perf(elf): stream ELF debug-link inspection over FileHandle
* perf(elf): reuse section name bytes across debug-link readers
* perf(pe): stream PE import inspection over FileHandle (#13924)
* perf(pe): stream PE import inspection over FileHandle
* perf(pe): reuse import read windows and cover positional boundaries
* fix(elf): preserve load segment range diagnostics
* test(macho): consolidate lipo field and native slice proofs (#13937)
* perf(elf): stream ELF unwind-range inspection over FileHandle (#13931)
* perf(elf): stream ELF unwind-range inspection over FileHandle
* fix(elf): bound unwind name retention and refill frame metadata
* test(macho): make slice cancellation and cleanup ordering deterministic (#13944)
* test(macho): make slice cancellation and cleanup ordering deterministic
* test(macho): join slice reads before restoring test spies
* refactor(providers): adopt offlineArtifactFailureDialect in BEAM, V8, NuGet, and LNK providers (#13936)
* refactor(providers): adopt offlineArtifactFailureDialect in BEAM, V8, NuGet, and LNK providers
* fix(nuget): let integrity and cancellation fall through to classifyProviderFailure
* perf(macho): defer segment geometry until lazy metadata needs it (#13949)
* test(macho): consolidate classic and modern dylib encoding proofs (#13952)
* perf(native): stream binary hardening inspection over FileHandle for ELF, PE, and Mach-O (#13934)
* perf(native): stream binary hardening inspection over FileHandle for ELF, PE, and Mach-O
* fix(native): bound hardening note and symbol reads
* test(native): verify bounded hardening reads through positional readers
* refactor(server): extract browser, Electron, and JavaScript runtime tool bindings (#13939)
* refactor(server): extract browser, Electron, and JavaScript runtime tool bindings
* test(ci): select browser checks for extracted bindings
* refactor(providers): adopt offlineArtifactFailureDialect in PE, ELF, and Apple IPS providers (#13954)
* test(macho): consolidate lazy payload reuse and capacity proofs (#13958)
* refactor(artifacts): extract source-map detection and occurrence path helpers from ReleaseExposureReader (#13961)
* perf(elf): stream kernel build-config inspection over FileHandle (#13942)
* perf(elf): stream kernel build-config inspection over FileHandle
* fix(elf): reuse kernel marker windows and report compressed input limits
* fix: preserve kernel config identity on cleanup failure
* test(macho): consolidate command framing and admission proofs (#13964)
* test(macho): consolidate command framing and admission proofs
* test: assert Mach-O command failure facts
* perf(dwarf): stream DWARF compile-unit inspection over FileHandle for ELF, PE, and Mach-O (#13948)
* perf(dwarf): stream DWARF compile-unit inspection over FileHandle for ELF, PE, and Mach-O
* fix: bound positional DWARF reads and share Mach-O selection
* test: verify positional Mach-O command admission
* refactor(providers): adopt offlineArtifactFailureDialect in NativeInitializers, Go, Rust, and ElfUnwind providers (#13966)
* refactor(providers): adopt offlineArtifactFailureDialect in BinaryHardeningProvider and PeBinaryFailure (#13970)
* refactor(server): extract session, investigation, and workflow tool bindings (#13968)
* perf(ntfs): stream MFT record decoding in O(recordBytes) memory (#13957)
* perf(ntfs): stream MFT record decoding in O(recordBytes) memory
* fix: resolve streamed MFT links through bounded positional reads
* refactor(providers): adopt offlineArtifactFailureDialect in KernelBuildConfigProvider (#13973)
* refactor(adb): extract read-only shell inspection operations from AdbProvider (#13975)
* refactor(elf): remove obsolete debug-link buffer parsers (#13971)
* perf(native): stream PE and ELF export-table inspection over FileHandle (#13951)
* perf(native): stream PE and ELF export-table inspection over FileHandle
* fix: share export interpretation across buffered and positional reads
* refactor(providers): adopt offlineArtifactFailureDialect in DwarfUnitsProvider (#13977)
* perf(elf): read only needed debug-link section bytes (#13980)
* refactor(providers): adopt offlineArtifactFailureDialect in NativeExportsProvider (#13982)
* feat(analysis-view): page retained UEFI firmware maps
Add the uefi-firmware view for inspect_uefi_firmware Evidence. The summary returns volume, file and section counts with FFS type, section type and volume depth tallies. Pages select volumes, files, sections, unknown regions, integrity records and PSP tables or candidates. Files match exact GUIDs, user-interface names, type names and owning volume; sections match their owning file and type. Rows keep the original flattened index plus the offset and source stream that extraction targets.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(uefi)!: summarize firmware inspection by default over MCP
A complete map of a 4 MiB OVMF image is about 514 KB of structured content, which exceeds client result limits. MCP inspect_uefi_firmware now retains the complete map and returns its summary unless the caller passes detail complete. An optional view returns the first uefi-firmware page in the same call; later pages use inspect_analysis_view. The one-shot CLI command still returns complete Evidence.
BREAKING CHANGE: MCP callers that need every volume, file and section inline must pass detail: "complete" to inspect_uefi_firmware.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* docs(firmware): describe UEFI summaries and views
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(rust): stream Rust binary inspection over FileHandle for ELF, PE, Mach-O, and WebAssembly (#13979)
* perf(rust): stream Rust binary inspection over FileHandle for ELF, PE, Mach-O, and WebAssembly
* fix(rust): bound positional dependency and name reads
* refactor(rust): reuse strict UTF-8 validation
* fix(elf): retain verified debug-link evidence through descriptor finalization (#13986)
* refactor(elf): prune superseded whole-buffer parseKernelBuildConfig wrapper (#13996)
* refactor(dwarf): prune superseded whole-buffer locateDwarfSections wrapper (#13993)
* refactor(elf): retire obsolete note buffer parsers (#13995)
* fix(gpu): mark conflicting CUDA shared sections partial and clear register provenance (#13963)
* refactor(artifacts): extract bounded member I/O helpers from ReleaseExposureReader (#13990)
* refactor(adb): extract package and app lifecycle operations from AdbProvider (#13988)
* refactor(server): extract offline inspection tool bindings from serviceToolBindings (#13984)
* refactor(elf): retire the obsolete unwind buffer parser (#14007)
* refactor(uninstall): extract registration-removal and item-collapse helpers from Uninstall (#14006)
* refactor(rizin): extract NUL-frame reader and wait helpers from RizinDebugSessionManager (#14001)
* refactor(rizin): extract NUL-frame reader and wait helpers from RizinDebugSessionManager
* fix(ci): track extracted Rizin frame helpers
* refactor(native): extract NativeAotPeImage from nativeAotPe (#13998)
* chore(guards): declare desktop build-computer entries and clear the entry baseline (#14011)
* perf(go): stream Go binary inspection over FileHandle for ELF, PE, and Mach-O (#14003)
* perf(go): stream Go binary inspection over FileHandle for ELF, PE, and Mach-O
* fix(go): share parsing and bound positional string reads
* perf(go): reuse target reads under the scan budget
* refactor: remove internal re-export shims and guard against new ones (#14009)
* refactor: remove internal re-export shims and guard against new ones
* fix(ci): catch namespace module re-exports
* perf(elf): reuse proven symbol suffixes in unwind lookup (#14014)
* refactor(cli/server): break remaining module-layer cycles (#14013)
* refactor(cli,server): break remaining module-layer cycles
* fix(ci): follow relocated CLI entry points
* refactor: remove retired internal reader exports
* fix(ci): track configuration inputs across cached checks (#14015)
* fix(ci): close static-check cache gaps and prune stale settings (#14017)
* fix(ci): close static-check cache gaps and prune stale settings
* chore(ci): remove unused Actionlint runner label
* fix(ci): rerun TODO scans against the host interpreter
* fix(elf): retain verified artifact reports through descriptor finalization
* test(elf): assert retained reports during descriptor finalization
* refactor(elf): retire the test-only dependency buffer driver
* test(elf): join the paused dependency parser on failure
* refactor(elf): consolidate kernel module checks on positional reads
* fix(elf): preserve kernel config framing and location provenance (#14021)
* perf(elf): bound kernel module signature digest reads (#14024)
* fix(elf): retain verified kernel reports through descriptor finalization (#14022)
* refactor(go): consolidate native parser checks on positional reads (#14027)
* feat(uefi): record the owning FFS file of extracted payloads
Each published extraction file now names the FFS file whose body or section produced it, with its GUID, user-interface name, type and logical path. Decoded streams resolve through their carrier section. Callers no longer need to match output paths against a separate inspection to find which driver a file belongs to.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(analysis-view): page retained UEFI extraction manifests
Add the uefi-extraction view for extract_uefi_firmware Evidence. The summary returns file, byte, derivation and gap counts, source, media-type and gap-kind tallies, and a bounded preview of the first published files. Pages select files by exact media type, source and owning FFS GUID, name or type, in publication or size order, plus derivations and gaps by kind. Counts and the size order are built once per retained report.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(uefi)!: summarize firmware extraction by default over MCP
A whole-image extraction of a 4 MiB OVMF image lists 560 files in about 553 KB of structured content, which exceeds client result limits. MCP extract_uefi_firmware now retains the complete manifest and returns its summary unless the caller passes detail complete. Targeted extractions fit in the summary's file preview. An optional view returns the first uefi-extraction page in the same call; later pages use inspect_analysis_view. The one-shot CLI command still returns complete Evidence.
BREAKING CHANGE: MCP callers that need every published file inline must pass detail: "complete" to extract_uefi_firmware.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* docs(firmware): describe UEFI extraction summaries and owners
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(uefi): attribute a refused output directory to output_directory
An existing output directory was reported as an invalid path issue, which points callers at the firmware image instead of the directory they chose. Route destination refusals through outputDirectoryAdmissionRefusal, as firmware extraction already does.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(go): reject contradictory module coverage in retained views (#14029)
* fix(go): retain verified reports through descriptor finalization (#14026)
* perf(analysis-view): page unfiltered Go and Rust metadata directly (#14030)
* refactor(rust): consolidate binary parser checks on positional reads (#14033)
* feat(native): report the stored RVA of PE exports
PE export rows reported only the preferred-base virtual address, which the parser derives from the export-address-table RVA. Callers asking for an RVA had to recover the image base through other tools. Each row now carries the RVA as the slot stores it; a forwarder's RVA locates its forwarder string.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(analysis-view): filter native exports and ELF dependencies by name prefix
Retained native-exports and elf-dependencies views matched only exact names, so counting the exports or imports in one namespace meant paging every row. Add name_prefixes to the exports collection and to every named elf-dependencies collection. A prefix filter combines with exact names, and coverage.total counts every match, so limit 1 returns a count. ELF export prefixes follow the exact-name identity rules: non-ASCII names compare their UTF-8 bytes, and names that are not valid UTF-8 never match. The tool descriptions now name the filter.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* docs(native): describe export RVAs and name-prefix views
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(analysis-view): read older UEFI extraction Evidence and drop filter-count ceilings
extract_uefi_firmware rows gained a required ffs_file, so extraction Evidence saved before that field failed to parse in retained views. The field is now optional when reading: the extractor still always records it, and an unrecorded owner matches no owner filter. UEFI view filters also capped each list at 64 values without a format, protocol or resource reason; overlapping filters cannot be split into separate requests without miscounting, so the cap is removed. MCP input-element admission still bounds every request.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(python): validate marshal coverage and consolidate pyc tests (#14036)
* perf(rust): reuse the Wasm section probe for custom name lengths (#14035)
* refactor(process): share the abortable command-turn wait between GDB and Rizin (#14042)
* fix(erlang): require complete positional BEAM reads (#14045)
* fix(rust): retain verified reports through descriptor finalization (#14034)
* test(process): consolidate symlink snapshot captures (#14051)
* fix(domain): make partial count switches exhaustive for typed lint (#14048)
Deep static checks on main fail typed lint (switch-exhaustiveness-check) in three counting switches introduced by recent single-pass summary refactors. Name the unmatched 'none' basis explicitly and give the graph/AST switches a documented default.
* refactor(server): extract ForwardingTransport base class for MCP Transport wrappers (#14050)
* fix(devicetree): validate retained report ranges and coverage (#14066)
* fix(ci): fall back to Ubuntu Azure archive in recorded-crash container (#14061)
The Ubuntu 24.04 recorded-crash container repeatedly timed out at 150s refreshing APT indexes from archive.ubuntu.com and security.ubuntu.com on main. Split Noble's 150s refresh budget into a 75s initial attempt followed by a 75s retry against http://azure.archive.ubuntu.com/ubuntu (matching ubuntu-archive's Noble Azure fallback while keeping http:// before ca-certificates is installed), and leave Debian unchanged at 150s.
* fix(erlang): retain verified BEAM reports through descriptor finalization (#14062)
* perf(uefi): skip verified erased padding in NVRAM scans (#14069)
* test(uefi): consolidate volume ownership and checksum proofs (#14070)
* fix(ci): run type-aware lint on changed files in fast PRs (#14068)
* fix(v8): preserve verified code cache results and require exact payload reads (#14067)
* refactor(config): return Result for ConfigurationError in IdaConfiguration and KiloClientLocation (#14053)
* refactor(config): return Result for ConfigurationError in IdaConfiguration and KiloClientLocation
* fix(config): return Kilo file-probe failures through Result
kiloGlobalLocation returned inline-configuration failures as Result but kept
throwing the shared probe's ConfigurationError, and kiloLayeredLocation no
longer caught it: an unreadable Kilo folder rejected resolveSupportedClients
for every client instead of staying a Kilo row failure. Convert probe
failures at the same Result boundary and register the counted catch.
Validation: a new boundary test (regular file at Kilo's config root) fails
without the fix and passes with it; kiloClientLocation, clientLifecycle,
mcpAddClientLifecycle and registration catalog suites pass; check:fast
passes.
* fix(ida): preserve the size rejection when descriptor close fails
The 64 KiB rejection became a completed outcome holding a rejected Result,
so the cleanup-failure handler replaced it with generic close guidance.
Read the rejection from the completed outcome when composing the cleanup
error, covering both the admission and growth size checks. Restore the
close spy leaked by the existing denial test, which the new cases exposed.
Validation: a new it.each denies close after each size check, asserts the
64 KiB message plus retained-cleanup release, and fails without the fix;
the IdaConfiguration suite and check:fast pass.
* refactor(uefi): exercise only the framed LZMA worker (#14072)
* fix(uefi): preserve verified source identity through descriptor finalization (#14073)
* refactor(config): return Result from resolveKiloRegistrationWorktree (#14055)
* refactor(config): return Result from resolveKiloRegistrationWorktree
* test(config): cover Kilo worktree resolution results
* perf(views): page exact Playwright trace index hits directly (#14031)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
* refactor(domain): compose cleanup dependencies through analysisErrorCleanup helpers (#14064)
* refactor(domain): compose cleanup dependencies through analysisErrorCleanup helpers
* fix(kuna): honor completed project cleanup when wrapping failures
* refactor(domain): one ByteSource representation for streaming parsers (#14044)
* refactor(domain): one ByteSource representation for streaming parsers
* refactor(nuget): adopt ByteSource across NuGet and APK parsers (#14047)
refactor(nuget,apk): adopt ByteSource and drop the NuGet in-memory parse branch
* test(elf): remove obsolete byte source fixture declarations
* refactor: centralize owned finalization and configuration failures (#14071)
* refactor(config): propagate typed configuration failures
* refactor(lifecycle): centralize completion and cancellation
* fix(config): preserve Hermes YAML edit refusal guidance
* fix(reference): preserve file cleanup when directory enumeration fails (#14081)
Directory enumeration can list a file and then fail with EIO. If that
file read is cancelled and its close fails, replacing the cancelled
result with success dropped the still-open file. Keep the directory
read failure primary and merge the file's remaining resource into both
cleanup-combination returns.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* fix(ci): bind timing evidence to its workflow attempt (#14080)
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
* fix(ci): trace test dependencies through static template imports (#14079)
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
* fix(ci): retain cache generations per restore version (#14084)
* fix(ci): retain cache generations per restore version
* test(ci): align inherited Mach-O assertion with main
---------
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
* fix(ci): use retry start times in PR health reporting (#14085)
* fix(ci): use retry start times in PR health reporting
* test: cover the reviewed CI boundary cases
---------
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
* perf(javascript): reuse completed CommonJS module-source queries
Static and semantic analysis ask whether the same callee or receiver is a CommonJS module object or require delegate at the same read site several times; a minified 1.9 MB webpack main bundle repeated about half of its 92,374 queries. Once member-mutation facts are complete, an identical query reuses its answer and re-records the resource limits the first walk reached. The answers are cleared with the semantic value caches and require-delegate writes, which every state change that can alter them already invalidates. The same bundle runs 48,447 walks instead of 92,374, and static and semantic results are unchanged on all 43 sources of the measured application.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(javascript): skip captured-selection normalization without captures
Most loader sources carry no captured selections, yet normalization allocated a map and sorted an empty array for each one before returning nothing. Return that result directly.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(javascript): build loader context keys without JSON serialization
Every module-source work item serialized its read site and capture boundaries to JSON to key its context. Build the same key by concatenation; absent and null positions still share a key, and absent captures still differ from an empty capture list.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(javascript): reuse preload-discovery static checkpoints in the normal pass
When any .js source belongs to a module package, preload discovery statically analyzes every source and the normal pass analyzes each one again. The worker now keeps the complete static checkpoint discovery computed, keyed by container, path, text digest, package type, precision and member-mutation allowance, and the normal pass of the same source writes that checkpoint instead of recomputing it. Static analysis is deterministic for those inputs, so the parent reads, validates and charges byte-identical facts. A discovered preload whose package type changes, a source discovery could not checkpoint, and a replaced worker all recompute. Retained checkpoints are consumed once and bounded to one eighth of the worker's V8 heap limit.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(javascript): park the worker after preload-discovery allowance refusals
A scoped worker closed instead of parking after any failed analysis, so one member-mutation refusal during preload discovery discarded the process and every static checkpoint it retained. Discovery skips such a source and the normal pass analyzes and reports it again, and the worker reports the refusal while staying healthy. A discovery checkout whose failures are all member-mutation refusals now parks if canReuse still holds. Other failures, and any failure in a normal analysis, still close the worker.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(javascript): keep the worker reusable after a final discovery refusal
The worker's reuse state cleared its last failure only on success, so a
member-mutation refusal of the last discovered source still closed the
worker and discarded every retained static checkpoint. The worker now
owns the recoverable-refusal rule, and the scope uses the same predicate.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(javascript): skip checkpoint encoding without reuse capacity
Runtimes without a reported heap limit (Bun) retain nothing, yet discovery
still encoded every complete checkpoint before checking capacity. Check the
remaining capacity first.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(analysis-view): select inventory occurrences by artifact kind
Finding the native addons in an application archive meant paging every
inventory occurrence (about 1 KB each) or reading the complete inspection,
because occurrences could be selected only by exact path, ID or entry kind.
Add artifact_kinds, which matches the recorded artifact kind exactly and
intersects with the other selectors, so one call returns, for example,
every native-addon occurrence with selected fields.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(analysis-view): select retained JavaScript facts by property value
javascript-facts selected observations only by location and node kind, so
reading one operation of an IPC channel set meant paging every channel
observation of the file. Add where.properties: each listed key must be
retained with one of its JSON scalar values. A missing key or non-scalar
value never matches, and repeated keys must all hold.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(analysis-view): count distinct retained JavaScript fact values
Counting the distinct IPC channels of one operation meant paging every
observation, each with its full Evidence, and deduplicating by hand; real
clients miscounted send channels on a large Electron app. Add the
javascript-fact-groups view: with the javascript-facts selectors and
group_by property names, it returns each distinct combination with its
observation and node counts, ordered by canonical JSON, and its total. A
missing key stays omitted, distinct from a retained null such as an
unresolved dynamic channel. The analyze_javascript_application description
names the IPC grouping.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* docs(analysis-view): qualify javascript-fact-groups readback to scalar values
where.properties selects only present JSON scalar values, so a group over
array, object or missing values cannot be read back through it. Say so in
the group_by description and the workflow guide, and assert the exact node
count of a repeated channel in the MCP test.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* perf(ghidra): scan defined data for selective string search instead of materializing inventory (#14101)
search_strings now scans getDefinedData directly when the string inventory has not been built, matching before allocating StringFacts and retaining only matches in STRING_ORDER. Sessions that only search no longer pay full inventory materialization and retention in the bridge JVM heap; list operations still build the cached inventory as before.
Refs #13292, #13355. Verified: ghidraBridgeSources (11 tests), javac against Ghidra jars, check:fast, and a real Ghidra 12.2 + JDK 25 probe asserting search-before-list equals search-after-list for regex and insensitive literal queries. No wire or result-order change.
* perf(ghidra): scan procedures for selective search without retaining inventory (#14103)
search_procedures now builds procedure entries without populating procedureInventory when it has not been built yet (buildProcedures extracted from procedures()), so a search-only session does not retain the full procedure inventory in the bridge JVM. Cached path, name index, order (PROCEDURE_ORDER) and matched_aliases output are unchanged. Companion to the search_strings scan in #14101; together they apply the DDIA rule of materializing inventories only for repeated list access, not for one ad-hoc search.
Refs #13355, #13299. Verified: javac against Ghidra 12.2 jars, ghidraBridgeSources 11 tests, and a real Ghidra 12.2 + JDK 25 probe asserting search-before-list deep-equals search-after-list (7 procedure matches, 12 procedures).
* refactor(frida): make inspectStatus async and load the view service lazily (#14108)
FridaInstrumentationService was the last application service statically importing AnalysisViewService for a conditional summary branch, because inspectStatus was synchronous. It is now async (its only production caller, debuggerToolBindings, already runs it inside an async handler), loads AnalysisViewService dynamically only when detail=summary, and otherwise imports only the retention check. Tests updated to await the six call sites; no behavior change.
Refs #13275. Verified: FridaInstrumentationService tests (37), check:fast. Stacks cleanly with #14102, which moves the retention import to AnalysisViewRetention.ts; resolve by taking that import line if both land.
* fix(ida): extend verifier admission check deadline to 90s
The admission check spawns scripts/verify-real-ida.mjs, which imports the
full dist graph before reaching the early admission errors. Under CI shard
load that exceeded the 10s command deadline and failed Test shard (5/12)
on main, while the same sha passed the scheduled run. The sibling verifier
observations check already uses 90s for the same script.
* perf(search): derive literal candidates from regex alternations (#14106)
* perf(search): derive literal candidates from regex alternations
extractRequiredRegexLiteral previously returned undefined for every alternation, so regex search_strings/search_procedures with alternatives paged full IDA inventories and transferred full Hopper inventories for Node-side matching. It now computes, for top-level and required-group alternations, the longest literal every branch guarantees (longest common substring of each branch's required runs) and returns it as the provider candidate; Node still verifies the full ECMAScript regex on candidates, so the candidate remains a zero-false-negative prefilter. A branch-common segment floats inside each branch and is never joined to neighbouring literals.
Refs #13353. Verified: regexLiteralCandidate tests (including the /u and /iu zero-false-negative corpus with new alternation patterns), IdaOperationRunner tests, HopperRegexSearch tests, check:fast with architecture guards.
* fix(search): require two code points for alternation candidates
A single shared code point (e.g. matched|absent -> a) matches nearly every value, so alternation-derived candidates now require at least two code points to be worth a provider round trip; shorter commons fall back to full inventory as before. Single-branch literals keep existing behavior. HopperRegexSearch routing tests pass unchanged.
* fix(search): bound alternation candidate extraction work and nesting
Long disjoint alternatives could spend hundreds of thousands of substring probes on the calling thread, and nested alternation groups recursed once per nesting level. Cap total probes (falling back to the full inventory past the budget) and cap alternation recursion depth, abandoning only the over-deep branch. Tests cover 2000-deep nesting and 1024-char disjoint alternatives.
* refactor(application): move AnalysisViewRetention to a light module and defer view loading in services (#14102)
* refactor(application): move AnalysisViewRetention to a light module and defer view loading in services
AnalysisViewRetention and requireAnalysisViewRetention moved from AnalysisViewService (which pulls the 1.3 MB analysis-view result graph) into AnalysisViewRetention.ts, which depends only on error and Evidence port types. All type-only consumers now import the light module. ApkSignature, Il2cpp and Reverse services load AnalysisViewService dynamically only on the detail=summary branch, and executeArtifactInspection checks retention readiness through the light module and loads the view service only after a successful inspection. No behavior or wire change.
Refs #13275, #13940. Verified: check:fast (typecheck, lint, architecture guards), 93 source tests (AnalysisViewService, Il2cpp, ApkSignature, Reverse), cliStartupImports 10/10 on pinned Node 24.22.1, knip clean. Remaining static importers (ArtifactComparisonEvidence, environment build/state, Frida sync inspectStatus, server bindings) still block a full chunk split and stay in #13275.
* fix(application): recheck cancellation after lazy view imports and guard static view links
An abort arriving while the dynamic AnalysisViewService import was pending still recorded and returned a successful summary. ArtifactInspectionExecution, ApkSignature, Il2cpp and Reverse now recheck the signal after the import (retaining the complete Evidence as the cancelled partial observation) before projecting. Add a counted architecture guard so static AnalysisViewService imports in application services cannot return silently; the baseline records only the known synchronous helpers and Frida path tracked in #14112.
* perf(tests): supervise direct vitest scripts through run-exclusive on POSIX (#14104)
* perf(tests): supervise direct vitest scripts through run-exclusive on POSIX
test:run, test:with-build, test:boundary, test:mcp, test:acceptance, test:integration, test:coverage and test:verbose invoked vitest directly, so an interrupted run could orphan detached provider children outside the owned process group. They now go through scripts/run-vitest.mjs, which wraps Vitest in run-exclusive --unlocked on non-Windows platforms (mirroring run-development-tests.mjs) and invokes Vitest directly on Windows, where source tests must not require the built Job Object artifact. Watch and CI shard scripts are unchanged.
Refs #13357. Verified: launcher smoke run (4 tests passed), check:fast, knip.
* fix(tests): forward stop signals from the vitest launcher to its child
The launcher ignored SIGINT/SIGTERM when wrapped, so a signal sent only to its PID left Vitest and its descendants running. It now always forwards to the child (run-exclusive can only forward signals it receives itself) and reports the tracked signal's exit code (143/130) deterministically. Verified with a manual probe: SIGTERM to the launcher PID during a 60s fixture test exits 143 with the tree stopped; launcher smoke run passes. A nested-supervisor in-process test proved environmentally unstable (the inner Vitest main is killed under nested run-exclusive supervisors) and was not landed.
* perf(contracts): prune only over-depth schema branches instead of reducing whole schemas (#14107)
* perf(contracts): prune only over-depth schema branches instead of reducing whole schemas
A schema whose inlined form exceeded the depth-10 advertised limit fell back to reduceToShallowProperties for the entire tool, erasing enums and nested validation on all root properties. pruneSchemaBeyondDepth now replaces only sub-schemas past the prune depth with type-preserving placeholders (every replacement widens acceptance, so canonical server-side validation is unchanged), and both input and output compaction keep the pruned form as inline when it fits bytes, depth and dialect checks. Two compactInputSchema tests that pinned depth-forces-reduction now pin the pruned-inline contract with the same Ajv/dialect safety assertions.
Refs #13302. Verified: compactInputSchema, compactOutputSchema, toolSchemaMetadata, advertisedInputExamples (59 tests), check:fast, docs:check.
* docs(contracts): refresh advertised schema summary for pruned-inline compaction
Pruned-inline schemas retain patterns (digest, Evidence id and text patterns) that whole-schema reduction dropped on 13 tools; regenerate the committed catalog summary with npm run verify:advertised-schemas -- --update-summary and re-verify clean.
* fix(contracts): make deep-schema pruning widening-safe
Walk schema positions instead of raw JSON, preserve declared integer types, keep branches that fit, return no pruned schema under not/oneOf where widening can reject valid values, and recheck output byte budgets. Add regression coverage for closed objects, unsafe combinators, fitting enums, and nullable integers; refresh advertised summaries.
* fix(contracts): keep untyped deep schemas unconstrained when pruned
Inferring object from properties or array from items narrows an untyped schema, which accepts every JSON value; the placeholder is now always unconstrained when no type is declared. Add an Ajv regression accepting null and nested values through a pruned untyped branch.
* test(contracts): assert pruned untyped schemas at depth 8
The regression accepted values that never reached the replaced node, so
it stayed green for an object placeholder and did not distinguish
branch pruning from whole-schema reduction. Assert the empty schema at
depth 8 and accept null there.
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* docs(github): require reported verification and factual docs in PR template (#14130)
* docs(github): require reported verification and factual docs in PR template
Record the maintainer checks for running needed validation, limiting
comments to constraints and decisions, and keeping documentation factual.
Mirror that guidance in AGENTS.md where it was not already stated.
* docs(github): assign the PR checklist to the author
Rename Before merge so the PR author completes it before requesting
review, and point the draft-PR note at that section.
* docs(github): confirm root cause and engineering rules on PRs
Add a few author-checklist items for the root cause, owning-boundary
interpretation, retained cleanup facts, and REA_ limit settings.
* docs(github): attest engineering rules in the PR template only
Restore AGENTS.md to main and phrase the new author-checklist items
as author attestations, including hardcoded limits rather than every limit.
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>
* chore(deps): update MCP TypeScript SDK to 2.4.0 (#14129)
* chore(deps): update MCP TypeScript SDK to 2.4.0
Bump @modelcontextprotocol/server and @modelcontextprotocol/client (and core transitively) from 2.3.1 to 2.4.0, the current v2 release; the legacy @modelcontextprotocol/sdk package line (1.x) is not used. Regenerate package metadata. Notable upstream changes checked against REA usage: no x-mcp-header annotations are used, output schema ids are urn: URIs accepted by the new Ajv fast-uri, and REA does not unwrap structuredContent.result. The 2025-11-25 structuredContent wrapping change for meta-id output schemas is client-visible and noted for release notes.
Verified: check:fast, DeferredEvidenceMcpServer + toolOutputReferences suites (53 tests), deferredRuntime + serverLifecycleMcp boundary suites (41 tests), and a stdio initialize/tools/list probe on all profiles after a clean build.
* fix(contracts): keep compact output unions when the SDK stamps an object root
MCP SDK 2.4.0 treats a $ref union of objects as an object and stamps
type:object before tools/list. Compact reduction then dropped that union
and advertised an empty property bag. Reduce each alternative's root
shape instead, and advertise widened oneOf branches as anyOf so
overlapping branches still accept canonical results. guided_workflows
already declared that object root and had the same empty advertisement.
Refresh the advertised catalog summaries for guided_workflows,
read_guidance_section, and search_guidance.
* chore(licenses): refresh the MCP SDK 2.4.0 dependency inventory
Regenerate licenses/npm-dependencies.txt with the license inventory
script. Update the three runtime notice identities from the lockfile
after checking each 2.4.0 archive integrity and LICENSE text; those
license bodies are unchanged. The notice fingerprint matches the
generator.
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
* feat(javascript): add semantic_analysis structure-only mode to analyze_javascript_application (#14117)
* feat(javascript): add semantic_analysis structure-only mode to analyze_javascript_application
On large Electron apps the default analysis runs full semantic analysis per file (364 s measured in #14100) although first questions are application-graph facts. semantic_analysis: structure-only returns static and application-graph facts without semantic IR, graph content or traces: the worker purpose protocol gains structure-only (full static checkpoint, semantic phase skipped, no semantic result budget consumed), adoption records the mode once as a limitation, and Evidence parameters record the selection. Default complete behavior is unchanged.
Closes #14116. Verified: javascriptArtifactReconstruction, electronApplicationAnalysis and javascriptApplicationService suites (75 tests incl. new structure-only e2e), worker server/schema tests, check:fast, docs:check, advertised schema summary regenerated.
* test(javascript): assert semantic relations in the structure-only test
* fix(javascript): record structure-only semantic coverage as incomplete and retain refusal facts
Structure-only files now record a semantic unavailable reason so graph coverage cannot claim complete examination (comparisons will not report skipped bindings as removed), member-mutation refusal checkpoints cross for structure-only as they do for complete analysis, and the e2e control asserts real semantic content under the default.
* docs(javascript): document semantic_analysis and expose --semantic-analysis
The owning reconstruction guide now describes the complete default, what structure-only returns and skips, and how to follow up with complete analysis of selected sources. The CLI projection declares the field so --semantic-analysis <complete|structure-only> is accepted with the contract enum.
* fix(javascript): record structure-only application coverage as partial
Structure-only omits source-module and export-binding nodes. The
application graph now reports partial coverage with a null omission
count, so a comparison of an unchanged application treats those
bindings as unknown rather than removed.
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* perf(browser): fetch source maps with bounded lookahead and in-order admission (#14115)
* perf(browser): fetch source maps with bounded lookahead and in-order admission
fetchWebSourceMaps awaited each map's full fetch-decode cycle before starting the next, so bundles with dozens of external maps paid serial round trips. Responses now start with a lookahead of 4 (approved origins only, never past the operation deadline), while every budget (URL bytes, retained bytes, decoded records), deadline check and decode still happens strictly in request order inside fetchOne, so item order, inclusion under output limits and limitations are unchanged. A started prefetch that is never admitted is cancelled in teardown, and abort/deadline paths route through fetchOne so retained-cleanup ownership (SourceMapPendingFetch) is preserved.
Closes #14109. Verified: WebSourceMapFetcher tests 31 passed (30 existing unchanged plus a new out-of-order-completion proof asserting overlap >1 and request-order admission), check:fast.
* fix(browser): abort and bind cleanup for unadmitted source-map prefetches
Teardown now aborts the operation controller before removing deadline/caller controls, and every started-but-unadmitted prefetch is settled and bound to the returned result: pending-fetch cleanup becomes the retained failure (or a secondary failure on an existing error), and unread prefetched responses are cancelled with cleanup failures tracked. The lookahead test now gates six requests to prove the four-fetch cap.
* fix(browser): pipeline source-map fetches without speculative or reordered requests
Start each request's fetch after its budget reservation and deadline checks pass, and start the next fetch only when the current body is read and the next failure reservation still fits. Redirect chains and host-observable request order stay sequential; the next fetch overlaps only the current decode. Sibling binding now ignores teardown-abort artifacts and binds only genuinely incomplete cleanup. Boundary suites (49 tests) and unit suite (31) pass unchanged in their budget and redirect assertions.
* fix(browser): retain sibling source-map cleanup on teardown
Cancellation that stops admission at the first map left later lookahead
fetches owning unread responses. Teardown skipped stored failures and
recorded the rest only as secondary notes, so the returned error could
report cleanup complete while those resources were still owned.
Await every started prefetch and merge its live cleanup through the
existing cleanup-composition helpers, preserving remaining resources.
* fix(browser): keep caller cancellation through source-map cleanup
Unused-prefetch teardown chose success before its cleanup wait and after
the caller abort listener was removed. Recheck the caller signal after
that wait so a cancel during a successful release stays a cancellation,
while an existing failure keeps its cleanup owners.
Cover unused-prefetch release, mixed redirect and prefetch cleanup, and
cancellation during release with structured cleanup facts.
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* fix(gpu): name an unreadable shared section instead of a bare null count (#14133)
Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
* perf(process): pool regex workers across match calls (#14114)
* perf(process): pool regex workers across match calls
matchRegexValues spawned a fresh worker_threads Worker per call (~10.5 ms measured, vs ~0.9 ms pooled for a trivial match on 1-5k candidates). Workers are now pooled by heap class (max 4, 10 s idle reap, unref'd while idle): the worker protocol is message-driven, a worker is reused only after a clean matched/invalid-pattern reply, and deadline, abort, error, exit or malformed replies retire it so a stuck pattern can never poison the pool. Queueing for a busy pool counts toward the caller's deadline. Results, heap and deadline errors, and cancellation semantics are unchanged.
Closes #14110. Verified: RegexMatcher + RegexMatcherReply + boundary regexMatcher + HopperRegexSearch + IdaOperationRunner tests (91+15), check:fast, and a 15-call benchmark (10.5 ms -> 0.9 ms per call).
* test(process): use the admitted deadline source spelling in the pool test
* fix(process): enforce queue deadlines, reclaim idle regex workers, and await retirement
Address pooled-worker review findings: the matching deadline now starts before pool acquisition (queue waiters expire and expired jobs are never posted), idle workers of another heap class are reclaimed instead of blocking a changed heap setting, queued worker startup failures reject into the normal Cannot-start path, and non-clean outcomes await worker termination before returning so close() cannot finish while matching work lives. Add RegexMatcherPool.test.ts with a construction-counting fake worker proving reuse across clean calls and termination-before-return plus replacement after a deadline.
* fix(process): allocate regex workers through one capacity path
Acquisition retired an idle worker and spawned directly, bypassing waiter order: retirement served an older waiter into the freed slot and acquisition then spawned a fifth worker. Acquisition now only takes an idle match or enqueues, and serveRegexWaiters owns every spawn/reclaim decision in waiter order. Add a mock-pool regression proving a fifth queued search deadlines at four constructions.
* fix(process): reclaim incompatible regex workers on one path
Keep a stopping worker counted until terminate settles, and let release
ask the shared allocator so a different heap does not wait out the idle
reap. A failed stop stays owned and is recorded beside the match error.
* fix(process): mark background regex-worker stops and release test gates
Typed lint rejects an unmarked beginStopRegexWorker promise, so the
allocator's fire-and-forget stops are explicit. Pool tests release held
workers in finally, including when an assertion fails first.
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>
* perf(mcp): serve compact output schemas from the build-recorded catalog (#14121)
* perf(mcp): serve compact output schemas from the build-recorded catalog
The compact output profile forced the eager runtime: full server composition plus runtime schema compaction measured at ~700 ms init + ~421 ms first tools/list, vs ~125 ms deferred for the default profile. The catalog recorder now also records bounded compact output advertisements per tool at build time; the deferred server serves them verbatim (new recorded presentation kind, canonical validation unchanged on calls), main admits the compact profile to the deferred path, and catalogs recorded before this field fall back to eager. Measured after: compact init 118 ms + list 7 ms at the same ~672 KB payload.
Refs #13275. Verified: DeferredEvidenceMcpServer tests (17), check:fast, build:cached, and a stdio probe comparing default/compact/hot-cold initialize and tools/list timings and bytes.
* fix(mcp): align compact deferred listings with the recorded catalog
Deferred compact startup used the off-profile catalog digests, so the first
tool call rejected the runtime. Select the digest for the configured output
profile.
Recorded output presentation skipped compaction for every listed schema.
Track which tools have a build-recorded advertisement and compact live
registrations, including discover_tools.
The recorder stored a contract projection. Legacy clients receive that
projection after the SDK stamps or wraps a non-object root and REA compacts
the listing. Record that listed schema.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* docs(mcp): describe recorded compact startup
Compact stdio startup serves the recorded catalog, including compact output
when that catalog has compact schemas. A compact profile whose catalog has
none falls back to eager composition. Initial-target, HTTP, family-scoped
hot/cold, and source runs without recorded artifacts stay eager.
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>
* feat(analysis-view): select inventory occurrences by path glob
Questions about one directory of a large archive, such as the native
libraries under lib/ in an APK or the classes of one package in a jar,
required paging every occurrence, because occurrences could be selected
only by exact path, ID or kind. Add path_globs, which match whole recorded
logical paths: * and ? stay within one segment, a ** segment spans zero or
more segments (or everything below when last), other characters are
literal and case-sensitive, and the container's own "." row never matches.
Several globs union, then intersect with the other selectors, so one call
returns, for example, every file at the archive root or below assets/.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(analysis-view): order inventory occurrences by size before paging
Finding the largest files in an archive meant reading every occurrence
and sorting client-side, which for a jar of 28,671 entries is tens of
megabytes of rows. Add order_by with field declared_size or
compressed_size and an ascending or descending direction. Selected rows
are ordered before paging; unknown sizes, such as directories, come last in
either direction and ties keep inventory order. The container's own "."
row carries its size, so the description points at path_globs ["**"] to
rank only its entries.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(analysis-view): match inventory path globs without backtracking
Globs compiled to regular expressions in which every * became another
overlapping [^/]* group, so a selector such as *a*a*a*a*a*a*a*a*b took
polynomial time in the name length to reject a long run of a's, and
selection runs synchronously before paging. Match each segment with the
two-pointer wildcard algorithm, which keeps one retry point and bounds
work to pattern length times segment length, and resolve ** segments with
a reachability pass over path segments. Matching semantics, including
code-point ?, literal metacharacters and a trailing ** needing one segment,
are unchanged.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* test(analysis-view): cover compressed-size inventory ordering
The ordering test selected only declared_size, so an implementation that
ignored order_by.field still passed. Add an archive whose repetitive text
i…
* fix(artifacts): keep refusal facts on DMG verdicts and the selected bundle path
hdiutil's "image not recognized" verdict raised the unsupported reason
without the owner's facts, so the inventory translation treated it as a
reader defect. It now carries an unsupported dmg target failure, and the
reader-failure constructor requires facts for every target reason.
A bundle resource refusal names the caller's selected bundle path rather
than its resolved target.
The real-provider verifiers and the Android, source-location acceptance
tests expect the model's target-failure categories and codes.
* test(errors): assert unsupported refusals' kind and format, and align verifiers and the Electron guide
* test(errors): check the MCP target failure as the text clients receive
The stdio transport removes the private structured carrier from every isError result, so the conformance suite asserted a field that never reaches clients and failed every case. The projected diagnostic is checked from the JSON text instead.
* test(errors): raise main's new unsupported-target fixtures through the model
* test(artifacts): expect artifact_changed when selected bytes change after inventory
Bundle resources replaced after open and unselected JavaScript sources rewritten after inventory now fail a change check, so they report artifact_changed with retry backoff rather than artifact_operation_failed.
* fix(errors): report a session digest mismatch as admitted-identity
The digest the session admitted does not change when the same request is
repeated, so targetDigestChangedFailure was inviting a backoff retry that
fails the same way. It now names admitted-identity, which stays
artifact_operation_failed and not retryable, and tells the caller to reopen.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(artifacts): classify unused PyInstaller compressed input as layout
zlib stops at the first complete stream, so a declared span that arrives
intact but is not fully consumed is trailing junk or a second stream, not
a file that changed. A source that ends before that span stays read-coverage.
The cached-carrier test replaces the file with a different size so a shared
timestamp cannot hide the rewrite.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(applications): expect unsupported_target for a damaged trace stream
A trace member whose CRC fails is a malformed zip target. The partial
Evidence assertion now checks that code, failure_kind and format.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(artifacts): assert Android refusal kinds and drop the SEA registry case
details.reason is the owner's description, so the boot-image refusals
assert failure_kind and format. A malformed SEA blob inside an ELF stays
an outer-format inventory with a recognition limitation, which the Node
SEA reader tests already cover, so it is not an inspect_artifact refusal.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(artifacts): pass the selected path into translated target failures
translateArtifactFailure names the caller-selected path on a format
refusal. Directory inspection and a retained artifact scope both know
that path and now supply it.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(artifacts): charge global pax records against the tar metadata budget
Repeated pax global headers were copied into one map without a charge, so
each header could stay inside the extended-header allowance while the map
grew without a bound. The retained metadata budget is charged for the
merged map's keys, values and entries before that map is allocated.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(cli): rewrite target recovery when cleanup omits the retry hint
cleanup_incomplete keeps the target recovery text and drops retry. The
table text for every kind except io does not depend on that hint, so the
CLI still replaces MCP tool names. An io failure still needs the hint,
because its text differs for a transient errno.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(apple): stop expecting fields already taken off the located details
The malformed dispatch check reads failure_kind and format, then compares
the remaining details. Those two fields were still in the expected object,
so the comparison could not succeed.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(dylib): expect admitted-identity when the opened target is replaced
The session keeps the digest it admitted, so replacing the executable and
repeating trace_dylib_resolution is not a retryable container change.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* style: format the inventory path translation and conformance suite
* style: format the inventory target-failure call sites
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(artifacts): keep the unsupported-target migration in files the inventory merge replaced
* fix(artifacts): keep target-failure refusals on this branch's error type
A kind this operation does not read is still unsupportedTarget, which
carries the target format. The caller's spelling stays the path on a
reader refusal.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(errors): expect target failures for ZIP inventory refusals and input_conflict for an unlinked IL2CPP pair
* test(cli): compare adapter facts apart from recovery spelling and drop the duplicate bundle-path test
* test(cli): share one adapter-parity check that compares facts apart from recovery spelling
* test(artifacts): expect a malformed target failure for an ISO 9660 directory cycle
* test(web): expect a malformed target failure on the captured source path
* test(artifacts): expect a malformed ZIP target failure for a corrupt Zstandard member
* test(javascript): read the owner's input facts from details.reason and recovery from the projection
* test(iso9660): assert the malformed target failure fields
details.reason is the owner's description. The compiled CLI refusal is
identified by failure_kind and format.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(cli): spell an input refusal with the CLI command
The shared input remediation names the MCP operation and tells an MCP
client to refresh tools/list. The CLI projection spells the command and
drops that clause.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(errors): assert selection and unsupported view fields
A desktop root that is not a directory is a selection failure, so the
CLI reports invalid_request. An analysis view the parent cannot supply
is unsupported evidence; the tests read failure_kind, format, field and
related_operations.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(errors): keep binary plist UID facts on unsupported targets
Pass the reader's UnsupportedBinaryPlistUidError failure through instead of
rebuilding a bplist refusal that drops field and undecodedContent.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(errors): keep oversized binary plist UID facts on keyed archives
Assert the reader projects format, field, and undecoded content from the
parser failure instead of a rebuilt bplist refusal.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* fix(cli): render input-schema recovery from one spelling
Share the input refusal sentence between MCP and the CLI. The CLI replaces
the rendered MCP sentence with the command spelling instead of copying it.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(cli): expect input refusals to name the CLI command
Browser input diagnostics now read the command spelling and omit the MCP
catalog clause. The operation id stays on recovery.operation.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(cli): compare input refusals through adapter error parity
CLI and MCP input refusals share every fact except recovery spelling.
These suites now use that check instead of requiring identical remediation text.
Co-authored-by: morluto <morluto@users.noreply.github.com>
* test(cli): compare target and input refusals by adapter spelling
Managed-graph input checks, binary hardening, and PE unwind ranges keep
the shared failure facts and allow the CLI command spelling to differ.
Co-authored-by: morluto <morluto@users.noreply.github.com>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <1836656514@qq.com>
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: hhang <17309584214@163.com>
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
Co-authored-by: RRFZ <247457381+Plastic-time@users.noreply.github.com>
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
Co-authored-by: 吴佳浩Alben <35291372+XiaoBinGan@users.noreply.github.com>
Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: Anurag Singh <iamchauhan9616@gmail.com>
Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>
Co-authored-by: Truong Giang <truonggiang.axyl@gmail.com>
Co-authored-by: bqw371 <bqw371@gmail.com>
Co-authored-by: akushonkamen <akushonkamen@163.com>
Co-authored-by: Jonathan Henson <jonathanwhenson@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Entrpi <133157614+Entrpi@users.noreply.github.com>
Co-authored-by: jgranie <78536786+jgranie@users.noreply.github.com>
Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
1086 lines
63 KiB
Markdown
1086 lines
63 KiB
Markdown
# Managed-code analysis
|
|
|
|
REA inspects .NET PE/CLI artifacts without loading or executing their code.
|
|
It can identify an assembly, inspect metadata and CIL, compare members across
|
|
builds, and connect declared native calls to supplied native-analysis evidence.
|
|
CIL is Common Intermediate Language, the instruction format used by managed
|
|
assemblies.
|
|
|
|
The seven shipped tools are:
|
|
|
|
| Task | MCP tool |
|
|
| --------------------------------------------------------------------------- | ----------------------------------- |
|
|
| Identify an artifact and its managed deployment form | `inspect_managed_artifact` |
|
|
| Inspect types, signatures, method bodies, calls, and field access | `inspect_managed_members` |
|
|
| List declared native calls and native implementation indicators | `inspect_managed_native_boundaries` |
|
|
| Compare members across builds and map build-local tokens | `compare_managed_members` |
|
|
| Check native call declarations against supplied export or function evidence | `verify_managed_native_boundaries` |
|
|
| Import decompiled code against verified static member identities | `import_managed_reconstruction` |
|
|
| Add managed findings to an application graph | `project_managed_application_graph` |
|
|
|
|
Each has a matching CLI command: replace underscores with hyphens and prefix
|
|
the name with `rea`, for example `rea inspect-managed-artifact`.
|
|
Native-body bridge mapping and managed runtime execution are outside the
|
|
current tool set.
|
|
|
|
The canonical tool inventory is the
|
|
[build-generated catalog](../../reference/mcp-contracts.md#generated-catalog).
|
|
|
|
## Inspect an assembly
|
|
|
|
```bash
|
|
rea inspect-managed-artifact /absolute/path/Assembly.dll --json
|
|
rea inspect-managed-members /absolute/path/Assembly.dll --json
|
|
```
|
|
|
|
Use the artifact result to identify the assembly and its metadata coverage.
|
|
Member results retain build-local tokens, signatures, CIL bodies, and decoded
|
|
relationships. Use an exact reported `full_name` with `--type` when a focused
|
|
inspection is needed; see [selected member inspection](#selected-member-inspection).
|
|
Compare separate builds with [member comparison](#member-comparison), preserving
|
|
their paths, digests, and selection scope.
|
|
|
|
If the PE's `SizeOfHeaders` fails to cover its section table or exceeds the
|
|
file size, the artifact inspection retains PE identity and reports partial
|
|
coverage with the offset of that field. Managed metadata and CIL remain
|
|
unavailable because the section table cannot establish their file mappings.
|
|
|
|
### Field constant defaults
|
|
|
|
`inspect_managed_members` reads field-owned values from the ECMA-335 `Constant`
|
|
table without loading the assembly. Each selected field's `constant` contains
|
|
the declaration's row offset, element-type code, blob index and exact `raw_hex`,
|
|
plus its decoded `element_type` and `value`. For example, an `i4` declaration
|
|
with bytes `865d0000` returns `23942`.
|
|
|
|
Boolean, character, signed/unsigned integers, floating-point, UTF-16 strings
|
|
and class-null declarations are supported. `i8` and `u8` values are decimal
|
|
strings to avoid JSON integer precision loss. Floating-point negative zero,
|
|
NaN and infinities are the strings `-0`, `NaN`, `Infinity` or `-Infinity`;
|
|
`raw_hex` preserves their original bits. UTF-16 code units, including embedded
|
|
NULs and unpaired surrogates, are preserved.
|
|
|
|
`constant: null` means neither a Constant declaration nor `HasDefault` was
|
|
observed. Missing or duplicate declarations,
|
|
inconsistent flags, malformed values and unsupported element types return
|
|
`state: "unavailable"`, a limitation and partial coverage while retaining other
|
|
member facts. This decoding shares the existing metadata representation budget
|
|
and only decodes blobs for the selected fields.
|
|
|
|
Retained `managed-members` field pages can select `fields: ["constant"]` while
|
|
keeping original field identity and source offsets. These values are metadata
|
|
declarations, including enum members' encoded underlying constants, not observed
|
|
runtime state or inferred enum-name mappings. Parameter/property defaults are
|
|
not exposed by this field-focused reader. Member comparison still covers field
|
|
names, flags and signatures; it does not compare constant defaults.
|
|
|
|
The encoding follows [ECMA-335, Partition II, sections 22.9 and 23.1.16](https://ecma-international.org/publications-and-standards/standards/ecma-335/).
|
|
|
|
### Metadata overview and retained rows
|
|
|
|
The existing CLI and omitted/complete MCP detail return complete metadata
|
|
inventories. For identity and classification questions, select
|
|
`inspect_managed_artifact` with
|
|
`{"path":"/absolute/path/Assembly.dll","detail":"summary"}` on the first call.
|
|
This keeps the complete source in the session and returns a distinct linked
|
|
`inspect_analysis_view` overview with complete PE/CLI, classification and its
|
|
evidence, metadata status, module/MVID, assembly, frameworks, returned-row counts,
|
|
coverage/issues and limitations. No assembly is loaded or executed.
|
|
|
|
ECMA-335 permits empty metadata streams to be omitted. An absent `#Blob`
|
|
stream therefore does not prevent module or assembly identity from being read
|
|
when all blob indexes are zero; a nonzero reference to that missing heap is
|
|
reported as a missing-stream issue. Repeated `#Blob` declarations for the same
|
|
file range keep the blob facts and disclose the duplicate. Distinct ranges
|
|
leave nonzero blob indices unresolved. The result keeps module identity, row
|
|
counts, and other independent observations. A row whose current result requires
|
|
a decoded blob is omitted with partial coverage. A separate blob-backed fact
|
|
such as a method's local-variable signature remains unknown when other facts
|
|
about that method are available. An out-of-root stream declaration is malformed.
|
|
|
|
Repeated `#Strings` declarations for the same range keep the existing name
|
|
facts and disclose the duplicate. Distinct ranges leave nonzero string
|
|
indices unresolved. When there is exactly one Module row, its token, file
|
|
offset, generation, raw name index, and independently readable GUIDs remain
|
|
in `metadata.unresolved_module_name` if a malformed or ambiguous name lookup
|
|
prevents reading its name. The usual `module` object is null in this case.
|
|
Index zero still reads as an empty string when the Module row is unique.
|
|
If there are competing string heaps and multiple Module rows, Module
|
|
identity remains unknown even when a name index is zero. A known MVID can bound
|
|
build-local token identity even when the Module name is unresolved. Unreadable
|
|
names do not supply nominal member or type lookup keys. A nil or empty
|
|
TypeDef, MethodDef, or Field name leaves member inventory and cross-build
|
|
comparison coverage partial when the unreadable name could affect a match. A nil
|
|
TypeDef namespace is valid and leaves the type name unqualified.
|
|
|
|
Member inspection records readable row coordinates for unresolved names in
|
|
`unresolved_definitions`. It reports the TypeDef or MethodDef token, file offset,
|
|
and each failed Name or Namespace column with its original heap index. Method
|
|
rows also retain the raw RVA and any known declaring TypeDef token. TypeDef
|
|
coordinates cover the assembly-wide name scan. MethodDef coordinates cover the
|
|
source method interval and any exact declaring-type selection. Use
|
|
`inspect_analysis_view` with `kind: "managed-members"` and
|
|
`collection: "unresolved_definitions"` to page retained coordinates. A missing
|
|
collection in earlier Evidence means the inspection did not record it. When
|
|
capacity recovery keeps only the type inventory, `method_names_examined` is false.
|
|
|
|
If the metadata root declares both compressed (`#~`) and uncompressed (`#-`)
|
|
tables, REA reports both declarations and leaves the row layout unresolved.
|
|
The metadata version and PE/CLI evidence remain available. Member inventories,
|
|
module identity, and native imports that depend on the table layout are
|
|
unavailable. This applies even when the two declarations point to the same
|
|
bytes, because the table kinds differ. A declaration outside the metadata
|
|
root is still malformed.
|
|
|
|
Use `normalized_result.parent_evidence_id` to page original rows:
|
|
|
|
```json
|
|
{
|
|
"source": {
|
|
"kind": "retained-evidence",
|
|
"evidence_id": "<parent_evidence_id>"
|
|
},
|
|
"view": {
|
|
"kind": "managed",
|
|
"collection": "attributes",
|
|
"offset": 0,
|
|
"limit": 16
|
|
}
|
|
}
|
|
```
|
|
|
|
Collections are `references`, `resources` and `attributes`; rows retain their
|
|
original values, nulls, order, metadata tokens and offsets. Pages retain source
|
|
metadata status and coverage. Exhaustion covers the returned parent collection,
|
|
not all possible metadata, and empty rows under partial/unavailable metadata do
|
|
not establish absence. Tokens are build-local and require the recorded artifact
|
|
SHA-256 and known module MVID for cross-observation matching.
|
|
|
|
Retained views do not repeat the parser or require the source file to remain
|
|
available. Portable views use the authenticated original Evidence inline,
|
|
including the existing `inspect-analysis-view` CLI. Session record lifetime and
|
|
export/import semantics remain unchanged. A server without Evidence retention
|
|
rejects selected summary before analysis; complete delivery remains available.
|
|
|
|
### Member summary and retained member rows
|
|
|
|
Complete `inspect_managed_members` delivery always includes the assembly-wide
|
|
`member_refs` and `exported_types`, which `type_names` does not narrow, so even
|
|
one selected or unmatched type can return megabytes. In MCP, select
|
|
`{"path":"/absolute/path/Assembly.dll","type_names":["Namespace.Type"],"detail":"summary"}`
|
|
to keep the complete source in the session and receive identity, metadata
|
|
status, the selection with its unmatched names, coverage/issues, the separate
|
|
user-string coverage, limitations and per-collection counts. Then page original
|
|
rows with view kind `managed-members`:
|
|
|
|
```json
|
|
{
|
|
"source": {
|
|
"kind": "retained-evidence",
|
|
"evidence_id": "<parent_evidence_id>"
|
|
},
|
|
"view": {
|
|
"kind": "managed-members",
|
|
"collection": "call_edges",
|
|
"offset": 0,
|
|
"limit": 64
|
|
}
|
|
}
|
|
```
|
|
|
|
Collections are `types`, `exported_types`, `fields`, `methods`, `member_refs`,
|
|
`call_edges`, `field_accesses` and `user_strings` (the literals). Each page names
|
|
its collection, retains original rows, order, tokens, signatures and body facts,
|
|
and carries the source selection and coverage; `user_strings` pages carry the
|
|
literal pool's own coverage. Evidence whose member decoding exceeded capacity
|
|
never examined exported types or user strings; it reports a null count and
|
|
refuses those pages rather than returning an empty one.
|
|
|
|
To find specific retained members without returning their IL anchors, select
|
|
exact names and defining types, then project columns:
|
|
|
|
```json
|
|
{
|
|
"source": {
|
|
"kind": "retained-evidence",
|
|
"evidence_id": "<parent_evidence_id>"
|
|
},
|
|
"view": {
|
|
"kind": "managed-members",
|
|
"collection": "methods",
|
|
"names": ["ParseNumber", "ParseReadNumber"],
|
|
"declaring_types": ["Newtonsoft.Json.JsonTextReader"],
|
|
"fields": ["name", "declaring_type", "signature"],
|
|
"offset": 0,
|
|
"limit": 64
|
|
}
|
|
}
|
|
```
|
|
|
|
Filters are exact and case-sensitive; lists are alternatives and filters
|
|
intersect. An empty list matches nothing. Names select `name` in types,
|
|
exported types, fields, methods and member references; in call edges they select
|
|
`target_name`, and in field accesses `field_name`. Declaring-type filters select
|
|
`declaring_type` in fields/methods, `parent_name` in member references,
|
|
`target_declaring_type` in call edges and `field_declaring_type` in field accesses.
|
|
Types, exported types and user strings do not accept a declaring-type filter;
|
|
user strings do not accept a name filter. No display strings are reparsed.
|
|
|
|
`fields` accepts only columns of that collection. Omitting it preserves full
|
|
rows, including method bodies. Selecting `body` explicitly returns the full
|
|
recorded body and anchors; selecting no columns (`[]`) returns identity fields.
|
|
Projected or filtered rows add their original `source_index`; tokens and source
|
|
byte offsets remain, with defining/parent tokens or IL-site endpoints where
|
|
applicable. The page retains module/MVID, artifact digest, parent Evidence,
|
|
producer selection and source coverage. Full facts remain in the parent.
|
|
|
|
Paging offsets and totals count known matches in original order. `source_count`
|
|
counts the producer-returned collection; `unresolved_filter_rows` counts rows
|
|
that could match but lack a requested name/type. Those candidates remain unknown
|
|
and are excluded from the matched total. Exhausting the known matches does not
|
|
prove absence among unresolved or unexamined source rows.
|
|
|
|
#### CLI summary and saved member rows
|
|
|
|
The CLI accepts the same `complete` and `summary` detail choices. Omitted or
|
|
`--detail complete` returns complete Evidence. To receive a summary, choose a
|
|
new Evidence bundle destination so its original complete parent remains
|
|
available after the command exits:
|
|
|
|
```bash
|
|
rea inspect-managed-members /absolute/path/Assembly.dll --type Namespace.Type \
|
|
--detail summary --evidence_output /absolute/path/evidence/members.json --json
|
|
```
|
|
|
|
`--evidence_output` writes the complete original Evidence in REA's canonical
|
|
bundle format and prints `{"summary": …, "evidence_bundle": {"path", "bytes"}}`.
|
|
Its parent directory must exist, and it never replaces an existing path.
|
|
Relative paths resolve against the command's working directory. The option
|
|
also works with complete delivery when a saved bundle is useful. Summary
|
|
without a destination is rejected before analysis. For partial Evidence
|
|
and committed-file receipts after failure or cancellation, see
|
|
[Evidence publication and source recovery](../../reference/mcp-contracts.md#evidence-publication-and-source-recovery).
|
|
|
|
Copy `normalized_result.parent_evidence_id` from the summary into the
|
|
`source.evidence_id` field of the `managed-members` request above, then save that
|
|
small request as `members-page.json` and run:
|
|
|
|
```bash
|
|
rea inspect-analysis-view /absolute/path/evidence/members-page.json \
|
|
--evidence-bundle /absolute/path/evidence/members.json --json
|
|
```
|
|
|
|
The view command authenticates the selected bundle and resolves that exact
|
|
parent ID. It does not reopen the assembly, so the original target may have
|
|
been moved or removed. Subsequent calls can select another collection or use
|
|
the returned `coverage.next_offset` to continue the same collection. An inline
|
|
source already includes its parent and cannot also select `--evidence-bundle`.
|
|
|
|
Summary changes delivery, while type selection still controls decoding and the
|
|
same inspection resource limits apply. Each separate CLI page reads and
|
|
authenticates the saved bundle; the full source is retained on disk.
|
|
|
|
## Shipped scope
|
|
|
|
The canonical parser admits PE/CLI bytes and their metadata/CIL without loading
|
|
an assembly. It reports observed implementation markers and unavailable facts;
|
|
it does not itself unpack .NET single-file hosts or infer a NativeAOT identity
|
|
from an ordinary native PE. It does not decode IL2CPP; use
|
|
[IL2CPP metadata](../../il2cpp-metadata.md) for the image, type and method names in a
|
|
Unity `global-metadata.dat`. Inputs without admitted CLI metadata do not
|
|
become managed assemblies through naming or routing guesses.
|
|
Inspect separately obtained components explicitly and preserve their identities.
|
|
|
|
For ordinary .NET single-file hosts, use the existing artifact tools to
|
|
[inventory and extract bundle members](../../dotnet-bundles.md), then inspect the
|
|
extracted assembly explicitly with the managed tools.
|
|
|
|
A valid implementation marker establishes a candidate native boundary, not
|
|
recovered native semantics or runtime behavior.
|
|
|
|
An assembly targeting [.NET Standard](https://learn.microsoft.com/en-us/dotnet/standard/net-standard)
|
|
declares API compatibility across multiple .NET implementations. REA preserves
|
|
that target in `target_frameworks` and leaves `runtime_family` as `unknown`
|
|
unless independent markers identify a runtime family, such as a ReadyToRun
|
|
signature.
|
|
When ReadyToRun is observed, `runtime_family` remains `modern-dotnet` even if
|
|
Unity or target-framework hints are also present; the separate hint evidence
|
|
is retained in the classification evidence list.
|
|
|
|
### Resource admission
|
|
|
|
The static provider defaults to a 128 MiB eagerly retained PE snapshot and a
|
|
separate conservative 64 MiB budget for metadata, CIL decoding and projected
|
|
inspection records. All three static inspection tools accept
|
|
`max_snapshot_bytes` and `max_metadata_representation_bytes` as positive safe
|
|
integers in bytes. CLI inspection and path comparison expose
|
|
`--max-snapshot-bytes` and `--max-metadata-representation-bytes`. An omitted
|
|
value keeps its default; explicit values apply to that call without a restart.
|
|
|
|
Snapshot refusal names its selected byte budget and tells the caller to raise
|
|
it for the same complete file. Representation exhaustion retains partial or
|
|
unavailable coverage and names the selected budget in its `resource-limit`
|
|
issue; raise that budget on the next inspection, or select fewer `type_names`
|
|
for members. For example:
|
|
|
|
```bash
|
|
rea inspect-managed-members /absolute/path/Assembly.dll --max-snapshot-bytes 268435456 --max-metadata-representation-bytes 134217728
|
|
```
|
|
|
|
Reads remain bounded if a file grows after admission. A cached snapshot is
|
|
rechecked against the current call's snapshot allowance and on-disk digest.
|
|
Shared heap strings are cached, but repeated output occurrences still consume
|
|
the representation budget. These are per-call resource policies, not PE format
|
|
limits or a bound on total V8 heap use. Raising one does not raise the other,
|
|
transport limits or available host memory.
|
|
|
|
Path-based member comparison uses the same per-input snapshot policy and
|
|
inspects its two selected paths sequentially, retaining each inspection rather
|
|
than both full byte snapshots. The limit therefore remains a per-file resource
|
|
admission rule, not an aggregate comparison limit. Comparison Evidence keeps
|
|
the caller-selected paths as its parameters and artifact locations.
|
|
When either side's member inspection exceeds its representation budget, the
|
|
comparison limitations name that side and its `resource-limit` diagnostic; its
|
|
empty member collections do not establish added or removed members. Each side's
|
|
`resource_limits` preserves the reported diagnostic's code, scope, detail and
|
|
nullable offset. An empty array means no resource limit was reported. Always read
|
|
the comparison coverage alongside member counts. To compare
|
|
a smaller selection, pass the same repeatable `--type` full names that
|
|
`inspect-managed-members --type` accepts to `compare-managed-members`, which
|
|
applies them to both sides and records them as `type_names`; over MCP, compare
|
|
two `inspect_managed_members` Evidence records selected with the same
|
|
`type_names`. A single selected type can still exceed the budget.
|
|
The CLI command composes that same workflow: it inspects each path as
|
|
`inspect-managed-members` does, then compares the two records. The two-record
|
|
MCP workflow keeps full source Evidence available for `inspect_analysis_view`
|
|
field selection and paging; path-based CLI comparison records the selected
|
|
paths, inspection options and per-side diagnostics, and keeps the baseline's
|
|
member Evidence when the candidate fails.
|
|
|
|
Input overflow returns a resource constraint. Decode or projection overflow
|
|
reports `resource-limit` with unavailable or partial coverage; omitted facts do
|
|
not become empty observations. Ambiguous PE section mappings are rejected
|
|
rather than interpreted according to section order.
|
|
|
|
Minimal Edit-and-Continue metadata marked by `#JTD` is not a standalone
|
|
assembly inventory. The pinned [.NET 9 reader](https://github.com/dotnet/runtime/blob/v9.0.0/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.cs)
|
|
uses different reference widths for this mode, and delta handles require the
|
|
baseline and prior generations. The released
|
|
[metadata serializer](https://github.com/dotnet/runtime/blob/v9.0.0/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataBuilder.cs)
|
|
emits this marker with `#-`; the
|
|
[PE writer](https://github.com/dotnet/runtime/blob/v9.0.0/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedPEBuilder.cs)
|
|
can embed that metadata root. REA reports `unsupported-metadata` at the marker
|
|
header before interpreting table rows, preserving the selected path, artifact
|
|
digest, parsed metadata version and stream names, and admitted PE/CLI facts.
|
|
Metadata status is partial; member and native
|
|
declaration inventories are unavailable. Empty collections do not establish
|
|
absence, and a requested type name is not declared unmatched. Ordinary
|
|
standalone `#~` and `#-` metadata keep their existing interpretation. This does
|
|
not add raw `.dmeta` input, baseline attachment or delta reconstruction.
|
|
Regression coverage uses authored metadata in a generated PE shell; it does
|
|
not establish naturally emitted application PEs, CLR loadability or a real
|
|
Edit-and-Continue execution.
|
|
|
|
### Selected member inspection
|
|
|
|
Member inspection admits type names, tokens, list ranges/counts, nesting facts,
|
|
module identity and their output representation before decoding members. If
|
|
later decoding or projection reaches the 64 MiB representation budget, the
|
|
result retains this type inventory with `coverage.state: "partial"` and the
|
|
original `resource-limit` coordinate. It does not return partially admitted
|
|
member collections: empty fields, methods, references and edges are unexamined,
|
|
not proof of absence; exported types, user strings and signature-resolution
|
|
attestation remain null. Summary and retained pages keep this partial coverage.
|
|
The selected capacity applies to the metadata and member projection together. If metadata or the type inventory itself cannot
|
|
be admitted, the result remains unavailable.
|
|
|
|
Use the returned `types[].full_name` values to select declaring types before
|
|
their signatures and CIL bodies are decoded:
|
|
|
|
```bash
|
|
rea inspect-managed-members /absolute/path/Assembly.dll --type Example.Parser
|
|
```
|
|
|
|
MCP uses `inspect_managed_members` with
|
|
`{"path":"/absolute/path/Assembly.dll","type_names":["Example.Parser"]}`.
|
|
Repeat `--type` or supply multiple unique `type_names` for several types.
|
|
Names match the reported `full_name` exactly. Top-level names require that
|
|
namespace-qualified spelling. Nested declarations also accept their bare
|
|
`name`, including when their own namespace is nonempty; this can select several
|
|
types with that name. Selection uses the parsed TypeDef facts and comparison
|
|
uses the returned declaring types, rather than reconstructing scope from the
|
|
caller's spelling. Each type's `enclosing_type_token` records its enclosing
|
|
TypeDef. `nesting_read` distinguishes complete source rows (true) from
|
|
incomplete rows (false). A null enclosing token
|
|
alone does not establish that a type is top-level.
|
|
Each selected type also retains `name_sha256`, a framed digest of its namespace,
|
|
name and enclosing names. It uses the same bounded, cached owner as signature
|
|
type operands and remains available when selection omits the enclosing types.
|
|
It adds one fixed-size digest per returned type rather than repeated name paths.
|
|
|
|
The result preserves the requested names in `selection.type_names` and reports
|
|
unmatched names separately. If metadata names are unreadable, limitations retain
|
|
that uncertainty. With no selection, `selection` is null and whole-assembly
|
|
inspection keeps its existing resource policy. Selection restricts types,
|
|
fields, methods, call edges, field accesses and user strings; member references
|
|
remain an assembly-wide inventory, so output size is not guaranteed to be small.
|
|
|
|
Coverage describes the selected members. Comparisons leave members outside the
|
|
opposite observation's selection unknown, and application graphs report their
|
|
selected scope as partial. Neither makes an absence claim about the whole
|
|
assembly. The comparison resolves a member's declaring TypeDef token in its own source, then
|
|
checks that nominal `name_sha256` against the opposite selected type set.
|
|
Pairing, absence and aggregate selected-scope agreement share these retained
|
|
facts, including enclosing names, rather than requested spellings or display
|
|
labels. Equivalent requests can cover the same types, while the same display
|
|
name can select different nested owners. Such disjoint selected owners cannot
|
|
establish a member pair or added/removed status even when both inventories are
|
|
complete. Missing nominal identities cannot establish selected membership.
|
|
Incomplete selected inventories or missing identities leave aggregate agreement
|
|
unknown, and the comparison's `coverage.status` is then `unknown`; known
|
|
observed member pairs remain available. A side whose member inspection is
|
|
`unavailable` also makes the comparison `unknown`, even beside a known gap on
|
|
the other side. `partial` is reserved for known gaps such as a different
|
|
selected scope or an unequal method-row page.
|
|
Complete empty selected inventories agree even if their unmatched request names
|
|
differ. Whole-assembly and selected
|
|
inventories remain distinct scopes, and each source retains its exact request.
|
|
The `method_rows` interval records the examined zero-based MethodDef offset, row
|
|
count and full table total before type selection. A complete observation can
|
|
cover only that interval. Comparison keeps omissions from a method page unknown:
|
|
build-local row positions cannot prove member absence across builds.
|
|
`method_rows: null` (the row scope was not examined) also cannot establish
|
|
method absence; observed pairs and field inventory comparisons remain available.
|
|
|
|
For MCP callers, request `detail: "summary"` and page the `types` collection
|
|
using the returned parent Evidence ID. Select one or more returned full names
|
|
in a subsequent `inspect_managed_members` request. Selection is a recovery path,
|
|
not a guarantee: a single type or the assembly-wide member references can still
|
|
exhaust the representation budget. A successful command exit means the Evidence
|
|
was returned; inspect `coverage.state` and `coverage.issues` before treating any
|
|
collection as complete.
|
|
|
|
### User strings
|
|
|
|
`ldstr` anchors keep their build-local `0x70` tokens. `user_strings.literals`
|
|
lists each distinct token loaded by an inspected method body once, in token
|
|
order, with its `#US` file offset and decoded value. Values keep their stored
|
|
UTF-16 code units, including unpaired surrogates. Token `0x70000000` names the
|
|
heap's empty entry at offset 0 and reads as `""`; any other item there is
|
|
malformed. The terminal flag is checked against ECMA-335 II.24.2.4, and the
|
|
length prefix against the width II.23.2 assigns. A difference is reported with
|
|
its byte offset as a user-string issue while preserving the readable literal.
|
|
Toolchain conventions can differ; this conformance observation does not
|
|
establish runtime rejection. A missing `#US` stream is one stream-level issue;
|
|
a malformed item is reported against its token. Repeated `#US` declarations
|
|
with the same file range keep the literals and disclose the duplicate. Distinct
|
|
ranges leave the literals unresolved and preserve the `ldstr` token anchors.
|
|
A declaration outside the metadata root still makes the metadata malformed.
|
|
User strings carry their own coverage: any of these makes `user_strings.state` partial and lists the issue
|
|
in `user_strings.issues`, while the member `coverage` and `metadata.status` are
|
|
unaffected, and readable literals remain. The state is also partial when an
|
|
inspected method's CIL was not fully decoded (a malformed exception section
|
|
alone does not count) or a method that may belong to the inspected types was
|
|
not inspected (its row could not be read, or its type's name could not be read
|
|
under a `type_names` selection), because `ldstr` instructions there were not
|
|
observed. Normalized CIL digests do not include decoded values.
|
|
`compare_managed_members` does not decode or compare literals: an unchanged
|
|
method does not establish unchanged strings, and the comparison says so in its
|
|
limitations. `user_strings: null` means the literals were not examined
|
|
(member decoding exceeded capacity or CLI metadata was unavailable).
|
|
|
|
### Edge target declaring types
|
|
|
|
`member_refs[].parent_name`, `call_edges[].target_declaring_type`, and
|
|
`field_accesses[].field_declaring_type` name the type that declares each
|
|
target. Referenced spec signatures validate encoded type coordinates against
|
|
the metadata tables, including nested type arguments and custom modifiers.
|
|
TypeRef resolution scopes are checked transitively with cycle detection;
|
|
readable names survive malformed scopes as partial evidence.
|
|
TypeDef and TypeRef names use the namespace-qualified `full_name`
|
|
form, and nested types keep bare names. A generic-instantiation TypeSpec
|
|
parent names its generic type, such as ``System.Collections.Generic.List`1``.
|
|
Other well-formed TypeSpec forms and ModuleRef or MethodDef parents stay
|
|
`null`. A `method-spec` call edge reports the name and declaring type of the
|
|
generic method it instantiates. A field access is named only by a field or a
|
|
field-signature MemberRef. TypeSpec and MethodSpec blobs are decoded with the
|
|
member-signature grammar, and a MethodSpec must instantiate a generic method
|
|
with as many type arguments as it declares. Malformed or unsupported rows and
|
|
blobs, and arity mismatches, make coverage partial. A readable MethodSpec
|
|
method column that names a method, or a TypeRef whose resolution scope is
|
|
invalid, keeps its name.
|
|
|
|
## Analysis objective
|
|
|
|
Start by identifying the artifact with `inspect_managed_artifact`, then inspect
|
|
its types and CIL with `inspect_managed_members`. Use [member comparison](#member-comparison)
|
|
for another build, and [managed/native boundary rules](#managed-native-boundaries)
|
|
when matching declared native calls to supplied native Evidence. Static inspection
|
|
does not load or execute the assembly. Reconstructed structure and unresolved
|
|
native/runtime questions retain their own authority and coverage.
|
|
|
|
When the selected source changes during acquisition or no longer matches its
|
|
admitted digest, inspection and comparison report retryable `artifact_changed`;
|
|
any completed hash retains the observed digest and byte count. Retry against a
|
|
stable source. This differs from corrupted retained Evidence, which remains an
|
|
Evidence-integrity failure. Malformed selected PE/CLI bytes are a target refusal,
|
|
not an input error, in inspection and comparison: `unsupported_target` with
|
|
`details.format` `pe-cli`, `details.failure_kind` `malformed`, and
|
|
`details.path` naming the file whose bytes are at fault, so a comparison names
|
|
the malformed side by its own path. `details.field` and `details.offset` give
|
|
the reader's structure and byte offset when known. The arguments are not at
|
|
fault, so no input recovery is offered. A metadata layout or signature form
|
|
outside decoder coverage is `unsupported_target` with `details.failure_kind`
|
|
`unsupported`.
|
|
Inventory status follows the same split: when a reader stops on such a form
|
|
(`unsupported-metadata` or `unsupported-signature`), `metadata.status` is
|
|
`partial` and an artifact's `classification.status` stays `managed`; only a
|
|
broken rule makes them `malformed`. A failed right-side comparison retains the
|
|
completed left observation.
|
|
|
|
## Member comparison
|
|
|
|
Call edges and field accesses retain `il_offset` as their instruction site within
|
|
the caller's build-local method token and artifact identity. Their
|
|
`target_identity_sha256` combines the existing enclosing-type nominal digest,
|
|
member name and resolved decoded signature. Comparison joins edges to their
|
|
instruction sites rather than array positions and compares these identities;
|
|
display labels alone cannot establish equal targets. Same-named nested types
|
|
under different enclosing types and different overload signatures stay distinct.
|
|
This is nominal metadata identity, not assembly resolution or runtime binding.
|
|
Edges without a resolved identity, unresolved/cyclic type scopes,
|
|
TypeSpec owners and unresolved MethodSpec instantiations retain unknown target
|
|
equivalence. The exception is a target the left and right sides reach under the
|
|
same caller and target tokens of the same authenticated artifact, with both
|
|
producers reporting `target_row_resolved: true`: those parsed facts establish
|
|
the same metadata row without a nominal identity. Malformed or wrong-kind
|
|
references, undecoded signatures and unresolved TypeSpec operands stay
|
|
unknown. This fact describes metadata
|
|
resolution, not runtime binding. Valid
|
|
MethodSpecs combine the base member identity with the resolved instantiation
|
|
signature, preserving generic argument distinctions.
|
|
|
|
Names and semantic labels do not establish durable member identity. Comparison
|
|
preserves observed differences, structural inferences, and unknowns separately.
|
|
|
|
Cross-version matching first pairs members of the same declared type and name.
|
|
A current declared type uses its observed `name_sha256`, so same-named nested
|
|
types in different enclosing types stay distinct even in selected inventories.
|
|
Malformed, missing, contradictory, cyclic or over-deep enclosing identity remains unknown;
|
|
the comparison preserves display names without using them to repair that gap.
|
|
Matching then pairs
|
|
methods by exact CIL/signature identity, then by signature, then by
|
|
structural body shape; fields by signature. Exact CIL/signature identity
|
|
requires equal raw CIL digests and decoded fingerprints. Equal decoded
|
|
fingerprints alone cannot establish an exact match: they omit switch targets
|
|
and collapse distinct NaN encodings. Only then may a remap pair a
|
|
renamed or moved member across declared types or names: a method by exact
|
|
CIL/signature identity or structural body shape, a field by exact decoded
|
|
signature. A remap never takes a member whose own declared type and name remain
|
|
unpaired on the other side, so a member is never taken from its own changed
|
|
counterpart. A member whose declared identity is unresolved could belong to any type. It
|
|
never makes a declared-identity pair, and any remap group it joins stays
|
|
ambiguous. Unresolved same-named counterparts prevent definitive added/removed
|
|
claims, while observed names and tokens remain available in the result.
|
|
The exact-signature key uses names only as part of that
|
|
full tuple; names alone never select a pair. Duplicate tuples remain ambiguous
|
|
rather than being paired by token order. Every round compares signatures by
|
|
`resolved_sha256`: the raw signature with each TypeDef or TypeRef operand
|
|
replaced by a digest of that type's namespace and name, hashed as separate
|
|
values so `A` + `B.C` differs from `A.B` + `C`, after its enclosing types for a
|
|
nested type (`Outer/Inner`). The defining assembly is not part of the name:
|
|
a TypeDef and a TypeRef with the same namespace and name compare as the
|
|
same nominal name, and a TypeRef's ResolutionScope assembly is ignored, so a type
|
|
forwarded from one assembly to another still pairs. Two different types with
|
|
the same full name in different assemblies therefore have equal name digests.
|
|
Comparison reports this scope limitation inline; it does not establish CLR
|
|
type identity or runtime binding equivalence.
|
|
Nesting deeper than 64 levels is not named, and such a signature compares by
|
|
its raw digest. Comparison keys keep resolved and raw digests apart, so a raw
|
|
digest never pairs with an equal resolved one.
|
|
Raw signature bytes name types by metadata row, and rows are build-local, so
|
|
the same signature usually has different raw bytes in two builds. A signature
|
|
that names no types resolves to its raw digest. When an operand cannot be
|
|
resolved, such as a TypeSpec, or when REA could not parse the signature, the
|
|
raw digest stands in. Missing or unreadable TypeDef and TypeRef operands are
|
|
reported as coverage issues. Invalid NestedClass rows retain their failure
|
|
reasons and withhold TypeDef signature identities; type names and nesting are
|
|
parsed once by their shared owner. Each current inspection records
|
|
`signature_resolution: "type-names-v2"`, even when none of its operands can be
|
|
resolved. Version 2 also appends readable names to signature operands, for
|
|
example `class:7772 (AnalysisJob)`. Coded indexes remain build-local references;
|
|
names are display text and do not change raw or resolved signature digests.
|
|
Nested names use `Outer/Inner`. Generic instantiations keep their decoded
|
|
arguments, for example ``class:9 (System.Collections.Generic.List`1)<string>``;
|
|
custom modifiers are named too. Valid but unresolved TypeSpecs, invalid scopes,
|
|
unreadable type names, cycles and nesting beyond the cap keep their raw operand
|
|
spelling. Invalid or missing metadata coordinates retain the existing malformed
|
|
signature result and source issue; rendering does not bypass validation.
|
|
The attestation is `null` only when member decoding exceeded capacity, and then
|
|
no members were examined: an inspection with `null` resolution and any field,
|
|
method, member reference, call edge or field access is malformed. The signature
|
|
is exact whether or
|
|
not REA decoded it, so undecoded signatures pair by that tuple too, but they
|
|
never enter structural rounds. An unmatched member is therefore reported as
|
|
`unknown`, not added or removed, when its own signature was not decoded or when
|
|
the other side has an unpaired member, one-sided or ambiguous, with the same
|
|
declared type and name whose signature was not decoded. A decoded signature
|
|
that still compares by its raw digest is treated the same way: an unmatched member with one, or beside an
|
|
unpaired same-named member with one, is `unknown`, because its raw bytes name
|
|
types by build-local row. A matched unresolved signature also remains unknown
|
|
unless another observed dimension establishes a change; identical row bytes
|
|
can reference different TypeSpec contents. Its resolution limitation is retained
|
|
even when another dimension changes.
|
|
|
|
For a matched method, an unavailable or partial body makes body-shape facets
|
|
unknown while preserving observed signature differences. For complete bodies,
|
|
a difference in either the raw CIL digest or the decoded fingerprint is reported
|
|
in the `cil` dimension, including reordered switch targets with equal decoded
|
|
fingerprints. Structural identity compares resolved signatures, the limited
|
|
decoded-CIL tuple fingerprint,
|
|
constants, and bounded shape context. It reports all candidates at the winning
|
|
score and remains ambiguous when the evidence does not distinguish them. The
|
|
digest does not itself remap metadata tokens.
|
|
|
|
Matched methods also compare aligned references. `call-shape` and
|
|
`field-shape` report opcode and operand-kind differences; `call-target` and
|
|
`field-target` report differences in the observed target declaring type or
|
|
name from `call_edges` and `field_accesses`. Target tokens remain build-local
|
|
and are not compared across artifacts. Missing or unaligned edges and missing
|
|
target names leave that facet unknown; equal names do not establish overload
|
|
identity or runtime dispatch. `exception-shape` compares clause flags and
|
|
ranges. `exception-target` compares the nested nominal catch-type name digest;
|
|
for resolved TypeDefs it also compares the enclosing assembly identity. A
|
|
different known name or assembly scope establishes a change. Equal TypeRef
|
|
names remain unknown because their resolution scope is not resolved here.
|
|
Exception tokens remain in the source facts but are not cross-build identity;
|
|
an unresolved catch type leaves that facet unknown. The method body retains the
|
|
display `class_type`, nested `class_type_name_sha256`, and whether its local
|
|
token identifies a TypeDef. A TypeDef digest alone does not prove identity
|
|
without matching assembly identity. Missing assembly identity and equal TypeRef
|
|
names leave the comparison unknown.
|
|
|
|
Tokens are always remapped through observed structure. A caller cannot carry
|
|
`0x06001234` into a new MVID and assume it names the same method.
|
|
|
|
## NativeAOT metadata recovery
|
|
|
|
NativeAOT removes the ordinary CIL method bodies, so a CIL decompiler cannot
|
|
reconstruct those bodies as C# source. The executable remains a native target
|
|
for Hopper or Ghidra, where decompilation produces pseudocode and analyst
|
|
inference. This is a different route from ordinary managed member inspection.
|
|
|
|
NativeAOT is not limited to Windows `.exe` files. The native image can be PE,
|
|
ELF, or Mach-O, and NativeAOT can also publish shared libraries (PE DLL, ELF
|
|
`.so`, or Mach-O `.dylib`) with explicitly exported entry points. Identify the
|
|
image from its bytes and loader metadata, not its filename extension. When the
|
|
image is inside an application bundle, inventory or extract the bundle first
|
|
and carry the component identity into native analysis. Matching PDB, ELF debug,
|
|
or dSYM sidecars can add symbol evidence when the selected provider supports
|
|
them; verify their identity and keep them separate from observations made from
|
|
the executable itself. [Microsoft's NativeAOT overview](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/)
|
|
lists supported OS/architecture targets and deployment limitations, while its
|
|
[native library guide](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/libraries)
|
|
describes exported shared-library entry points.
|
|
|
|
REA offers a built-in read-only snapshot parser for x64 PE/RTR 9.1 metadata and
|
|
an optional Linux headless Ghidra adapter for annotations and broader recovery.
|
|
The adapter requires a locally built `REA_GHIDRA_NATIVEAOT_JAR`; REA does not
|
|
install it or its toolchain. The [NativeAOT guide](../../providers/ghidra-nativeaot.md) defines
|
|
these routes, their layout/host restrictions, derived-memory provenance, and
|
|
verification coverage.
|
|
|
|
REA's experimental Windows Ghidra boundary admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE
|
|
applications and DLLs for static analysis. For x64 PE NativeAOT, the read-only
|
|
parser also runs there; the [NativeAOT guide](../../providers/ghidra-nativeaot.md) lists what a
|
|
Windows host covers.
|
|
|
|
For NativeAOT analysis, preserve the selected native artifact's path and digest
|
|
and report recovered type data with its returned provenance. Linking those types
|
|
to native function addresses requires verified
|
|
provider evidence; names or vtable similarity alone do not prove that a native
|
|
function implements a specific managed method.
|
|
|
|
<div id="managednative-boundary-rules"></div>
|
|
<div id="managed-native-boundaries"></div>
|
|
|
|
## Managed/native boundary rules
|
|
|
|
`verify_managed_native_boundaries` compares declared P/Invoke module and entry
|
|
point identities with supplied native export or function evidence. Name/module
|
|
matches establish declaration links; they do not establish that a call executed.
|
|
When either side lacks a usable module identity, a matching name remains
|
|
unresolved and retains the candidate evidence; REA reports a module mismatch
|
|
only when both identities are available and their format-specific comparison
|
|
establishes a difference. ELF module names retain case, PE module names compare
|
|
case-insensitively, and a case-only match for Mach-O or an unknown format stays
|
|
unresolved because the available Evidence does not establish case behavior.
|
|
The authenticated subject format establishes the native platform: thin and
|
|
universal Mach-O use the same lookup rules; missing or unrecognized formats
|
|
remain unknown. Retained source Evidence keeps its original subject format.
|
|
For PE imports, `.dll`, `.exe`, a trailing period, and absolute paths suppress
|
|
appending `.dll`; other names may also be tried with `.dll`. Unix loaders use
|
|
the platform suffix (`.so` or `.dylib`) and `lib` prefix variations. A suffix
|
|
already present at the end of the name or before a period still gets an
|
|
appended-suffix variation, so Linux can match `nativedep.so.6` with
|
|
`libnativedep.so.6`. The `lib` prefix is omitted when the name contains `/`, and
|
|
absolute paths are used as supplied. POSIX paths keep backslashes as literal
|
|
characters. These candidates follow [Microsoft's native library loading rules](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/native-library-loading).
|
|
These filename rules compare declared and observed identities; they do not
|
|
establish which library the runtime loaded.
|
|
|
|
Signatures retain their decoded fields, but a Field or MethodDef row whose
|
|
signature has the other member kind is malformed and cannot establish an
|
|
unchanged signature. Comparison retains exact byte-based pairs for malformed
|
|
signatures, including empty, truncated, or invalid headers, but reports them as
|
|
unknown with a `signature-malformed` limitation when no change is observed.
|
|
Each method and field comparison item states its limitations as
|
|
`{code, side?, message}` objects: `code` names the reason, `side` names the
|
|
other inventory when the reason concerns it (for example
|
|
`unknown-within-incomplete-metadata` with `side: "right"`), and `message`
|
|
explains it. Read the code rather than the message text.
|
|
Runtime-provided methods have the Runtime code type or the InternalCall
|
|
implementation flag, as core library FCalls do. They are counted separately in
|
|
`native_implementations.runtime_provided`; they have no file-backed native body
|
|
for this workflow to map and do not increase `native_body_unresolved`.
|
|
|
|
An empty declared import name remains unchanged in verification Evidence and
|
|
produces no native-name candidates. With a supplied PE native context and
|
|
`no_mangle: false`, an unspecified charset includes the ANSI `A` candidate;
|
|
`auto` includes the Windows Unicode `W` candidate. Other native formats do not
|
|
inherit these Windows defaults. Known ELF and Mach-O contexts use the declared
|
|
entry point without A/W suffixes or Windows stdcall decoration, including when
|
|
the metadata declares an explicit ANSI or Unicode marshalling charset. The
|
|
original charset and calling convention remain unchanged. This follows the
|
|
[.NET runtime's platform-specific entry-point lookup](https://github.com/dotnet/runtime/blob/v10.0.0/src/coreclr/vm/method.cpp#L3134-L3177).
|
|
Windows name decorations are static inferred candidates;
|
|
exact spelling still suppresses decoration and no runtime binding is proven.
|
|
The mapping follows [Microsoft's charset guidance](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/charset).
|
|
Partial input coverage records a residual question even when no unresolved
|
|
individual boundary was produced. An unavailable boundary inspection read no
|
|
P/Invoke declarations, so the verification's `coverage.status` is `unknown`,
|
|
even beside non-exhaustive native exports. Selected literal inventories likewise remain
|
|
partial when unknown MethodDef ownership can hide a selected body.
|
|
|
|
Metadata tokens are not native addresses. Native body mapping for C++/CLI,
|
|
ReadyToRun, NativeAOT, and IL2CPP requires separately verified format and provider
|
|
support. The managed static tools do not recover those mappings. The optional
|
|
[Ghidra NativeAOT extension](../../providers/ghidra-nativeaot.md) has its own supported boundary.
|
|
|
|
Declared import inventory supports a bounded positive claim. Its absence does
|
|
not exclude dynamic resolution, generated code, protected code, native helpers,
|
|
or server-side behavior.
|
|
|
|
## Application graph relations
|
|
|
|
`project_managed_application_graph` turns member Evidence into `contains`
|
|
edges for declarations, `imports` edges for P/Invoke declarations, and two
|
|
relation kinds read from method bodies:
|
|
|
|
- `calls` links two `managed-method` nodes when a `call`, `callvirt`, `newobj`
|
|
or `jmp` site in the caller targets a MethodDef in the inspected module.
|
|
- `accesses` links a `managed-method` node to a `managed-field` node for each
|
|
field it loads, stores or takes the address of.
|
|
|
|
Each edge stands for every site between one source and one target. Its
|
|
properties carry `site_count` and per-opcode `opcodes` counts; `accesses`
|
|
edges also list `access` as `read`, `write` and/or `address`. Edge evidence
|
|
links the member Evidence.
|
|
|
|
Some sites are counted rather than projected: calls to MemberRefs (members of
|
|
other assemblies or of generic type instantiations), generic method
|
|
instantiations (`MethodSpec`), unknown targets, `ldftn`/`ldvirtftn` function
|
|
pointer loads, recursive self-calls (the graph has no self-loops), MemberRef
|
|
fields, and sites whose method or field node is absent, for example under a
|
|
type selection. Limitations name each counted class, and graph coverage is
|
|
`partial` with `omitted_count` equal to the omitted sites when nothing else is
|
|
incomplete. A missing `calls` edge is therefore not evidence that a method is
|
|
never called.
|
|
|
|
A supplied inspection whose parser coverage is `unavailable` examined nothing,
|
|
so the graph cannot tell what it omits: the result's `coverage.status` and the
|
|
graph coverage are then `unknown`, even beside a known gap in another source.
|
|
`partial` is reserved for known gaps.
|
|
|
|
## Evidence record shape
|
|
|
|
Member comparison, application graph projection, and managed/native verification
|
|
authenticate supplied inspection Evidence and check that any subject SHA-256
|
|
matches the normalized artifact SHA-256. A valid Evidence ID alone does not
|
|
establish that those two identities agree. Evidence without a subject remains
|
|
usable, with no subject digest available to cross-check.
|
|
|
|
Artifact inspection returns the selected path, byte length and SHA-256, observed
|
|
PE/CLI classification, assembly and module identities, and metadata coverage.
|
|
Member inspection binds build-local tokens, signatures, row offsets, method
|
|
bodies, and decoded relationships to that artifact and MVID. Missing or malformed
|
|
facts remain explicit in coverage and per-member status.
|
|
|
|
Metadata table streams may carry the CLR-compatible `ExtraData` extension
|
|
(`HeapSizes` flag `0x40`), which Microsoft readers honor although it is not
|
|
specified by ECMA-335. REA skips its fixed four-byte word after the row counts
|
|
before decoding table rows; the word's value is not a length. An incomplete
|
|
word is reported as a metadata coverage failure at its file offset, without
|
|
reading beyond the declared table stream.
|
|
|
|
For unoptimized `#-` metadata, nonempty `FieldPtr` and `MethodPtr` tables
|
|
translate TypeDef list positions to physical member definitions. REA resolves
|
|
these indirections for member ownership and local attribute-constructor types;
|
|
field and method tokens still identify the original definition rows.
|
|
`field_list` and `method_list` retain the metadata's list coordinates, which
|
|
refer to the pointer table when present rather than necessarily contiguous
|
|
definition rows. Invalid or nonmonotonic list coordinates and malformed or
|
|
ambiguous pointers leave affected owners unknown with partial coverage while
|
|
preserving readable member and attribute facts.
|
|
For each list column, ordering checks compare consecutive valid coordinates
|
|
even across invalid rows. A provable decrease leaves the affected ownership
|
|
unknown. Retained declaring-type filters count these candidates in
|
|
`unresolved_filter_rows`; omit that filter to retrieve their known-name rows.
|
|
The retained inverse indexes are admitted against the existing representation
|
|
budget before allocation.
|
|
|
|
Custom-attribute `type_name` uses `Outer+Nested` when its local TypeDef or
|
|
TypeRef enclosing chain is readable. It remains `null` when the constructor's
|
|
type or required enclosing facts cannot be resolved.
|
|
|
|
`exported_types` reports ExportedType rows as declared. Facade assemblies such
|
|
as .NET `System.Runtime.dll` provide their types this way: `forwarder: true`
|
|
marks a type forwarder, and `implementation_token` names the AssemblyRef, File,
|
|
or enclosing ExportedType row that implements it. REA does not load the
|
|
implementing assembly to resolve the forwarded definition, and
|
|
`compare_managed_members` does not compare exported types. `exported_types:
|
|
null` means the table was not examined. Member Evidence without this field is
|
|
malformed; recreate the observation with the current release.
|
|
|
|
CLI `#GUID` heap values retain their exact 16-byte GUID text. REA does not impose
|
|
RFC 4122 UUID version or variant bits on MVID, EncId, or EncBaseId because
|
|
ECMA-335 metadata does not require those bit patterns. Tokens and RVAs are
|
|
build-local coordinates, not durable cross-build identities or native addresses.
|
|
Field and method signatures validate embedded TypeDefOrRefOrSpec operands
|
|
against the artifact's metadata tables. An invalid operand leaves the member
|
|
name and raw signature digest available while marking that signature malformed
|
|
and coverage partial.
|
|
A fat method header's nonzero LocalVarSigTok must name an existing StandAloneSig
|
|
row whose blob is a structurally valid LocalVarSig. REA validates its local
|
|
types and exact blob coverage, retaining `local_var_signature` with the raw blob
|
|
digest and whether named types, modifiers, or generic variables require metadata
|
|
or declaring context; it is null when the method has no locals signature. An invalid
|
|
token or malformed signature leaves decoded CIL anchors intact but marks the
|
|
body malformed and coverage partial. Unsupported local type encodings retain
|
|
the readable body with partial coverage. Zero continues to mean no locals
|
|
signature. Raw table tokens are not cross-build identities. Comparison uses
|
|
validated context-free signature digests; signatures requiring metadata or
|
|
declaring context remain unknown across artifacts.
|
|
|
|
## Decoded-CIL fingerprint
|
|
|
|
`inspect_managed_members` exposes two method CIL hashes with different byte
|
|
boundaries:
|
|
|
|
| Field | Input | Excluded from the digest |
|
|
| ---------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `il_sha256` | The exact `il_size` raw CIL bytes after the tiny or fat method header | Method header, locals signature blob, alignment, and extra sections including exception clauses |
|
|
| `normalized_il_sha256` | UTF-8 `JSON.stringify` output for the instruction-order array of `[opcode, operand_kind, operand]` tuples | Instruction offsets except projected scalar branch targets, switch targets, resolved metadata/string identities, method header, locals, and exception regions |
|
|
|
|
The normalized field is available only when the entire CIL stream decodes with
|
|
status `present`. A malformed or absent body reports `null`. The tuple format
|
|
is defined here.
|
|
|
|
Tuple operands use these exact projections:
|
|
|
|
- operand-free instructions: `none` and `null`;
|
|
- metadata and user-string operands: the build-local token as lowercase
|
|
`0x`-prefixed eight-digit hexadecimal;
|
|
- scalar branches: the target CIL byte offset as a decimal string;
|
|
- `switch`: the case count as a decimal string, without target offsets;
|
|
- signed integer and variable operands: decimal strings; floating-point
|
|
operands: JavaScript's `String` representation of the decoded IEEE value.
|
|
|
|
For `ldtoken` MemberRef operands, `operand_kind` follows the parsed member
|
|
signature (`field` or `method`); if that signature does not establish the kind,
|
|
the anchor keeps the generic `token` classification.
|
|
|
|
Opcode names retain short/long forms and prefix opcodes. This makes the value a
|
|
reproducible decoded-tuple fingerprint, not a canonical semantic CIL identity:
|
|
it does not resolve tokens across MVIDs, does not commit full control flow or
|
|
exception semantics, and does not replace the raw CIL digest. Cross-build
|
|
comparison requires equal raw CIL digests as well for exact CIL/signature
|
|
matches and reports ambiguity when structural evidence is insufficient.
|
|
|
|
For example, a present body (including any valid declared locals signature)
|
|
whose IL is `nop; ret` serializes exactly as
|
|
`[["nop","none",null],["ret","none",null]]` and has digest
|
|
`5e5fad7741cb44bca3a4f045546b7449990da343f612f5f34c0ca30e9eee0636`.
|
|
This vector specifies the tuple order, `null` handling, absence of whitespace,
|
|
UTF-8 encoding, and lowercase hexadecimal output.
|
|
|
|
## Tool and packaging boundary
|
|
|
|
The production parser is REA-owned TypeScript and ships with the existing Node
|
|
application. Deterministic conformance uses source-owned byte-built PE/CLI
|
|
fixtures and expected semantic facts. An optional real ILSpy lane runs only when
|
|
its executable is explicitly supplied; the default lane does not establish
|
|
independent pinned-oracle parity. Production inspection needs none of those tools.
|
|
|
|
- `ICSharpCode.Decompiler`/`ilspycmd` can supply reconstruction inference.
|
|
A BYO reconstruction import records the supplied version
|
|
and remains non-canonical. When `REA_ILSPY_CMD_PATH` points to an absolute
|
|
runnable `ilspycmd`, `verify:managed` runs a source-owned real ILSpy oracle
|
|
and imports its C# output as reconstruction inference against exact static
|
|
member Evidence.
|
|
- The package contains no .NET runtime, SDK, ILSpy installation, proprietary
|
|
assembly, or compiled conformance fixture.
|
|
- Setup never installs or upgrades those tools. Doctor may inspect an explicit
|
|
optional path without changing it.
|
|
|
|
Real-tool downloads used in development or CI require exact package coordinates
|
|
and SHA-256 lock entries. They are cached outside the source tree and restored
|
|
into isolated directories. Updating any coordinate requires review of license,
|
|
runtime, supported host, output contract, and conformance results.
|
|
|
|
Target platform is not host support. The canonical parser must inspect
|
|
Windows-produced PE/CLI bytes on REA's supported Linux and macOS hosts with the
|
|
same result. Pinned Windows oracle jobs may provide additional conformance, but
|
|
do not establish that the REA managed analysis workflow has been verified on a
|
|
Windows host. The [experimental Windows Ghidra boundary](../../providers/windows-ghidra-p0.md)
|
|
has its own host and provider verification scope. Native
|
|
ReadyToRun, C++/CLI, NativeAOT, or IL2CPP coverage is additionally constrained
|
|
by the selected Hopper/Ghidra host and format matrix.
|
|
|
|
## Conformance verification
|
|
|
|
The current lane uses source-owned byte-built fixtures and malformed-input
|
|
regressions, with optional operator-supplied applications and ILSpy verification.
|
|
|
|
Run the deterministic lane with `npm run verify:managed`. See
|
|
[testing](../../testing-lanes.md#real-toolchain-verification-lanes) for prerequisites and
|
|
coverage. Generated outputs belong outside tracked fixture directories and must
|
|
not remain after verification or packaging.
|
|
|
|
Verification compares semantic facts, not decompiler text. It checks resource
|
|
ceilings, deterministic ordering, complete cleanup, CLI/MCP parity, Evidence
|
|
commitments, packed-package behavior, and target-free MCP startup. A parser and
|
|
an oracle disagreeing on malformed input is investigated explicitly; one tool's
|
|
acceptance does not automatically make the bytes valid.
|
|
|
|
## Operator-local osu! benchmark
|
|
|
|
The optional osu! benchmark accepts only paths and expectations supplied by the
|
|
operator. Run it with:
|
|
|
|
```sh
|
|
REA_MANAGED_APP_MANIFEST_PATH=/absolute/managed-app-manifest.json npm run verify:managed
|
|
```
|
|
|
|
`verify:managed` always runs a source-owned manifest-verifier self-test first.
|
|
If `REA_ILSPY_CMD_PATH` is set to an absolute `ilspycmd` path, it also runs a
|
|
source-owned ILSpy oracle: version discovery, class listing, bounded C# output
|
|
for a pinned fixture type, and import through `import_managed_reconstruction`.
|
|
The verifier prints only command/version, executable and output digests,
|
|
Evidence IDs, method locks, and compact fixture identity; it does not print
|
|
decompiled C# text. A failing ILSpy oracle fails the verifier because it is an
|
|
explicit real-tool claim, but leaving `REA_ILSPY_CMD_PATH` unset keeps the
|
|
oracle disabled.
|
|
|
|
When `REA_MANAGED_APP_MANIFEST_PATH` is set, the manifest's target path may be
|
|
absolute or relative to the manifest file. A compact manifest contains:
|
|
|
|
```json
|
|
{
|
|
"label": "operator-local osu!stable semantic slice",
|
|
"target": {
|
|
"path": "./osu!.exe",
|
|
"sha256": "<exact target digest>",
|
|
"mvid": "<exact module MVID>",
|
|
"assembly_name": "<expected simple name>",
|
|
"runtime_family": "dotnet-framework",
|
|
"managed_architecture": "x86"
|
|
},
|
|
"methods": [
|
|
{
|
|
"label": "operator-local semantic label",
|
|
"token": "0x06000000",
|
|
"signature_sha256": "<raw signature blob digest>",
|
|
"il_size": 0,
|
|
"il_sha256": "<raw CIL byte digest>",
|
|
"normalized_il_sha256": "<digest>"
|
|
}
|
|
],
|
|
"application_graph": {
|
|
"expected_node_kinds": [
|
|
"artifact",
|
|
"managed-assembly",
|
|
"managed-module",
|
|
"managed-type",
|
|
"managed-method"
|
|
],
|
|
"feature_traces": [
|
|
{
|
|
"label": "operator-local feature label",
|
|
"method_token": "0x06000000",
|
|
"seed": "<method name, API name, string, or digest to trace>",
|
|
"match": "exact",
|
|
"case_sensitive": true,
|
|
"min_matched_seeds": 1
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
Before evaluating methods, the verifier fails closed on target SHA-256, MVID,
|
|
assembly name, runtime-family, and managed-architecture mismatches whenever the
|
|
manifest supplies those fields. It then pages each declared MethodDef token
|
|
directly by row, so selected methods do not need to appear in the first member
|
|
page of a large application. Optional `il_sha256` locks the exact raw CIL bytes
|
|
in addition to REA's decoded-instruction-tuple digest. That normalized field
|
|
has the byte boundaries documented above and is not a complete semantic CIL
|
|
identity.
|
|
|
|
The optional `application_graph` block reuses those exact-build method
|
|
commitments. For each referenced MethodDef token, the verifier builds a bounded
|
|
managed application-graph projection from the authenticated artifact and the
|
|
single selected member page, then checks requested node kinds and feature-trace
|
|
seed matches. This proves only that the selected static facts enter REA's graph
|
|
and tracing vocabulary for that exact local build; it does not execute the
|
|
application, inspect arbitrary unlisted methods, or infer runtime behavior.
|
|
|
|
Output contains assertion status and compact identities only: file name,
|
|
target SHA-256, MVID, assembly name, runtime-family, managed architecture,
|
|
method tokens, method names, signature digests, IL sizes, normalized IL
|
|
digests, graph Evidence IDs, node-kind summaries, and trace seed hit counts. It
|
|
does not print method bodies, reconstructed C#, application data, runtime
|
|
telemetry, account/service details, full filesystem inventories, or the
|
|
target's absolute path. The manifest and target remain outside git.
|
|
|
|
The benchmark may prove that REA reproduces selected facts for that exact local
|
|
build. It cannot establish general support on its own; source-built conformance
|
|
remains the admission requirement.
|
|
|
|
## Runtime behavior boundary
|
|
|
|
Managed inspection does not execute assemblies or observe CLR internals.
|
|
Questions about actual behavior remain unknown until supported runtime
|
|
evidence is collected. A direct process capture can retain declared inputs,
|
|
outputs, filesystem and protocol activity for a target run; it does not prove
|
|
which managed methods executed or how the CLR resolved them.
|
|
|
|
## Method metadata during build comparison
|
|
|
|
Managed member comparisons report a `metadata` dimension when an observed
|
|
MethodDef flags or implementation flags value differs, including accessibility
|
|
or synchronization changes. Observed method-body `init_locals` and `max_stack`
|
|
differences also contribute to `metadata`, even when CIL decoding is incomplete.
|
|
For complete bodies, presence or absence of a locals signature also contributes;
|
|
the locals table token is build-local and is not compared. Different validated
|
|
context-free LocalVarSig digests report a metadata encoding difference without
|
|
asserting a semantic type change. Equal digests establish unchanged bytes only
|
|
when neither signature requires metadata or declaring context. Absent and
|
|
context-dependent signatures keep local identity unknown, preserving any independently observed changes. The same method token
|
|
in an artifact with the same authenticated SHA-256 identifies the same local
|
|
signature bytes.
|
|
An unavailable header value keeps body coverage unknown rather than establishing
|
|
equality or a difference. These comparisons are separate from the CIL/signature
|
|
matching tiers: identical instructions do not establish unchanged method metadata.
|
|
The reported difference is static metadata evidence, not proof of runtime behavior.
|