* fix(native)!: report details.limit for native reader per-call budgets Devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals of caller-selected budgets named their control only in remediation prose. Each now sets details.limit from a domain-owned budget object that also builds the schema (src/domain/parameterBudget.ts), so the reported range is the one the next call accepts. inspect_devicetree's fixed 32 MiB decoded representation allowance becomes the per-call max_decoded_bytes (default 32 MiB, 1 KiB to 256 MiB); its refusal reports boundary max_decoded_bytes instead of decoded_bytes. The pwntools allocation failure declares measuredExhaustion, the firmware inherited RLIMIT_FSIZE refusal declares measuredExhaustion, and the LLDB combined-result ceiling is a registered representation bound. Part of #14234 and #14235. BREAKING CHANGE: inspect_devicetree's decoded-representation refusal reports reported_limits.boundary "max_decoded_bytes" with details.limit, instead of "decoded_bytes". * fix(native): keep FIT decoded-budget boundary, LLDB narrowing and entropy length range exact The FIT reader compared the renamed devicetree limit against decoded_bytes, so a decoded-budget refusal became capacity; it now checks max_decoded_bytes, with a test. The LLDB representation ceiling keeps a short name and carries its recovery as narrowing. The byte-entropy length maximum is the window the selected block_size admits. * fix(cli): describe inspect-devicetree --max-decoded-bytes * refactor(native): let the generated adjustable-budget recovery name the native reader controls With #14625 the refusal owns per-call recovery, so the devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals drop their authored sentences. inspect_byte_entropy reports the smallest admitting block_size as required_value. * fix(native)!: report details.limit for remaining native reader budgets and make BEAM table rows adjustable inspect_elf_dependencies, inspect_elf_unwind_ranges, inspect_apple_ips, inspect_dwarf_units, inspect_native_initializers and inspect_pe_resources named their per-call budgets only in remediation prose. Each now reports details.limit from a domain-owned budget object that also builds the schema. The unwind per-page symbol-name text refusal names the page size `limit`, the control that admits it. The fixed 65,536-row BEAM table ceiling becomes the per-call max_table_rows (default 65,536, at most 1,048,576). The plist nesting allowance is reclassified as a representation bound (MAX_JSON_DEPTH less the report envelope). GPU and APK input refusals that named their fixed allowances only in prose now declare them, registered as pending #14235. Part of #14234 and #14235. BREAKING CHANGE: a BEAM table-row refusal reports details.limit for max_table_rows instead of a fixed_ceiling refusal. * fix(native): keep naming the dependency and BEAM row controls in recovery * refactor(native): let the generated adjustable-budget recovery name the remaining native controls With #14625 the refusal owns per-call recovery, so the ELF dependency, ELF unwind, Apple IPS, DWARF, initializer, PE resource and BEAM refusals drop their authored sentences. BEAM reports the complete row and atom counts as required_value. The unwind per-page text allowance is a registered fixed allowance whose narrowing names a smaller limit, because a larger page would not admit it. * style: format the PE resources provider test * refactor(native): keep one owner of the IPS budget bounds and document the unwind text allowance
7.3 KiB
Erlang BEAM files
inspect_erlang_beam / inspect-erlang-beam answers whether one selected
local file is a FOR1/BEAM IFF container, which chunks that form stores, and
which atom, export, import, lambda, and Code-header fields those chunks carry.
It reads the file without executing bytecode and does not require an Erlang
installation or BEAM emulator.
rea inspect-erlang-beam /absolute/path/to/app.beam --json
The CLI resolves relative paths against the caller's working directory. MCP requires an absolute filesystem path and preserves that exact selection:
{
"name": "inspect_erlang_beam",
"arguments": { "path": "/artifacts/app.beam" }
}
Observations
The inline Evidence result contains the artifact path, SHA-256, and byte length.
chunks lists every IFF chunk name, file range, and payload SHA-256.
Repeated names retain separate chunk occurrences. Decoded tables and the Code
header use the last occurrence of each name, matching OTP's loader; the chunk
inventory still exposes earlier payloads and their source ranges.
The BEAM form size bounds the parsed chunks. Bytes after the form remain part
of the artifact's byte length and SHA-256. They are unexamined by the chunk
reader, so the report sets coverage.status to partial and gives their exact
count in coverage.trailing_bytes. Older retained Evidence may omit the count.
When a selected atom, export, import, or lambda table has bytes left after its
declared entries, coverage is also partial. A limitation names the table and
counts its unexamined bytes. The report retains the decoded entries and the
full chunk range. coverage.trailing_bytes counts only bytes outside the FOR1
form, so it can be zero when a table leaves bytes unexamined.
When a selected AtU8 or Atom table is decoded, atoms is the 1-based name table and
module is atom 1. Both the pre-OTP 28 table and the OTP 28+ compact table
(negated count, compact-encoded name lengths) are read. exports, imports, and lambdas resolve atom indices to
those names when the table is present; unresolved indices keep function or
module null.
code reports the Code chunk instruction-set, opcode maximum, label count,
function count, and the instruction stream's file range. Missing optional
tables are null, not empty-everywhere.
A zero-byte AtU8 falls back to an available legacy Atom table, following
OTP 20.3's atom selection.
A nonempty AtU8 retains UTF-8 precedence, including an explicit zero atom
count; malformed nonempty data fails instead of falling back. An empty atom
chunk without an alternate table still fails its required count header.
Absent and zero-byte optional FunT chunks produce lambdas: null, while a
four-byte zero row count produces lambdas: []. This follows
OTP 29's positive-size lambda parsing rule.
Empty payloads retain their ranges and SHA-256 in the chunk inventory. These
rules apply to the last occurrence of each chunk name; an empty final occurrence
does not revive an earlier payload of that name. Nonempty truncated tables remain
format failures.
Select retained facts
Complete output remains the default. Request a summary with a beam view to
read a few facts in the first call while retaining the complete inspection:
{
"name": "inspect_erlang_beam",
"arguments": {
"path": "/artifacts/app.beam",
"detail": "summary",
"view": {
"kind": "beam",
"collection": "exports",
"names": ["module_info"],
"fields": ["function_index", "function", "arity", "label"],
"limit": 20
}
}
}
normalized_result.page.items contains the matching rows. source_index is
zero-based in the original collection and scoped to parent_evidence_id and
that collection. It does not replace the original one-based atom index or a
lambda's own index. Every matching function name survives, including different
arities. Names are exact retained display strings; raw indexes remain available
when names are unresolved or displayed names collide.
Collections are atoms, exports, imports, lambdas, and chunks. names
selects atom/chunk names or function names; imports additionally support exact
modules. Filters intersect. indices selects original collection indexes;
fields selects that collection's own fields. Empty selector arrays match
nothing, and fields: [] returns only source_index. Offset/limit page matching
rows in original order (defaults 0/64). Unfiltered pages slice the retained
collection; queries do not decode the file again.
For chunks, names matches the four-character IFF chunk tag (for example
"AtU8", "Code", "ExpT"); available fields are index, name,
location, and payload. For lambdas, names matches the resolved function
name from the atom table; null names (unresolved atom indices) are never
selected by a name filter. For atoms, names matches the decoded atom name
string.
beam keeps the module, form/Code bounds, original source coverage, and table
counts. A null count means no table was decoded; zero means a decoded empty
table. Missing tables and unresolved atom names remain explicit, and an empty
page does not establish runtime absence. Page coverage is separate from the
source's examined chunks and parser budgets.
CLI summary delivery requires a destination for the complete Evidence bundle:
rea inspect-erlang-beam /artifacts/app.beam --detail summary \
--view '{"kind":"beam","collection":"exports","names":["module_info"],"fields":["function","arity"]}' \
--evidence_output /reports/app-beam.evidence.json --json
rea inspect-analysis-view '{"source":{"kind":"evidence-file","path":"/reports/app-beam.evidence.json"},"view":{"kind":"beam","collection":"imports","modules":["erlang"]}}' --json
The bundle retains the complete report. Subsequent MCP queries may use
source: {kind: "retained-evidence", evidence_id: parent_evidence_id} or an
Evidence file. Retained and offline views still work after the original BEAM
file is deleted. Supplying view requires detail: "summary"; omitting it
returns only the structural summary. Selection changes delivery, not parsing or
coverage, and executes no bytecode.
Limits and failures
The selected file is limited to 64 MiB by default (512 MiB maximum). At most
64 chunks and 4096 atoms are examined by default, and at most 65536 export,
import, and lambda rows together (max_table_rows, up to 1,048,576). A refusal
at any of these budgets reports details.limit with the field, its effective
value, range and default; raise it on the next call.
Malformed FOR1/BEAM headers, truncated
chunks, and AtU8 names that are not valid UTF-8 fail without partial success.
The reader checks each encountered chunk's payload and alignment padding against
the declared form before applying the chunk count limit.
An atom count above max_atoms still checks the length fields of at most
max_atoms entries. A length that leaves too few bytes for the remaining
entries is a format failure.
This workflow does not execute bytecode, inflate LitT literals, or decode
Attr/CInf external-term payloads. Complete coverage describes this static
chunk and table report; it does not establish that an Erlang runtime can load
or execute the module.