interp: evaluate cache-free nominal sizes without recursion
This commit is contained in:
1 parent
c9064418bd
commit
897f538840
7 files changed
+218
-43
No files matched your search
@@ -86,3 +86,15 @@ Both verified crashing CLI inputs now finish: return equality at depth 65,536 ac
|
||||
Call-path inspection finds a further anonymous traversal in report.write's capability-kind collector. The verified 65,536-depth parameter module accepts checking but `aji report` aborts with 10,000 go frames (plus one inner frame), no JSON and exit -6. The collector now iterates inner types, preserving its nominal-name stop, scan sites, deduplication and sorted output. The complete report probe now returns an audit JSON document, and a checked deep capability parameter unit test retains sorted deduplication across declarations, parameters, return and block parameters. Unit/format checks and all 1,769 conformance cases pass; all 366 public AIR report commands preserve exact old/new exit/stdout/stderr.
|
||||
|
||||
The CLI retains verifyModule's size/property caches in check.Report.module; frontend constraints use properties.prepare before structural queries. Uncached nominal fallback remains present in the low-level APIs and needs its own audit. No blanket native-stack claim is made for all query paths. A separate accepted runtime zero-materialization probe exposes [Q-060](runtime-value-depth-audit.md); compiler type repairs do not resolve runtime value traversal.
|
||||
|
||||
## Cache-free nominal accounted-size queries
|
||||
|
||||
At c906441, a direct accountedSize query over a constructed chain of 32,768 single-field nominal records ending in u8 aborts with exit -6 on the ordinary 8-MiB stack. Its symbolized stderr contains 5,001 accountedSize and 5,000 uncachedBaseSize frames before the traceback limit. This is an executed low-level size-query failure, not a claim that the full verifier accepted that constructed module. A separate parsed programme with 1,024 or 4,096 uniquely named nested records passes the public verify wrapper, retains neither cache in the caller's module, then allocates/frees its one-byte contents through interp.run under fuel 8. Both old runs return normally after six instructions. No wall-clock timeout ends a probe; only child core capture is disabled.
|
||||
|
||||
The public size query now accepts a compiler allocator and propagates OutOfMemory separately from null arithmetic overflow. Cached entries and anonymous/scalar queries remain allocation-free. An uncached nominal leaf uses SizeMemo's explicit continuations in a temporary host arena, released before returning. Partial immutable module caches may supply child entries, including cached null; neither type storage nor caller cache is mutated. The nominal cycle guard, checked field sums, enum payload maxima/tag accounting, unary affine folding and early overflow behavior are unchanged. The recursive arithmetic derivation is retained only as a shallow independent test oracle.
|
||||
|
||||
All runtime size-query callers propagate metadata allocation errors before charging authority or publishing new payloads. The existing accounted-size invariant (spec 08 §7.1), verifier acceptance/priority, heap/region/graph/buffer/channel charges and release rules remain unchanged. This adds no Aji allocation, effect, fuel charge, scheduling point, code, trap, feature, semantic flag or depth limit. The internal Zig accountedSize API gains an allocator/error result; AIR/source syntax and CLI records are unchanged. The existing nominal_queries/cycle AIR/source rejection pair still expects E1003, and the valid nested_allocation_quota pair retains its precise allocation and release behavior.
|
||||
|
||||
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.
|
||||
@@ -471,6 +471,8 @@ The [equality/printing increment](air-type-depth-audit.md#type-equality-and-prin
|
||||
|
||||
The [audit-report increment](air-type-depth-audit.md#audit-report-traversal) fixes the capability-kind collector after a verified 65,536-depth module crashes `aji report`. The collector now iterates anonymous edges and retains report contents/order. Uncached nominal/query call paths remain open; Q-059 is not resolved.
|
||||
|
||||
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.
|
||||
|
||||
## 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.
|
||||
@@ -484,3 +486,5 @@ The [sharing-preserving copy increment](runtime-value-depth-audit.md#sharing-pre
|
||||
The [runtime value-size increment](runtime-value-depth-audit.md#runtime-value-size-repair) iterates fixed-array first-element chains with constant state, preserving zero-sized leaves, checked overflow, nominal maximum payloads and the element-before-dynamic-count rule. The previously crashing 32,768-level own.new probe now returns normally with the original one-byte charge; zero authority takes the original failure edge. Deep verified fuel/collection tests, nested-quota AIR/source runs and an independent allocation-size oracle constrain compatibility. Q-060 remains open for output serialization; there is no new normative limit or trap, and Q-059's nominal-query audit remains separate.
|
||||
|
||||
The [runtime value JSON increment](runtime-value-depth-audit.md#runtime-value-json-repair) removes recursive value serialization and bypasses the outer stringify's fixed nesting table for internal payloads. Exact encoding/options, outer-container state, writer/allocation failure and deep returned-payload lifetimes are tested; the formerly failing CLI now emits a complete record in deterministic and hosted profiles. All five confirmed Q-060 failure paths have repairs, without a new limit or trap. Q-060 remains open for closing call-path checks, including the inspection-only cache-free public verification/runtime entry path and its connection to Q-059's uncached nominal queries; no verified failure on that path is claimed yet.
|
||||
|
||||
The [cache-free runtime increment](runtime-value-depth-audit.md#cache-free-runtime-size-query-path) removes the recursive accounted-size fallback available through public verification/runtime entry. All runtime size callers propagate temporary metadata OOM before authority charging, retaining quota, fuel and ownership behavior. The deep query-only failure is independently reproduced and repaired; verified library entry and cache equivalence are separately tested. Q-060 remains open for closing traversal checks and full per-step validation; no new normative limit, trap or diagnostic is introduced.
|
||||
@@ -92,3 +92,9 @@ The verified 32,768-level returned-array programme now produces the complete 65,
|
||||
Validation: all units, format checks, test-extended and the complete current set of 1,791 ordinary conformance cases pass (the prior 1,789-case full run plus the two added cases). Both added cases pass in Debug with collection before every instruction. Forty-four old/new shallow run records are byte-identical. The earlier full Debug per-step collector run ended without a completion result after 785 passing records; its missing process handle and process inventory were checked before starting a replacement full ReleaseSafe run. The replacement retains safety checks and is still in progress; neither incomplete run is counted as a full pass.
|
||||
|
||||
Q-060 remains open for a closing call-path audit. Inspection shows that the public verify wrapper returns diagnostics without replacing the caller's module with verifyModule's derived-cache result, while interp.run accepts a verified module without rebuilding those caches. Runtime nominal size queries can therefore reach the uncached fallback tracked by Q-059. Whether this yields a failure on a verified cache-free library input is unverified; the mixed codec test above is not evidence for that path. No fresh Claude review was available for this increment.
|
||||
|
||||
## Cache-free runtime size-query path
|
||||
|
||||
The [nominal size-query increment](air-type-depth-audit.md#cache-free-nominal-accounted-size-queries) removes the recursive fallback reached by runtime size callers when a public verify caller retains its original module. A direct constructed 32,768-declaration query independently reproduces the old fallback failure and now returns one byte. Parsed, verified cache-free programmes at nominal depths 1,024 and 4,096 run successfully both before and after the repair; no old runtime failure at those depths is claimed. The distinction between query-only and fully verified inputs is retained.
|
||||
|
||||
Runtime queries now pass their host allocator and propagate temporary metadata OutOfMemory before authority charging or result publication. Temporary state is released after each query; arithmetic null, zero-sized content, maximum enum payloads and allocation failure/release rules keep their meanings. A verified quota test compares 54 cached/cache-free outcome pairs (108 runs), including exact fuel boundaries and per-instruction collection. The original verify and run APIs remain usable without derived caches. No normative, bundle, feature, code, trap or accepted-depth change is introduced. Q-060 remains open for the closing traversal audit and additional full per-step validation; Q-059's uncached nominal property queries remain separate work.
|
||||
@@ -433,4 +433,10 @@ The [Q-060 JSON increment](../design/runtime-value-depth-audit.md#runtime-value-
|
||||
|
||||
Units/format checks, test-extended and all 1,791 current ordinary conformance cases pass; the added pair also passes per-step collection in Debug. Forty-four old/new shallow records are byte-identical. The prior full Debug collector run has no completion result (785 passing records); its process disappeared, and a replacement full ReleaseSafe per-step run is in progress, retaining safety checks. No incomplete run is counted as a pass. There is no normative/bundle/feature/code change or new depth limit. Q-060's closing call-path audit and Q-059's uncached nominal queries remain open; the cache-free public runtime entry concern is inspection-only. Phase 6/contract gates remain open. No fresh Claude review was available.
|
||||
|
||||
## Cache-free nominal runtime size queries (2026-10-10)
|
||||
|
||||
The [Q-059 nominal size increment](../design/air-type-depth-audit.md#cache-free-nominal-accounted-size-queries) replaces recursive uncached sizing with temporary explicit continuations. The internal Zig query API now takes a host allocator and propagates metadata OutOfMemory separately from arithmetic overflow; runtime callers propagate it before authority charging. Cached reads, the static metric, quota/release behavior and instruction accounting are unchanged. The old direct 32,768-declaration query aborts; the new query returns one byte. Parsed, verified cache-free programmes at nominal depths 1,024 and 4,096 run successfully before and after, retaining six instructions; no old runtime failure at those depths is claimed.
|
||||
|
||||
Units/format checks, test-extended and all 1,791 ordinary conformance cases pass. Tests compare 7,168 shallow queries with an independent arithmetic oracle, fail every temporary metadata allocation and check cached success/null and partial-cache behavior. Fifty-four cached/cache-free quota/fuel/collection pairs (108 verified runs) have identical outcomes and instruction counts. All 370 public AIR checks preserve exact old/new exit/stdout/stderr. No normative/bundle/feature/code change or depth limit is introduced. The earlier full ReleaseSafe per-step suite remains in progress; Q-059's nominal property queries, Q-060's closing audit and Phase 6/contract gates remain open. No fresh Claude review was available.
|
||||
|
||||
Both new copy cases also pass with collection before every instruction; their shallow sharing-preserving GC behavior is covered separately from the retained deep collector failure.
|
||||
Reference in new issue
Block a user