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

58 KiB
Raw Blame History

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. At this checkpoint mixed-call checking still aborted at 1,024, 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.

Ordinary-call argument continuations

Ordinary local/module/std/generic call arguments now suspend in the scalar expression driver. Callee normalization, signature/arity and named-from checks still precede arguments; values are consumed left to right, exact type checks precede the next argument, and temporary loans end after call as before. Returned-borrow provenance, void/never exits, generated names, spans and short-circuit CFG are unchanged (spec 15 §5, §19).

Stable call states and worklist backing belong to the caller's arena; they remain until that arena is destroyed, including after an error. Keeping only state pointers in continuations avoids large native frame copies. An initial by-value implementation regressed nested assert diagnostics at 256 levels; final before/after probes retain identical outputs for assert, blocks and if at 16/64/256 (call-continuations-callback-pointer.json). This is bounded regression coverage, not arbitrary builtin/control depth safety.

The copied shallow recursive call/scalar oracle compares emission, CFG, diagnostic priority, transfers, temporary cleanup and retained parents. Place, byte-materialization and builtin helpers are shared, outside its independence. Separate 32,768-level direct/mixed call tests and recovering direct/public plus persistent backing-OOM tests pass. Host OOM remains an error union, without a source diagnostic or public partial AIR; output-arena backing is freed.

Build/unit/format checks and all 1,793 ordinary conformance cases pass with terminal exit 0 and exact unique coverage (call-continuations-conformance artifacts). Borrow-return/array-argument/generic/static-function/non-value/ independent-error CLI suites pass 133/85/42/25/635/234 checks. Frozen old/new CLIs retain exact exit/stdout/stderr for 1,423 public source checks and 506 accepted lowerings (call-continuations-cli-compatibility-pointer.json).

Full direct/mixed arithmetic/negation and generic call checks, lowerings and formatting now accept through 65,536 levels; bounded runs retain exact AIR values and independently counted fuel. All 262 focused call-depth CLI checks pass against the frozen final binary (call-continuations-focused-depth.log), including exact innermost E7002 records across check/lower/run/report/explore. The former 1,024-level mixed-call abort is repaired. A separate alternating Box { n: expression }.n probe still aborts at 1,024 before and after this increment, while 16 levels accept (call-followup-field-struct-probes.json). Builtin/variant/place callbacks, aggregate/control lowering and remaining liveness/read/assignment walks are further Q-061 work. No normative, language/ AIR format, feature, diagnostic, bundle, limit or ownership/runtime change; Q-060 full per-step GC validation and Phase 6 exit gates remain separate. This increment has no external review yet.

Struct construction and value-field continuations

Struct initializers and value-field receivers now share the scalar/call driver. Provided duplicate/unknown fields still reject before any initializer; missing fields reject when reached in declaration order. Each field's type and consuming name check precede its initializer, followed by its exact operand check. Receiver type/field lookup precedes value evaluation; the field annotation is resolved afterward, as before. Nominal .len keeps its extra query, static array length skips receiver evaluation, and slice length evaluates it. Borrow/place loads and temporary endings retain their existing native helper.

Constructor/read states and worklist backing belong to the caller's arena, including on errors; only stable pointers are queued. Recovering direct/public allocation failures remain host OOM without source diagnostics or public partial AIR; persistent backing failures check arena cleanup. No ownership/verifier/ runtime, normative, format, feature, diagnostic, bundle or limit change.

The copied former struct/field/length descent, linked to the shallow scalar/call oracle, passes 864 comparisons of values, constants, full emission/CFG, errors and loan parents, including and/or inside constructors and field receivers. Borrow-place and array/variant helpers are shared, outside this oracle's independence. Separate 32,768-level struct/field and mixed scalar/call tests retain exact instruction/span order. Build/unit/format checks and all 1,793 ordinary conformance cases pass with terminal exit 0 and exact coverage, repeated after cleanup (struct-fields-conformance-reviewed.jsonl and its audit). Call/ownership CLI suites pass 635/49/348/133/302/152/42/234 checks; frozen old/new public source checks and lowerings are byte-identical (1,423/506).

