air: query cache-free nominal properties without recursion

This commit is contained in:
dev committed 2026-10-10 12:13:49 +03:00
1 parent 897f538840
commit 35635603f9
9 files changed
+539 -229

No files matched your search

+12
View File
@@ -98,3 +98,15 @@ All runtime size-query callers propagate metadata allocation errors before charg
Unit tests compare 7,168 shallow mixed struct/enum/wrapper queries, including invalid cycles, zero lengths and overflow, against the independent arithmetic derivation. A 32,768-declaration query now returns one byte. Every underlying metadata allocation is failed in turn, checking propagated OutOfMemory and complete temporary cleanup; cached success/overflow and partial-cache reads are checked separately. A verified enum/record/array programme runs 108 times across cached/cache-free modules, quota boundaries, fuel 0–8 and ordinary/per-instruction collection; all 54 paired records and instruction counts agree. Runtime metadata OOM remains a host error, not a budget_exceeded edge.
The repaired process-level 32,768-declaration query returns one byte, and both parsed cache-free library programmes retain their six-instruction result. All units, format checks, test-extended and all 1,791 current conformance cases pass; all 370 public conformance AIR check commands retain exact old/new exit status, stdout and stderr. Uncached nominal property predicates and their public call paths remain separate Q-059 work. No fresh Claude review was available.
## Cache-free nominal property queries
At 897f538, each of nine direct queries over 32,768 nested nominal records ending in u8 aborts with exit -6 and recursive property frames on the ordinary 8-MiB stack: linearity, Zeroable, Copy, Local, Send, Share, IslandSafe, endpoint and forbidden content. These constructed resolved graphs test the query API, not acceptance by the complete verifier. Only child core capture is disabled; no timeout terminates a probe. All nine repaired probes return their expected booleans.
Public property queries now take a host allocator and propagate metadata OutOfMemory. An iterative classifier retains the original anonymous edges, Send/Share transitions and terminal rules. Cached facts and anonymous terminal paths allocate nothing. A cache-free nominal query runs the existing monotone property worklist in a temporary arena and releases it before returning; it neither mutates the caller's module nor installs a cache. Zeroable rejects an enum without preparing its payload graph. Explicit prepared queries serve internal stages whose preceding type verification supplies immutable caches and value types. Public generic-argument validation and result-type helpers use fallible queries where that precondition does not hold.
The preserved invariant is that ownership/transfer/aliasing decisions use the same structural facts, independently of whether the caller retained verifier caches (spec 02/03/04). Property preparation retains its fixed points, universal/existential aggregation, declaration dependencies, phantom edges and saturated summaries. Invalid recursive layouts still reject E1003. Valid `source/generics/constraints_positive.aji` and the `nominal_queries/cycle` AIR/source rejection pair remain conformance examples; raw and prepared `own_array<Plain>` arguments accept, while `own_array<Owner>` arguments retain the same E1001 envelope. Verifier rules, runtime ownership, authority, fuel and deterministic scheduling are unchanged. There is no new Aji allocation, code, trap, feature, flag, syntax limit or bundle text. Only the internal Zig allocator/error API changes.
Tests compare both raw and prepared queries against 9,216 independent shallow pre-repair derivations (18,432 comparisons). Twenty-seven deep queries cover plain, task-local and endpoint leaves with pending sibling fields. Every temporary allocation is failed in turn for all nine properties, checking OutOfMemory and complete cleanup; prepared/terminal reads succeed with an allocator that rejects its first request. Generic-argument metadata failure produces no semantic diagnostic. Units, format checks and test-extended pass. The full property-engine conformance snapshot passes all 1,791 cases; old/new CLI checks are byte-identical for all 370 AIR and 1,421 source files, as are all 506 accepted source lowerings. Final full conformance after the generic-argument call-site correction also passes all 1,791 cases, with exact corpus coverage.
Q-059 remains open for the closing public-call-path audit and source AST traversal inspection. The earlier full per-instruction collection suite is still running; no incomplete suite or unavailable Claude review is counted as a pass. Phase 6 and contract decisions remain open.
+2
View File
@@ -473,6 +473,8 @@ The [audit-report increment](air-type-depth-audit.md#audit-report-traversal) fix
The [cache-free nominal size increment](air-type-depth-audit.md#cache-free-nominal-accounted-size-queries) fixes an independently reproduced 32,768-declaration low-level query failure. Uncached queries use temporary explicit continuations, release their metadata and propagate host OutOfMemory separately from arithmetic overflow. Deep queries, 7,168 independent arithmetic comparisons, cached null/partial-cache reads and 54 cached/cache-free verified runtime outcome pairs constrain compatibility. Parsed depth-1,024/4,096 public verification/runtime programmes pass before and after; no old runtime failure at those depths is claimed. Uncached nominal property predicates and remaining public query call paths keep Q-059 open.
The [cache-free nominal property increment](air-type-depth-audit.md#cache-free-nominal-property-queries) repairs independently reproduced failures in all nine uncached structural queries at 32,768 declarations. Public allocator/error APIs reuse the existing iterative fixed-point preparation in temporary storage; cached reads and anonymous terminal paths allocate nothing. Independent shallow comparisons, deep leaf/sibling cases, failed-allocation cleanup and raw/prepared generic-argument accept/reject tests preserve structural rules and diagnostic facts. No acceptance limit or semantic feature is introduced. Closing public-call-path and frontend AST traversal audits keep Q-059 open.
## Q-060 — Native recursion while materializing runtime values
The [executed runtime audit](runtime-value-depth-audit.md) confirms that a verified one-byte value with 32,768 length-one nested arrays aborts inside zeroValue under `aji run --fuel 8`, rather than producing a run record. The instruction has not exhausted fuel. Iterative runtime traversal must preserve initialization, value shape, allocator/root lifetimes, collection safety and instruction accounting; adding a depth trap/acceptance limit needs a normative decision. At that baseline, recursive copying, value sizing, collection and serialization were additional audit candidates with unverified failure paths; the increment below records subsequent executed failures. Compiler type repairs in Q-059 do not resolve Q-060.