cli: parse qualified constructor paths iteratively

This commit is contained in:
dev committed 2026-10-10 19:23:50 +03:00
1 parent d39a422b2b
commit 371329f3f0
5 files changed
+227 -12

No files matched your search

+2
View File
@@ -537,4 +537,6 @@ The [external review and host-OOM follow-up](source-expression-depth-audit.md#ex
The [generic transformation increment](source-expression-depth-audit.md#generic-ast-transformation-continuations) replaces expression/statement/block cloning and its qualified-path callback with typed work entries. AST/error/instance order, spans, Copy-transfer and static-worker policy are preserved; existing type/instance guards remain. A separate baseline confirms generics.path also aborted on a 16,384-field unknown callee. Full generic scalar checks/lowerings now accept through 65,536; deep unknown callees return exact E7002. Independent shallow/deep/OOM and 497/42/25 CLI checks pass; frozen old/new public checks/lowerings remain exact (1,423/506). All 1,793 ordinary conformance cases pass with exact coverage. Follow-up probes confirm remaining parser failures at 1,024 parenthesized/mixed-call levels and 16,384 qualified-variant fields. Q-061 remains open, without a new limit or external review of this increment.
The [parser constructor-path increment](source-expression-depth-audit.md#parser-qualified-constructor-paths) repairs Parser.exprPath independently of generic/lowering paths. Frozen baseline probes confirm enum and struct constructor aborts at 16,384 fields; the repaired CLI returns exact E7002 through 65,536. Named-root classification, spelling, type arguments, spans, syntax errors and host OOM propagation are preserved, with one complete string allocation. Q-061 remains open for the confirmed parenthesized/mixed-call parser failures and the remaining lowering/liveness inventory; no new acceptance limit or external review is claimed.
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.
+44 -4
View File
@@ -385,20 +385,60 @@ 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.
## Remaining work
Current follow-up checks accept 16 parenthesized/mixed-call levels but abort
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 and its path callback above are repaired; the remaining
inventory includes these observed parser failures and inspection-only risks:
Generic transformation, its path callback and Parser.exprPath above are now
repaired; the remaining inventory includes the other observed parser failures
and inspection-only risks:
| Production path | Evidence and next scope |
|---|---|
| Parser `postfix`/`primary` through parenthesized `expr` | Confirmed failure at 1,024 levels; preserve grouping, precedence and spans. |
| Parser `callArgs`, array/index/struct initializers, `ifExpr`, block/statement and match/arm expression entry | Mixed `1i64 + id(...)` calls have a confirmed parser abort at 1,024. Other callback depth behavior is unverified; include alternating forms, not only homogeneous spines. |
| Parser `exprPath` | Confirmed qualified enum-variant abort at 16,384; preserve named-root classification, spelling, syntax/error priority and spans. |
| Lowerer non-scalar `expr` callbacks: calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Native re-entry remains outside the repaired scalar driver; deep behavior unverified, including 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. |
+17
View File
@@ -596,3 +596,20 @@ return exact E7002. Follow-up probes retain separate parser failures at 1,024
parenthesized/mixed-call levels and confirm Parser.exprPath failure at 16,384
qualified-variant fields. Q-061's remaining inventory, Q-060 validation and Phase
6 exit gates stay open. No external review covers this increment yet.
## Source parser constructor paths (2026-10-10)
The [Q-061 parser-path increment](../design/source-expression-depth-audit.md#parser-qualified-constructor-paths)
removes native recursion and intermediate prefix copies from Parser.exprPath.
Root classification, spelling, generic arguments, spans and syntax/error
priority remain unchanged; host OOM propagates separately from source errors.
Frozen baseline enum/struct constructor probes abort at 16,384 fields; repaired
CLI probes return exact E7002 through 65,536. Independent shallow path, deep
parser/spelling and failed-allocation cleanup tests cover this callback.
Build/units/format checks, all 1,793 ordinary conformance cases with exact
coverage and 577/312 expression-depth/grammar CLI checks pass; frozen old/new public checks/
lowerings remain exact (1,423/506).
No normative/bundle/feature/code/acceptance-limit or runtime/ownership rule
changes. Parenthesized and mixed-call parsing failures, remaining expression/
statement walks, Q-060 validation and Phase 6 exit gates remain open. This
increment has no external review yet.