The focused struct/field CLI suite passes 302 checks on the frozen pre-cleanup binary (struct-fields-focused-depth.log). Full checks/lowerings and formatter parity accept pure, nominal-length and generic chains through 65,536 levels; mixed negation/call chains accept through 32,768. At 65,536 mixed levels the existing instruction limit rejects with E5101 (instructions per function, max: 262144, found: 327682); lowering retains the complete AIR. Bounded runs check exact values, fuel and source/AIR parity. Deep missing/duplicate/unknown fields retain exact codes, reasons and positions across five CLI commands. Final cleanup removes test-only wrappers and routes query OOM checks through expr; it does not change production traversal. Thirty-six final pre/post cleanup CLI comparisons at depths 0/16/1,024 retain exact exit/stdout/stderr (struct-fields-cleanup-cli-parity.json).

Before/after native assert/block/if probes remain identical at 16/64/256 (struct-fields-callback-initial.json). The former alternating struct/field abort at 1,024 is repaired. A separate array-literal probe accepts 1,024 but still aborts at 4,096 in both binaries (struct-fields-followup-array-probes.json and raw stdout/stderr). This is the next confirmed lowering path; array/variant/ place and control callbacks plus liveness/read/assignment scans still keep Q-061 open. Q-060 full per-step GC validation and Phase 6 exit gates remain separate.

Claude's independent read-only core review and narrower cleanup follow-up found no concrete defects (/tmp/aji-struct-fields-review.md and /tmp/aji-struct-fields-followup-review.md). The follow-up read current code and its own diff but could not reopen the first report outside the repo. Neither reviewer ran builds or tests; terminal checks above are separate evidence. The follow-up's unverified CLI E5101 byte-parity assumption is covered by the 302-check run. Deep boolean/field interactions beyond the shallow oracle, borrow-place depth and full Q-061 completion are not established.

Array list and repetition continuations

Array initializers now share the scalar/call/struct/value-field driver. Lists retain the 1..64 size check before children, contextual or first-element inference, left-to-right explicit consumption, and element-position checks before exact-type checks. Their result uses actual element type and length. Repetitions retain the 1..2^32 bound before the operand, non-consuming operand evaluation, then member/Copy checks and array.splat (spec 15 §5, §16). Queries, CFG, names, spans, loans and host OOM policy are unchanged. Stable list states and worklist buffers have caller-arena lifetime, including on errors; public backing-failure tests observe arena destruction, not list-deinit frees. No normative/format/feature/code/bundle, ownership/runtime or limit change.

The copied former array descent joins the independent shallow scalar/call/ struct/field oracle. It passes 1,036 comparisons including inference, consuming names, borrow-before-Copy, position-before-type priority, void/never, boolean CFG and synthetic list-size boundaries. Property/emission/place helpers and non-operand fallback leaves remain shared. Separate 32,768-level tests cover list/repetition/call alternation with bounded types, an inferred outer list resuming at an unsuffixed or erroring sibling, exact emission/spans, and innermost errors. Recovering allocation sweeps include 64 inputs and an outer repetition; persistent public failures check arena cleanup and no partial AIR/diagnostic. The final error-sibling test passes after entry-by-entry prefix comparison: a fixed-size-array deep comparison initially overflowed the test helper's native stack (array-continuations-unit-siblings.log, final terminal exit 0).

