cli: lower struct fields iteratively

This commit is contained in:
dev committed 2026-10-11 00:22:18 +03:00
1 parent 0791a50eb9
commit 6d2c4d40a8
5 files changed
+557 -53

No files matched your search

+2
View File
@@ -544,3 +544,5 @@ The [shared expression parser increment](source-expression-depth-audit.md#shared
Audit these paths separately with finite public/generated source inputs before claiming whole-frontend bounded native-stack processing. Prefer explicit continuations preserving existing syntax, evaluation/query order, diagnostics and OOM behavior. A new depth rejection requires a normative decision; Q-059's type-traversal resolution does not authorize one.
The [ordinary-call increment](source-expression-depth-audit.md#ordinary-call-argument-continuations) shares call arguments with scalar continuations, preserving signature/error priority, left-to-right consumption, loans, retained parents, CFG and host OOM behavior. Stable arena-owned states retain bounded builtin/control regression capacity. Build/units/format checks, exact ordinary conformance coverage and call-related CLI suites pass. A separate alternating struct/field program still aborts at 1,024 before and after; builtin/variant/place, aggregate/control and remaining liveness/read/assignment paths keep Q-061 open. No semantic or depth limit changes and no fresh external review are claimed.
The [struct/value-field increment](source-expression-depth-audit.md#struct-construction-and-value-field-continuations) preserves declaration-order initializer checks, receiver lookup and deferred annotation queries, nominal/static/slice length rules, loans and host OOM. Independent shallow/deep comparisons, output-arena failure cleanup, exact ordinary conformance coverage and public CLI parity pass. The former struct/field abort is repaired; nested array literals still abort at 4,096 before and after. Remaining array/variant/place/control callbacks and liveness/read/assignment walks keep Q-061 open. No semantic or new depth limit changes are made. Independent read-only Claude core/follow-up reviews found no concrete defects, without running tests or establishing whole-Q-061 completion.
+62 -2
View File
@@ -540,6 +540,65 @@ 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.
## Remaining work
Follow-up checks accept 16 parenthesized/mixed-call levels but abort
@@ -554,7 +613,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-call argument descent is repaired above. Alternating struct/field 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 and struct/value-field descent are repaired above. Nested array-literal lowering still aborts at 4,096 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
@@ -562,4 +621,5 @@ 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.
the host-OOM follow-up and intermediate repairs have no separate review.
The struct/value-field increment has the scoped reviews recorded above.
+24
View File
@@ -657,3 +657,27 @@ abort at 1,024 is repaired, while a separate alternating
struct/field program still aborts there in both binaries. Remaining Q-061
callbacks/walks, Q-060 validation and Phase 6 exit gates remain open. No fresh
external review covers this increment.
### Struct/value-field depth increment
The [Q-061 struct/value-field increment](../design/source-expression-depth-audit.md#struct-construction-and-value-field-continuations)
shares constructor fields and value receivers with scalar/call continuations.
Declaration-order consumption, duplicate/unknown/missing-field priority,
receiver-first queries, deferred annotation checks and nominal/static/slice
length rules are preserved. Stable states remain in the caller's arena; host
OOM never becomes a source diagnostic, and backing failures free that arena.
Borrow/place helpers retain their existing rules and native callbacks.
Independent shallow (864) and 32,768-level mixed comparisons, recovering/
persistent OOM tests, build/units/format and all 1,793 ordinary conformance
cases with exact coverage pass. Call/ownership CLI checks (635/49/348/133/302/
152/42/234) and frozen public check/lower parity (1,423/506) pass. Bounded native
assert/block/if probes remain exact through 256. The focused depth CLI suite
passes 302 checks: pure/length/generic chains accept at 65,536; mixed chains
accept at 32,768 and reach the existing instruction limit at 65,536. The
struct/field abort at 1,024 is repaired; nested array literals still abort at
4,096 in both binaries.
No normative/bundle/feature/code/limit or ownership/runtime rule changes.
Remaining Q-061 callbacks/walks, Q-060 validation and Phase 6 exit gates remain
open. Independent read-only Claude core/follow-up reviews found no concrete
defects; neither ran tests or established whole-Q-061 completion.