cli: propagate host allocation errors from source queries
This commit is contained in:
1 parent
6945b511a4
commit
50a7575efb
6 files changed
+401
-127
No files matched your search
@@ -31,7 +31,9 @@ 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 and is released on completion/error. Allocation failure
|
||||
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.
|
||||
@@ -81,8 +83,9 @@ 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, released on error/completion; finished values
|
||||
and addressability facts retain their caller-arena lifetime. OOM propagates
|
||||
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
|
||||
@@ -132,11 +135,12 @@ 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. Queries remain best-effort: type-output
|
||||
OOM already returned unknown, and continuation-allocation OOM now does too,
|
||||
without a diagnostic. This adds host metadata requests; allocation counts and
|
||||
failure-index classifications are not claimed identical. Pending storage is
|
||||
released, and type nodes keep their caller-arena lifetime.
|
||||
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`
|
||||
@@ -183,9 +187,11 @@ 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, released on success/error; hint type nodes
|
||||
retain their caller-arena lifetime. As in other best-effort type queries,
|
||||
metadata OOM produces unknown without a diagnostic or instructions. This adds
|
||||
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,
|
||||
@@ -236,8 +242,9 @@ 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 metadata is
|
||||
released while generated values retain their caller-arena lifetime. Allocation
|
||||
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
|
||||
@@ -272,19 +279,67 @@ 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.
|
||||
|
||||
## Remaining work
|
||||
|
||||
Current follow-up checks still abort with empty stdout at 1,024 parenthesized
|
||||
levels and 1,024 generic unary levels (`binary-followup-depth-probes.json` and
|
||||
`binary-followup-*.stdout/.stderr`). Parenthesized parsing and generic expression
|
||||
transformation require separate repairs.
|
||||
`binary-followup-*.stdout/.stderr`). The remaining inventory is broader than
|
||||
these two observed failures:
|
||||
|
||||
Inspection of the generic transformation also finds a recursive qualified-path
|
||||
callback (`generics.path`). Its deep full-source behavior is unverified here;
|
||||
it belongs in that repair's callback inventory, rather than Q-059's type scope.
|
||||
| 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 | Recursive callbacks inspected; deep behavior unverified. Include mixed forms such as `n + f(n + f(...))`, not only homogeneous spines. |
|
||||
| Parser `exprPath` | Recursive qualified-field callback inspected; deep source behavior unverified. |
|
||||
| Generic `expression`/reflective `walk` | Confirmed generic unary failure at 1,024; include call/type/static-worker handling and nested statement/block cloning. |
|
||||
| Generic `path` | Recursive qualified-field callback inspected; deep full-source behavior unverified. |
|
||||
| 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. |
|
||||
|
||||
Other expression/block handlers and their complete depth behavior need further
|
||||
auditing. The formatter's expression-marking traversal already uses a worklist,
|
||||
as inspected and exercised by the deep syntax-only probes. Q-061 and Phase 6
|
||||
remain open; Q-060's unfinished full GC validation is independent. No fresh
|
||||
Claude review covers these expression increments.
|
||||
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.
|
||||
Reference in new issue
Block a user