Build/unit/format checks and all 1,793 ordinary conformance cases pass with exact coverage (array-continuations-conformance.jsonl and its audit). Array-literal/argument/linear/nonvalue/inferred-content/independent-error CLI suites pass 152/85/49/635/302/234 checks. Nine before/after assert/block/if probes remain byte-identical through 256 (array-continuations-callback-parity.json). The former pure-list abort at 4,096 now accepts (array-continuations-initial-probe.json). Pure nested types produce quadratic AIR text; this does not claim arbitrary-sized successful aggregate output. The focused CLI suite passes 246 checks (array-continuations-focused-depth.log): list/repetition calls accept through 65,536, mixed scalar/struct/array calls through 32,768; at 65,536 mixed levels the existing E5101 instruction limit reports max: 262144, found: 458754. Both pure forms check at 4,096; bounded runs check exact values/fuel and AIR parity, formatting remains a fixed point, and deep unknown/bound errors retain exact CLI records. Frozen public source checks/lowerings are byte-identical (1,423/506; array-continuations-public-parity.json). These are straight-line shapes; loop/liveness/assignment callers are not thereby validated.

Claude's read-only core review found no production defect, but identified two fixture gaps: an unbound borrow name and missing position-before-type cases. Both were corrected, with additional sibling/inference and OOM coverage. The read-only follow-up found no concrete defects and confirmed the CLI counts, fuel and run-record shape (/tmp/aji-array-continuations-review.md and /tmp/aji-array-continuations-followup-review.md). Neither reviewer ran tests; the final test-only error-sibling addition follows that review. Separate variant-payload/call probes accept 16 levels but abort in prepareCall → variantValue → consuming at 256 in both binaries (array-followup-variant-probes.json). Variant/place/builtin/control callbacks and liveness/read/assignment scans keep Q-061 open; Q-060 full GC validation and Phase 6 gates remain separate.

Enum-payload continuations

Enum payloads now share the scalar/call/struct/array/value-field driver. Enum/variant lookup and arity still precede arguments. Each payload annotation is resolved immediately before its consuming-name check and evaluation; exact type checking precedes the next payload. Argument order, names, CFG, spans, loans and delayed enum.make are preserved (spec 15 §5, §16). Built-in errors and empty named variants finish immediately. A narrow private VariantDispatch is widened explicitly at the call boundary. Queued states are stable caller- arena allocations; their backing remains until arena destruction, including on errors. Host OOM propagates without language diagnostics or public partial AIR. No normative/format/feature/code/bundle/limit or ownership/runtime change.

The copied old constructor joins the shallow recursive oracle, passing 720 comparisons including lookup/arity priority, linear transfers, borrow/bytes, boolean CFG, arrays and failure after a consumed argument. Type/emission/place helpers and non-operand leaves remain shared. Deep tests cover 32,768 variant/ call levels with one or two payloads, exact sibling and constructor spans/order; recovering direct/public and persistent backing failures cover nonempty, empty and built-in constructors, arena cleanup and no swallowed allocation.

Build/units/format and both initial/final ordinary conformance runs pass with exact coverage of all 1,793 cases (variant-continuations-conformance-final.jsonl and its audit). Targeted error/generic/linear/nonvalue/inferred-content/ independent-error suites pass 26/42/49/635/302/234 checks; error/generic suites are repeated on the final binary. Final public check/lower outputs are exact (1,423/506; variant-continuations-public-parity-final.json). Nine bounded assert/block/if comparisons remain exact through 256, without a frame-size claim. The former enum-payload abort at 256 now accepts through 16,384.

The frozen initial core passes 331 focused depth CLI checks: ordinary/two/ generic chains accept through 65,536, mixed scalar/struct chains through 32,768. At 65,536 mixed levels the existing instruction limit reports E5101, max: 262144, found: 458754. Exact bounded fuel/values, AIR and formatter parity, and deep lookup/arity error records are checked. Final supplemental mismatch/empty-constructor checks pass 66 cases (variant-continuations-supplemental-depth.log), including exact type-error positions and empty-leaf checking/formatting through 65,536 with bounded values/fuel/AIR parity. Pure recursive-type construction, loop/liveness and arbitrary native callbacks are not established.

