cli: lower boolean builtin operands iteratively

This commit is contained in:
dev committed 2026-10-11 14:43:00 +03:00
1 parent 627ad8f857
commit 5cc69393e4
5 files changed
+323 -27

No files matched your search

+2
View File
@@ -550,3 +550,5 @@ The [struct/value-field increment](source-expression-depth-audit.md#struct-const
The [array-continuation increment](source-expression-depth-audit.md#array-list-and-repetition-continuations) preserves list inference/consumption/check priority, repetition bounds/Copy rules, emission/loans and host OOM. Independent comparisons and deep sibling/error/OOM tests pass; the former pure-list failure at 4,096 now accepts. Variant-payload/call alternation still aborts at 256 before and after; remaining native callbacks and liveness/read/assignment walks keep Q-061 open. No new semantic or depth limit changes. All 1,793 ordinary conformance cases, 246 focused depth CLI checks and exact public check/lower parity (1,423/506) pass. Read-only Claude core/follow-up reviews found no production defects; their fixture gaps were corrected. Whole-frontend, loop/liveness and Phase 6 completion are not established.
The [enum-payload increment](source-expression-depth-audit.md#enum-payload-continuations) preserves lookup/arity-before-arguments, per-payload type/consumption/check order, empty/built-in construction, spans/loans and OOM. Independent shallow/deep/sibling and direct/public allocation tests pass; exact ordinary conformance coverage and final public check/lower parity (1,423/506) pass. The former enum-payload failure at 256 is repaired; nested assert still aborts at 1,024 before and after. Scoped read-only Claude reviews found no semantic defects; 331 core and 66 final supplementary CLI checks pass. Q-061 and Phase 6 remain open, with no semantic or new depth limit change.
The [boolean builtin increment](source-expression-depth-audit.md#boolean-builtin-operand-continuations) preserves assert/assume arity, non-consuming operands, type/error spans, unsafe registration and emission order, using shared continuations. All 1,793 ordinary conformance cases, public check/lower parity (1,423/506) and 282 focused depth checks pass. Expanded units and 69 supplemental checks pass; read-only Claude core/follow-up reviews found no production defect. Final span/counter unit checks pass. Own/region argument callbacks still abort at 1,024 before and after; remaining callbacks/walks keep Q-061 and Phase 6 open. No new semantic or depth limit changes.
+50 -1
View File
@@ -705,6 +705,55 @@ probes still abort at 1,024 before and after (`variant-followup-assert-probes.js
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.
## Remaining work
Follow-up checks accept 16 parenthesized/mixed-call levels but abort
@@ -719,7 +768,7 @@ 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. Nested assert lowering still aborts at 1,024 in both binaries. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
| 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 builtin operands are repaired above; own/region argument callbacks still abort at 1,024 in both binaries. 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
+13
View File
@@ -708,3 +708,16 @@ parity pass. Scoped Claude reviews found no semantic defects. The former
after. Initial focused CLI checks (331) and final supplementary checks (66)
pass. Q-061, Q-060 and Phase 6 remain open. No normative/format/feature/
code/bundle/limit or ownership/runtime change.
### Boolean builtin operand depth increment
The [Q-061 boolean builtin increment](../design/source-expression-depth-audit.md#boolean-builtin-operand-continuations)
shares assert/assume operands with the expression driver, preserving arity,
non-consuming evaluation, type/error spans, unsafe registration and emission.
Caller-arena lifetime and host OOM separation remain explicit. Exact ordinary
conformance coverage (1,793), public check/lower parity (1,423/506), targeted
nonvalue/linear/independent-error checks (635/49/234), and 282 focused depth
checks pass. Expanded units and 69 supplemental checks pass; read-only Claude core/follow-up
reviews found no production defect. Final span/counter unit checks pass. Own/region argument callbacks still abort at 1,024 in
both binaries. No semantic/depth-limit change; Q-061, Q-060 full GC validation
and Phase 6 exit gates remain open.