Files
aji/docs/design/source-expression-depth-audit.md
T

520 lines
32 KiB
Markdown

# Source expression depth audit
This non-normative audit tracks Q-061 independently of the resolved compiler
type-traversal inventory (Q-059). It uses finite generated/public source only;
it does not set an expression-depth acceptance limit or report model outcomes.
## Confirmed baseline failures
On the Debug CLI preceding the unary-parser repair (code at `fb80413`),
`fn main() -> bool effects [] { return not … false; }` accepts 16 prefixes.
At 1,024 prefixes, checking aborts in `Lowerer.expr`, with repeated `.not`
operand calls. At 16,384 and 65,536 prefixes, it aborts earlier in
`Parser.unary`. Each failing check exits by signal (observed return code -6)
without a stdout diagnostic. These are observed native-stack failures, not
language rejection rules. Stderr reports a segmentation fault at the recursive
entry/operand call, followed by repeated native frames of that function.
The ignored evidence is under `.zig-cache/contract-gate/type-depth/`:
`expression-depth-before.json`, `prefix-not-*.stdout` and `prefix-not-*.stderr`.
No wall-clock timeout terminates these probes.
## Unary parser continuations
The parser records `-`, `not`, `*` and inline borrow prefixes in an explicit
pending list, parses the terminal operand and rebuilds the nodes inside out.
`move` remains a terminal name form. A borrow still parses its operand through
unary only when the next token is `*`; otherwise it uses postfix directly.
This preserves the existing place boundary, rather than admitting new spellings
such as `ref -value`, `mut not value` or `ref move value`.
Each rebuilt node retains its own start and the final operand end, including
comments, newlines and file provenance. AST node order, operator association,
postfix precedence and syntax failure positions are unchanged. Pending metadata
is host compiler storage allocated from the caller arena. Its logical list
is deinitialized on completion/error; backing storage is retained until that
arena is destroyed. Allocation failure
still propagates OutOfMemory; no partial AST escapes, new code or depth rejection
is introduced. AIR, verifier ownership/borrow rules, runtime evaluation, fuel,
effects and source/reference bundle text are unchanged.
An independent shallow copy of the old unary derivation checks 448 combinations
of prefixes and successful/failed operands. It compares complete ASTs, failure
records, token cursors and last-consumed positions. Its shared postfix parser is
outside that oracle's scope. Separate tests parse 32,768 mixed prefix groups
including borrowed dereferences, inspect every node/span iteratively and check a
missing operand at the deepest position. A failing-allocator test covers all
arena backing requests in a longer chain, including pending-list growth and
output construction, and verifies complete release.
Syntax-only CLI probes format 1,024/16,384/65,536 `not` prefixes successfully
and idempotently, retaining every prefix. Missing-operand checks at
16,384/65,536 prefixes emit exactly one E7001 with independently computed
line/column and expected/found fields. These do **not** establish successful
deep lowering or execution. The permanent `source_grammar.py` suite includes
those formatting/diagnostic regressions at all three depths, with the same
syntax diagnostic across check/lower/run/report/explore/fmt.
Validation: build, units and format checks pass; all 1,793 ordinary conformance
cases pass with exact unique corpus coverage. Old/new public source checks and
successful lowerings are byte-identical (1,423/506). The grammar integration
suite passes 312 checks; the formatter suite passes 6,078 checks over 1,469 files
(1,414 parsed, 55 syntax-error fixtures, 782 identical successful AIR outputs).
These are compiler regressions, not a model-capability measurement or full GC
validation.
## Unary lowering and addressability continuations
Direct `.not`, `.neg`, `.deref` and `.cast` operand descent now records explicit
lowering continuations. Negative zero constants still precede their operands;
loads, boolean operations, checked subtraction and casts resume afterwards.
The special negative-literal magnitude rule remains separate, including
`-128i8` and the overflow from negating that value. Cast target validation still
precedes operand lowering; narrowing advice, atomic-load E4202 and operand
type/failure positions are unchanged. `peekType` skips a leading negation spine
without allocating; other recursive query paths are outside this repair.
The first intermediate full 16,384-prefix check exposes another native-stack
failure, in the preliminary `markExpr` walk, before the new expression handler
is reached. Its record/frame excerpt is retained as
`source-address-mark-before.json`. Addressability now uses a separate worklist
for blocks, statements, expressions, roots and pending sibling slices. It
preserves root-bound-before-base order, left/right and statement/tail order,
callee/argument order and the final split_at root visit. The old skipped select
and lock-place inputs stay skipped; storage policy is not extended here.
Both worklists are host metadata in the caller arena. Their lists are
deinitialized on error/completion, but backing buffers, finished values and
addressability facts retain their caller-arena lifetime. OOM propagates
without a source diagnostic or public partial AIR. The verifier's load/borrow,
initialization and atomic-access rules, runtime operations, ownership, lexical
ends, effects and source/AIR formats are unchanged. Borrowed scalar reads remain
valid; slice/array dereference and implicit atomic reads retain their existing
E7006/E4202 failures. No acceptance limit, code, feature or bundle text is added.
An independent old unary derivation checks 3,072 shallow context combinations,
including divergent operands, signed boundaries, borrowed/atomic values and
invalid targets. It compares values, complete instruction/span/constant records,
names/counters and diagnostics. It shares the unchanged non-unary handlers and
query implementation, so it is not an independent oracle for those paths.
Separate 32,768-node cases inspect inside-out boolean/cast spans, outside-in
negative zeros and inside-out subtractions, and inner dereference rejection.
The allocation test fails every arena backing request and compares complete
emitted instruction prefixes, no output publication and full arena release.
An independent old addressability walk compares 17 shallow fixtures, including
roots/bounds, branches, aggregates, calls, loops, scopes and skipped inputs.
32,768 mixed expression/block levels and every failing backing allocation are
tested separately. Full generated checks/lowerings now accept 65,536 typed
scalar boolean/negative/cast nodes, with independently counted instructions;
direct malformed dereference spines reject E7005 at their inner position.
These do not prove that every expression/query path is bounded.
The permanent `source_expression_depth.py` CI suite checks deep full lowering,
exact instruction counts, source/AIR and hosted results, fuel boundaries and
signed-minimum overflow. Baseline/current runtime records match exactly in 47
deterministic/hosted pairs. Full ordinary conformance passes 1,793 unique cases
with exact corpus coverage; units and Zig format checks pass. Q-060's full
per-step validation remains separate.
Final CLI validation passes 114 expression-depth checks, 635 non-value operand
checks, 33 atomic-access checks, 312 grammar checks and the existing 6,078
formatter checks. All 1,423 public source checks and 506 successful lowerings
retain byte-identical old/new results with fixed baseline/current executables.
## Expression type-query continuations
On `dd73b84`, `( * … 1i64 ) as i64` at 16,384 dereferences aborts in
`peekType`, before the expected ordinary type error. Its stdout is empty and
stderr repeats dereference-query frames. The retained baseline evidence is
`unary-cast-deref-query-16384.json/.stdout/.stderr`; the repaired check returns
one E7005 at line 2, column 32,805 without stderr
(`expression-query-repaired-cli.json`).
Expression and built-in result queries now share an explicit continuation
worklist. It preserves left-before-right fallback, first-known match arm,
first array element, branch-tail policy, field/len classification, callee
priority and built-in argument/borrow handling. Negation, shift, block and
if-tail queries use loop transitions. At this initial checkpoint, type-output
and continuation-allocation OOM returned unknown. The external review below
identifies why that can become a false diagnostic at a caller; the host-OOM
repair supersedes this behavior. Allocation counts and failure-index
classifications are not promised identical. Pending lists are deinitialized;
their buffers and output type nodes retain their caller-arena lifetime.
The query's callee callbacks also exposed recursive `expressionPath` and
bounded `dotted`. Both now walk field chains iteratively. `expressionPath`
allocates one complete string rather than every ancestor prefix; direct names
and invalid roots allocate nothing. Successful path bytes, the existing
64-byte built-in lookup buffer and null-result policy are retained. Partial
buffer contents on null are private and need not match the old implementation.
An independent copy of the old expression/built-in descent compares 703
shallow combinations. Name/signature/type lookup and callee path helpers are
shared, so this oracle does not independently validate those helpers. Separate
tests cover 32,768 structural/built-in expression levels, 16,384 fallback
levels, 65,536 callee fields and allocation-error cleanup without diagnostics
or emitted instructions. The permanent CLI suite adds cast/dereference and
deep unknown-callee rejection across check/lower/run/report/explore. These
helper fixtures do not establish arbitrary deep source acceptance.
Final build/units/Zig format checks and all 1,793 ordinary conformance cases
pass with exact unique corpus coverage (`source-expression-query-conformance.jsonl`
and its audit). The expression-depth/non-value/atomic-access suites pass
139/635/33 checks; formatter integration passes 6,078 checks. Fixed old/new
executables retain exact exit/stdout/stderr on all 1,423 public source checks
and 506 successful lowerings. These are compiler regressions, not completed
per-step GC validation or a model-capability measurement.
No normative rule, source/AIR format, feature, error code, bundle text,
ownership/runtime behavior or acceptance limit changes. Q-061's other paths
remain open; this increment has no fresh Claude review.
## Expected-use query continuations
After the preceding query repair, `let n = 1; return - … n;` in an i64 function accepts
16 and 1,024 negations, but at 16,384 aborts in `useIn` while inferring the
unsuffixed binding's type. The failing check returns -6 with empty stdout and
repeated `useIn` frames. Evidence is retained as `inferred-use-depth-before.json`
and `inferred-use-neg-16384.stdout/.stderr`. This confirms the next expected-use
query failure independently of the repaired `peekType` path.
`useIn`, `usesInStmt` and `usesInBlock` now share an explicit request worklist.
It retains first-known use, left/right and call-argument order, condition/then/
else order, statement-before-tail order, return hints and cast hint removal.
Comparison/shift right-hand hints and the second for bound are queried only
after the earlier use fails. The outer `inferUses` rest cursor and top-level
let rebinding barrier are unchanged; nested blocks and skipped expression/
statement kinds retain their original policy. No new inference is introduced.
The requests are host metadata in the caller arena. Logical lists are
deinitialized on success/error; their buffers and hint type nodes remain
until arena destruction. Initially, metadata OOM returned unknown. The
review and host-OOM repair below supersede that behavior because a caller
can turn unknown into a false inference diagnostic. This adds
allocation requests and does not promise identical failure-index outcomes.
Plain unary descent is a loop without work allocations. Runtime memory,
ownership, fuel and verifier rules are unchanged; no normative rule, format,
feature, error code, source/reference bundle or acceptance limit is added.
The independent old expected-use descent and outer cursor compare 967 shallow
expression, statement/block and two-scope combinations. Name/signature/type
queries are shared and outside that oracle's independence. Separate tests cover
32,768 unary and mixed branch/call groups, 32,768 nested statement blocks,
deferred-hint allocation traps and every worklist backing-allocation failure.
They check complete cleanup and no query diagnostic/output; helper fixtures do
not establish arbitrary deep source acceptance.
The baseline 16,384-negation source now accepts without stdout/stderr
(`inferred-use-depth-repaired.json`). Permanent CLI tests check inferred
negations through 65,536, exact instruction counts and fuel/source/AIR/hosted
results through 1,024. Cast-cleared context still returns E7007 at the unsuffixed
initializer through 65,536 negations across check/lower/run/report/explore.
Final build/unit/format checks and all 1,793 ordinary conformance cases pass
with exact unique corpus coverage (`source-use-query-conformance.jsonl` and its
audit). The permanent expression-depth suite passes 186 checks; non-value and
independent-error suites pass 635/234 checks. These do not complete Q-060's
per-step GC validation or measure model capability.
Fixed pre/post executables retain exact exit/stdout/stderr for all 1,423 public
source checks and 506 successful lowerings (`source-use-query-cli-compatibility.json`).
## Binary operand lowering continuations
The preceding follow-up probes accept 16 levels but abort at
1,024, with empty stdout, in three independent paths: a left-associated
`1i64 + … + 1i64` chain in `Lowerer.binary`; nested parentheses in the parser's
primary/postfix expression path; and a unary chain in a specialized generic
function body in `generics.expression`/`walk`. Evidence is retained as
`post-use-query-depth-probes.json` and `post-use-*.stdout/.stderr`. These are
observed native failures, not normative depth rejections.
Unary and binary scalar operands now share one continuation driver. Eager
operators retain operand-type selection, left lowering/check before right,
post-operand operator validation and exact instruction/span/name order. This
also removes native re-entry on alternating unary/binary trees. Non-operand
handlers remain outside this repair.
Boolean continuations preserve short-circuit lowering: validate left, emit
the short constant, create RHS/join blocks and the join parameter, branch,
lower/check right, branch to the stored join and resume there. Runtime still
evaluates right only when needed; both operands are lowered and type checked.
Negative zero order, signed-minimum literal handling, cast checks, atomic
diagnostics and iref identity rules remain unchanged. Host worklist OOM
propagates without a query diagnostic or public partial AIR. Its list is
deinitialized; backing buffers and generated values retain their caller-arena
lifetime. Allocation
counts/failure-index outcomes are not promised identical.
The independent old scalar derivation now covers binary rules as well as
unary descent. It compares 6,048 binary/wrapper/context combinations, in
addition to the existing unary cases: values/errors, blocks, parameters,
instructions/spans, counter, current block and features. Name/type/query and
non-operand handlers are shared, outside this oracle's independence. Separate
tests cover 32,768 left/right arithmetic nodes, 32,768 alternating groups,
16,384 boolean/unary groups in both orientations, and every backing-allocation
failure on numeric and boolean fixtures with exact complete block prefixes and
full cleanup. These helper tests do not assert arbitrary source acceptance.
The old 1,024-addition source now accepts, as do full arithmetic checks and
lowerings through 65,536 operations. Boolean chains accept at 1,024; at 16,384
both and/or now reach the existing E5101 block limit (spec 08 §7), with
`limit: blocks per function`, `max: 16384`, `found: 32769`, rather than aborting.
The raw source checks are retained in `binary-lowering-repaired-depth.json`
and `binary-repaired-*.stdout/.stderr`. The permanent CLI suite checks exact
instruction counts, fuel boundaries, values/profiles/source-to-AIR parity,
the block-limit refusal, and skipped/executed RHS division traps. Trap source
locations are checked separately; plain AIR has no source map.
Build/unit/Zig format checks and all 1,793 ordinary conformance cases pass
with exact unique corpus coverage (`source-binary-lowering-conformance.jsonl`
and its audit). The permanent expression-depth suite passes 360 checks.
Non-value/independent-error CLI suites pass 635/234 checks;
fixed pre/post executables retain exact exit/stdout/stderr on all 1,423 public
source checks and 506 successful lowerings
(`source-binary-lowering-cli-compatibility.json`). These do not establish full
GC validation or a model-capability result.
No normative rule, source/AIR format, feature, error code, bundle text, runtime
instruction, ownership rule or acceptance limit changes. Q-061 remains open.
## External review and host-OOM follow-up
The owner relayed a read-only Claude review of c36b269, dd73b84, e862e03,
e3f4695 and 6945b51, with the local report `/tmp/aji-q061-review.md`.
It found no divergence in grammar, spans, query/error/emission order or
short-circuit CFG. The reviewer ran selected synthetic CLI probes, but did
not build or run the full suites.
The review identifies a real failure-policy defect: `peekType` and expected-use
queries erase host OOM into null; callers can then emit E7007. The existing
array-annotation and qualified-callee helpers have the same problem. A
regression test with a one-shot allocation failure reproduces E7007 at a
negation before the repair (`query-oom-before-tests.log`, terminal exit 1).
The allocator resumes working after its single failure, so allocating a false
diagnostic cannot hide this defect behind a second OOM.
The implementation follow-up separates optional unknown answers from fallible
host allocation in expression/expected-use queries and their annotation,
field, signature, borrow-return and assignment-place callbacks. Callers use
`try` and retain their lazy fallback policy. Type-output allocations also
propagate OOM. No inference, grammar, diagnostic fields/codes, acceptance limit,
ownership, runtime or bundle rule changes. Generated nodes and worklist buffers
remain caller-arena storage; list deinit does not establish immediate physical
release. Cleanup claims refer to arena destruction, or direct allocator tests
that actually observe frees.
Validation passes: build/units/Zig format checks, all 1,793 ordinary
conformance cases with exact unique corpus coverage (`query-oom-conformance.jsonl`
and its audit), 360 expression-depth CLI checks and 234 independent-error CLI
checks. Frozen old/new executables retain exact exit/stdout/stderr on 1,423 public
source checks and 506 accepted lowerings (`query-oom-cli-compatibility.json`).
Allocation tests cover ten lowering callers, twelve annotation/signature/builtin
callback cases, every recovering direct-allocation failure in three finite
public `lower` fixtures, and the existing exhaustive worklist/array-output
failure loops. Recovery tests check that no diagnostic/output or retry follows
the failure; arena/direct-allocator tests check actual cleanup at their ownership
boundary. Invalid/unknown lookups still return null without allocating, and
lazy-query tests still avoid unnecessary right-side work. This establishes
compiler error policy, not a new model result or full GC pass. Q-061 is open;
this follow-up has not yet received external review.
## Generic AST transformation continuations
Baseline checks at 50a7575 accept a generic body's 16 negations but abort at
1,024 in `generics.expression`/reflective `walk`, with empty stdout. An unused
template also forces transformation of nongeneric bodies: a 16-component
unknown callee produces E7002, while 16,384 components abort in `generics.path`.
The latter is now an observed callback failure, not just an inspection risk.
Raw records are `generic-transform-before-probes.json` and
`generic-transform-before-*.stdout/.stderr` under the ignored evidence directory.
Typed work entries now clone structural AST children in the former field,
union, optional, pointer and slice order. Inputs borrow stable immutable AST
storage (including the root held throughout a walk); output targets live in
fresh caller-arena nodes. Entries never point into copied union payloads or
queue entries. Type/pattern/binding handling, source spans and generic Copy
transfer flags retain their original policy. Calls have explicit stages:
transform type_arg, resolve/check the callee, transform it, then process
arguments in order, with the existing static-worker exception for task.spawn's
second argument. Constructors resolve their named type before their fields.
Nested instantiation/type queries keep their unchanged depth-64 guards,
instance/key limits and public error policy; no expression-depth limit is added.
The qualified-path callback validates the immutable root first, then allocates
one complete string and fills components iteratively. Direct names and invalid
roots allocate nothing; path bytes and named/static-function decisions are
unchanged. Host allocation failure propagates without a source diagnostic or
public partial AST. List deinit is logical cleanup; work buffers, generated
AST/type nodes and partial internal instances keep caller-arena lifetime until
that arena is destroyed. Allocation requests and failure-index outcomes need
not match the recursive implementation.
An independent copy of the former clone/path descent compares 1,760 shallow
expression/environment combinations, plus function/statement/pattern/select/
lock binding-priority fixtures. It checks complete ASTs, problems, instance and
requirement order and guard counters. Binding/type/instantiation helpers are
shared; nested instance bodies use the production walker, outside this oracle's
independence. Separate helpers exercise 32,768 mixed expression levels, nested
callee targets, statement blocks, else-if unions and deepest static/binding
E7006 positions, plus 65,536 qualified fields. These synthetic helpers do not
claim arbitrary source acceptance. Persistent backing-allocation failures on
mixed/instance fixtures check host errors, guard restoration and physical arena
cleanup; every recovering direct-allocation failure in a public specialization
fixture rejects diagnostics, retries and partial publication.
Full source checks/lowerings now accept generic not/neg/cast/add bodies through
65,536 levels. Generic malformed dereferences retain their inner E7005 and
source position. Deep unknown callees return E7002 with the complete name and
exact location through 65,536 fields (`generic-transform-after-probes.json` and
`generic-transform-after-*.stdout/.stderr`). The permanent CLI suite independently
counts emitted instructions, fuel boundaries and values; it checks source/AIR
and deterministic/hosted parity for smaller accepted depths and exact rejection
records across check/lower/run/report/explore.
Build/unit/Zig format checks pass. The expression-depth suite passes 497 checks;
generic/static-function CLI suites pass 42/25 checks. Frozen old/new CLIs retain
exact exit/stdout/stderr on all 1,423 public source checks and 506 accepted
lowerings (`generic-transform-cli-compatibility.json`). All 1,793 ordinary
conformance cases pass with exact unique corpus coverage and terminal exit 0
(`generic-transform-conformance.jsonl` and its audit). These are compiler
regressions, not a full per-step GC pass or a model-capability measurement.
No normative, source/AIR format, feature, code, bundle, acceptance-limit,
ownership, runtime instruction or model result changes. Q-061 remains open;
this generic increment has no external review yet.
## Parser qualified constructor paths
The generic follow-up identified a separate recursive Parser.exprPath, called
for qualified enum variants and struct literals. A frozen pre-repair CLI
(`aji-before-parser-path`, production at d39a422) independently aborts at
16,384 fields for both forms, with empty stdout. Raw inputs and output are
`parser-path-before-probes.json` and `parser-path-*.before.stdout/.stderr` in
the ignored evidence directory.
Parser.exprPath now validates the root, computes the complete byte length and
fills one owned spelling iteratively. Direct names and invalid roots allocate
nothing. Grammar, generic arguments, constructor classification, token cursor,
spans and syntax/error priority are unchanged. Checked size arithmetic and
allocation failure propagate as host OOM, without a source diagnostic or
public partial AST. The final string has caller-arena lifetime; allocation
requests and failure-index outcomes need not match the former prefix copies.
The copied shallow recursive path oracle checks both named and invalid roots.
Separate tests exercise 65,536 fields, exact component bytes, a single output
allocation, zero-allocation answers and host OOM. Public parser tests check
qualified enum/struct forms with and without type arguments, exact spans and a
missing variant name at 65,536 fields. Every backing-allocation failure in a
smaller constructor fixture propagates host OOM and releases its arena.
Repaired CLI probes return E7002 with the complete name at line 2, column 38,
for both forms through 65,536 fields (`parser-path-after-probes.json` and
`parser-path-*.after.stdout/.stderr`).
Build, unit and Zig format checks pass. All 1,793 ordinary conformance cases
pass with terminal exit 0 and exact unique corpus coverage
(`parser-path-conformance.jsonl` and its audit). The expression-depth and grammar
CLI suites pass 577 and 312 checks. Constructor regressions cover generic and
nongeneric forms with exact E7002 records across check/lower/run/report/explore.
Frozen old/new CLIs retain exact exit/stdout/stderr on all 1,423
public source checks and 506 accepted lowerings
(`parser-path-cli-compatibility.json`).
No normative, source/AIR format, feature, code, bundle, acceptance-limit or
runtime/ownership rule changes. This repairs one callback; Q-061 remains open
and no external review covers this increment yet.
## Shared expression parser continuations
Frozen pre-repair CLI production at 371329f (`aji-before-expression-parser`)
aborts while formatting 1,024 grouped or mixed-call levels, with empty stdout.
`expression-parser-probes.json` and `expression-parser-*.before.fmt.stdout/
.stderr` hold the finite inputs/results. Debug stack excerpts reread current
source files; use `parse-before-expression-driver.zig` for baseline line text.
Binary precedence/RHS, casts, unary prefixes, postfix and primary entry modes
now share explicit continuations. Groups, ordinary/typed/variant call arguments,
array lists/repetitions, index bounds and struct field expressions suspend on
the same worklist, including alternating forms. Grammar, comparison rejection,
`or trap`, borrowed-place boundaries, constructor classification, trailing
commas, type-closer splitting, spans, argument advice and error priority are
retained. Deferred call/advice restoration is separate from the formerly
success-only group/index restoration. Host OOM propagates without syntax
diagnostics or partial public AST.
The parser reuses its work buffer across entries. Native block/control callbacks
save a base cursor; each re-entered driver processes/unwinds only entries above
that base. Active driver results and current work live in stable, separately
allocated frames reused by callback depth. No AST or queued pointer targets
relocatable work storage or a driver result. Dispatch of block/if/match callbacks
occurs outside the large per-step frame. An initial local-frame regression at
256 block/if levels was caught and repaired before commit. Final probes preserve
baseline formatted bytes at 64/256 block/if levels and 64 explicit-return levels;
explicit-return block/if forms now also format at 256, where the baseline aborts
(`expression-parser-control-final.json` and its raw outputs). This does not prove
arbitrary callback depth safe.
Scratch deinit/destroy is logical cleanup for caller arenas. Work capacity,
driver frames, AST nodes and partial outputs retain physical caller-arena
lifetime. Work/driver buffers are reused rather than allocated independently
for every scalar entry. Allocation requests/failure-index outcomes need not
match the old recursive implementation. AST output ownership and host error
handling are unchanged.
The copied shallow former descent compares 4,160 expression/form/context/entry
combinations, including complete ASTs, failures, positions, token mutations and
advice/scope state. Type, lexical/advice, block/control and path helpers are
shared, outside the oracle's independence. Separate public parser tests cover
32,768 mixed levels, every constructor span, siblings, type arguments and exact
innermost E7001 advice. Re-entry/reuse tests poison scratch bytes before reading
returned ASTs. Every recovering direct allocation failure checks host OOM,
empty work, restored depth/advice/call scopes and no diagnostic; persistent
backing failures through public parse check arena cleanup and no partial AST.
Final probes accept checks at 65,536 grouped levels and formatting at 65,536
mixed-call levels. Full mixed-call checking still aborts at 1,024, now in lowerer
`call` rather than parsing (`expression-parser-final-probes.json` and
`expression-parser-*.after.final.*.stdout/.stderr`). Permanent CLI tests separate
full accepted grouped/scalar programs with exact AIR/fuel from syntax-only
mixed/call inputs, and retain complete rejection records across commands.
Build, unit and Zig format checks pass. All 1,793 ordinary conformance cases pass
with terminal exit 0 and exact unique corpus coverage
(`expression-parser-conformance.jsonl` and its audit). The depth, grammar and
independent-error CLI suites pass 737/312/234 checks. The formatter passes 6,078
checks over 1,469 files (1,414 parsed, 55 existing syntax errors, 782 identical
AIR outputs). Frozen old/new CLIs retain exact exit/stdout/stderr on all 1,423
public source checks and 506 accepted lowerings
(`expression-parser-cli-compatibility.json`). These are compiler regressions,
not a full per-step GC pass or a model-capability measurement.
No normative, source/AIR format, feature, code, bundle, acceptance-limit or
ownership/runtime rule changes. Q-061 remains open for block/control parsing,
non-scalar lowering and the remaining liveness/read/assignment inventory.
This increment has no external review yet.
## Remaining work
Follow-up checks accept 16 parenthesized/mixed-call levels but abort
with empty stdout at 1,024. A qualified enum variant returns E7002 at 16
components but aborts in Parser.exprPath at 16,384. Raw evidence is
`generic-followup-depth-probes.json` and `generic-followup-*.stdout/.stderr`.
Generic transformation, its path callback, Parser.exprPath and the shared
expression parser above are now repaired. The preceding follow-up records are
historical checkpoints, not current parser failures. The remaining inventory
includes a confirmed lowerer failure and inspection-only risks:
| Production path | Evidence and next scope |
|---|---|
| Parser `ifExpr`, block/statement and match/arm expression entry | Native callback re-entry remains. Bounded block/if regression probes above pass; arbitrary and alternating control/statement depth is unverified. |
| Lowerer non-scalar `expr` callbacks: calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Mixed scalar/call source now has a confirmed native abort in `call` at 1,024 after parsing succeeds. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
| Lowerer use-after-region/liveness and assignment scans (`After`, first-use/read scans, `blockAssigns`/`stmtAssigns`/`exprAssigns`, match/select helpers) | Recursive AST walks inspected; audit their callers and finite deep inputs separately. |
The formatter's expression-marking traversal already uses a worklist, as
inspected and exercised by deep syntax-only probes. This inventory does not
claim every listed callback fails, or that all other paths have been cleared.
Q-061 and Phase 6 remain open; Q-060's unfinished full GC validation is
independent. The five reviewed increments now have a scoped external review;
the host-OOM follow-up and later repairs need their own review.