Read-only Claude core/follow-up reviews found no semantic defects (/tmp/aji-variant-continuations-review.md and /tmp/aji-variant-continuations-followup-review.md). Comments/dispatch and fixture gaps were corrected; direct borrow/bytes, deep type-error and empty CLI cases follow the review. Neither reviewer ran tests. Separate nested-assert probes still abort at 1,024 before and after (variant-followup-assert-probes.json), in prepareCall → expr. Builtin/place/control callbacks and liveness/read/ assignment walks keep Q-061 open; Q-060 full GC and Phase 6 gates remain separate.

Boolean builtin operand continuations

assert and assume now evaluate their non-consuming boolean operand in the shared expression driver (spec 15 §4–§5; unsafe boundary: spec 13 §6). Arity precedes the child; its exact span/type check precedes unsafe registration, emission and the void result. Dispatch priority, names, CFG and errors remain unchanged. Stable continuation states and work buffers retain caller-arena lifetime. Host OOM propagates separately from source problems, including allocation while rejecting a program. No normative, format, feature, code, bundle, limit or ownership/runtime rule changes. The preserved invariant is that only a checked boolean reaches the instruction. Verifier effect requirements and deterministic runtime rules remain unchanged: source/layer6/unchecked.aji is valid and source/nonvalue_operands/assume.aji rejects E7005; supplemental false-input runs retain T0002/T0009. Public output parity establishes compatibility.

The copied old boolean builtin bodies join the shallow oracle, including scalar/boolean/call, aggregate/field/variant consumers and non-value operands. Shared control/place/emission/type helpers limit its independence. Deep units cover 32,768 ordinary-call operands and alternating assert/assume/call errors, exact spans, counts and unsafe registration. Public recovering/persistent OOM sweeps cover accepted and rejected programs and arena backing cleanup. Final expanded unit validation, including distinct-callee spans and exact counters, passes.

The ordinary conformance run passes all 1,793 cases with exact coverage (boolean-builtin-conformance.jsonl and its audit). Frozen public check/lower outputs are exact (1,423/506; boolean-builtin-public-parity.json); targeted nonvalue/linear/independent-error suites pass 635/49/234 checks. The focused CLI block passes 282 checks: nested void errors and ordinary-call operands through 65,536, exact diagnostic positions and cross-command records, AIR/formatter parity, and successful values/fuel through 1,024. Supplemental trap/hosted/ feature and mixed deep arity/type validation passes 69 checks (boolean-builtin-supplemental-depth.log). Trap/hosted/fuel runs are bounded at 1,024; the larger depths check/lower/format or reject. These focused runs are not a new full run of source_expression_depth.py.

Claude's read-only core/follow-up reviews found no production defect (/tmp/aji-boolean-builtin-review.md and /tmp/aji-boolean-builtin-followup-review.md). Fixture gaps were corrected; final distinct-callee-span/counter assertions follow the review. Neither reviewer ran tests. Dispatch/query shadowing was not separately validated; mixed deep-error call frames are descended but not all resumed. A repetition fixture requires the prepared nominal-property module and is tested there. Separate probes of own.free, own.take and region.destroy retain JSON at 16/256 but abort at 1,024 before and after (boolean-builtin-callback-probes.json); the current trace enters prepareCall from consuming. Other builtin/place/control callbacks and liveness/read/assignment walks, Q-060 full GC validation and Phase 6 exit gates remain open.

Consuming ownership builtin continuations

own.take, own.free and region.destroy now share the expression driver (spec 15 §5, §8, §16). Arity precedes explicit-name consumption checking and operand evaluation with no expected-type hint. Exact type/error-span checks precede extraction/destruction emission. The invariant is unchanged: ownership is transferred explicitly once; the verifier still checks use-after-move, leaks, linear content and live region loans. Runtime rules are unchanged, including whole-value extraction and deterministic destruction. layer5/own_basic.aji and layer5/region.aji remain valid; layer5/reject/missing_move.aji retains E7003; source/linear/free_linear_content.aji still rejects E1001 at own.free. No new diagnostic/feature/format/bundle/limit or ownership rule.

The old bodies in ReferenceCalls provide shallow comparisons across owners, arrays, regions, nominal content and scalar/aggregate/CFG consumers. Shared leaf/type/emission/place helpers limit independence; raw borrowed-content owners are defensive fixtures, not newly accepted source. Deep units cover 32,768 forwarding calls and invalid nested/mixed descent, exact names/spans and one completed builtin before rejection. Recovering/persistent public OOM sweeps cover success and E7003/E7005. The initial missing-main fixture was corrected and baseline results asserted before sweeping. Arena backing is released on destruction; worklists retain caller-arena lifetime. Final expanded units pass, including successful own<bool> boolean CFG comparisons.

All 1,793 ordinary conformance cases pass with exact coverage, and frozen public check/lower outputs are exact (1,423/506). Targeted linear/nonvalue/ inferred-content suites pass 49/635/302 checks. The frozen core passes 351 focused CLI checks: forwarding calls and exact cross-command arity/type/name errors through 65,536, formatter/AIR fidelity, values and fuel through 1,024. Final formatted-rejection supplementary checks pass 108 cases (consuming-builtin-supplemental-depth.log). This does not claim a fresh full expression-depth suite run.

Claude's read-only core/follow-up reviews found no production defect (/tmp/aji-consuming-builtin-review.md and /tmp/aji-consuming-builtin-followup-review.md). Their fixture gaps were corrected; the final own<bool> addition follows the review. Neither reviewer ran tests. Deep mixed errors establish descent and one builtin completion, not completion of every pending call. At this consuming checkpoint, separate atomic-new/take pairs accept 16 in both binaries, abort at 256 only before, and abort at 1,024 in both; task.join chains still aborted at 1,024 (consuming-builtin-next-probes.json). No frame-size explanation is established. Other builtin/place/control and liveness callbacks, Q-060 full GC validation and Phase 6 gates remain open.

Atomic operand continuations

Atomic new/take and ordinary store/RMW value operands now share the expression driver (spec 15 §12; spec 04). Arity precedes children; take checks explicit consumption, while new has no type hint. Updates retain cell/ordering-before- value priority, exact type checks and temporary-borrow endings after emission. Load/fence and multi-result compare-exchange retain their existing paths. The invariant is unchanged: cells are linear and atomic operations use a shared borrow with explicit ordering. Verifier/effect/runtime rules, instruction text, names, spans and CFG are unchanged; no default ordering, new feature/code/ format/bundle/limit or ownership/concurrency rule. Public output parity and existing positive/rejected atomic conformance cases establish compatibility.

Copied ReferenceAtomics bodies use the former recursive operand path; shared leaf/place/type/emission helpers limit oracle independence. Shallow comparisons include bool/integer cells, temporary/bound borrows, orders, arity, non-values and scalar/aggregate/CFG consumers. Deep units pass 32,768 new/take pairs and RMW operands with exact counts/spans. Recovering/persistent public OOM sweeps check successful and E7003/E7005/E7006 baselines, no swallowed OOM and backing cleanup. States and work buffers retain caller-arena lifetime. Build/units/format pass.

Ordinary conformance passes all 1,793 cases with exact coverage (atomic-operand-conformance.jsonl and its audit), including schedule cases; frozen public check/lower outputs are exact (1,423/506). Atomic-access/nonvalue/ independent-error suites pass 33/635/234 checks. Focused CLI validation passes 270 checks in two corrected subset runs: pair 57 and mixed/update/rejection 213 (atomic-operand-pair-depth.log, atomic-operand-followup-depth.log). New/take pairs and temporary shared-borrow updates accept through 65,536; mixed call/negation/atomic chains accept through 32,768 and reach the existing E5101 instruction limit at 65,536 (max: 262144, found: 327683). Six error families retain exact code/position/priority through 65,536 across check/lower/run/report/ explore. Formatter fixed points and lower parity pass; source/AIR results and exact fuel are exercised only through 1,024. Existing source/layer10/sc_only.aji passes 30 schedules; source/layer10/reject/take_while_lent.aji retains E4101. Read-only Claude core/follow-up reviews found no production defect (/tmp/aji-atomic-operand-review.md and /tmp/aji-atomic-operand-followup-review.md); fixture arithmetic/limit and span/type gaps were corrected. Neither reviewer ran tests. The mixed fixture uses a function call as its leaf, so signed-literal folding does not erase the first negation. No new whole-expression-suite, arbitrary callback or runtime-depth claim.

At this atomic checkpoint, task.join still aborts at 1,024 before and after (atomic-operand-next-probes.json); bounded 16/256 records remain equal. Other builtin/place/control and liveness walks, Q-060 full GC and Phase 6 exit gates remain open.

Task join operand continuations

Task.join now uses the shared consuming operand driver (spec 15 §7; spec 04 §33–34): arity precedes children, named linear inputs still require move, the operand receives no type hint, and its task type is checked before emission. Void joins emit without a result; other joins define the same result name/type at the same call span. Tasks remain function-bound; join consumes the handle and returns its loans. Scope/result/Send/effect/verifier/runtime rules, scheduler behavior, AIR, diagnostics, bundle and limits are unchanged.

ReferenceTaskJoin copies the former body and recursively consumes through ReferenceCalls; shared leaf/place/type/emission helpers limit independence. Shallow comparisons cover scalar/void/linear/aggregate results, moves, non-values, wrappers and error priority. Raw helper task results containing borrows/tasks/scopes deliberately compare lowering only, not legal programs; spec 04 §33.1 still rejects them. Deep 32,768 helper-call operands and rejected join chains retain exact spans/counts/first errors. Recovering/persistent public OOM sweeps cover scalar/void success and E7003/E7005, with host-error separation and backing cleanup. Work states retain caller-arena lifetime.

Build/units/format, all 1,793 ordinary conformance cases with exact coverage, frozen public checks/lowerings (1,423/506), lifetime checks (188), related-location checks (409) and CFG-provenance checks (146) pass. Focused CLI passes 522 checks: valid scalar/void joins with call operands and pure/mixed rejected join chains through 65,536, exact formatted positions, source/AIR/fuel checks through 1,024 and three schedule seeds through 16. Existing source/linear/task_loan_join.aji passes eight schedules; source/layer7/reject/scope_unjoined.aji retains E4301. Read-only Claude core/follow-up reviews found no production or fixture defect (/tmp/aji-task-join-review.md, /tmp/aji-task-join-followup-review.md); stale comment/checkpoint wording is corrected. Neither ran tests. Follow-up inspected current lower.zig and the diff, not full CLI/docs or evidence artifacts; its file tools could not open the core report in /tmp. The initial unit fixture aliased its destination while copying a child; child copying now precedes assignment.

The next finite probe alternates join/spawn in one scope, with scalar arguments and one live child at a time. It accepts 16 levels but aborts at 256/1,024 in both frozen binaries (task-join-next-probes.json). Spawn-argument callbacks, multi-result task.join_cancel inputs and other graph/place/control/liveness walks retain native callback entry with depth unverified beyond these probes. Q-060 full GC and Phase 6 exit gates remain open. No whole-frontend or arbitrary runtime-depth claim.

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: builtin/variant calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements Ordinary calls, struct/value-field, array and enum-payload descent are repaired above. Boolean, consuming own/region, atomic and task.join operands are repaired above. Alternating join/spawn still aborts at 256 in both binaries. Spawn arguments and multi-result task.join_cancel inputs retain native callback entry. 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 intermediate repairs have no separate review. The struct/value-field, array and enum-payload increments have the scoped reviews recorded above.