refactor(compiler)!: migrate SDK to minimal storage ISA
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good

Replace retired guards and publication opcodes with SDK checks, neutral TRAP and sequential List/Linked mutations with explicit failure phases. Preserve snapshot cursors and import schema 2 metadata with the delivered provider pin.

Include common/source/installed conformance, debug and release evidence, synchronized specs and the consolidated lesson. Runtime checkout remains unchanged.
This commit is contained in:
2026-10-24 01:35:42 +01:00
parent 77aada6259
commit 632ba6d0d6
51 changed files with 2688 additions and 711 deletions
+64 -54
View File
@@ -226,71 +226,81 @@ The full harness also requires these fixtures. The driver uses an external
runtime checkout without editing its sources or changing PBX, ISA or quotas.
## SDK List, shared Cursor and generic storage
## Minimal storage ISA, SDK collections and phase-aware refusals
Generate the source corpus and the language-neutral storage fixtures, then run:
Generate common/source fixtures and the real installed-JAR examples, then run:
```sh
./gradlew :prometeu-compiler:prometeu-build-pipeline:test :prometeu-architecture-tests:test :prometeu-app:installedKnowledgeTest
python3 tools/pbx-conformance/run.py --runtime ../runtime --list-cursor-only
CARGO_TARGET_DIR=/tmp/studio-pbx-conformance python3 tools/pbx-conformance/run.py --runtime ../runtime
CARGO_TARGET_DIR=/tmp/studio-pbx-conformance python3 tools/pbx-conformance/run.py --runtime ../runtime --release
```
The full harness also requires this corpus. Missing ordinary, optimized, quota,
GC, import/reexport or installed-JAR fixtures fail explicitly. Two synthetic
common-IR programs execute INDEX_GUARD, ARRAY_CHECK_LENGTH, ARRAY_COPY and
STORAGE_PUBLISH through ordinary and optimized producer paths without PBS types.
List source cases cover every mutator, exact growth, logical versus physical
bounds, int/long arguments (including named application), holes, aliases,
vec2/pixel/tuple/Fn/contract/reference groups and every state of a Cursor that remains on its last node.
An independent producer distinguishes some(none) from an empty Cursor.
Focused `--list-cursor-only` and `--linked-only` modes include mandatory neutral
storage/copy/terminal/admission fixtures as well as their collection corpus. The
complete run requires both. No runtime source, manifest, lockfile or target
artifact is modified: the Cargo harness and target live outside that checkout.
Four source-generated mutation fixtures expose explicit before/completed markers.
The harness lowers GuestBytes, HandleSlots, AuxiliaryBytes and TemporaryBytes from
measured setup/success peaks. After each refused attempt it independently observes
all List fields and complete backing groups, including reference generations and
presence tags. Coverage gates require refusals in no-growth publication scratch,
removeAt optional return allocation, candidate allocation, node construction and
operand/frame preparation. Read-only resource diagnostics use non-owning storage
observations outside guest execution; no observation introduces a GC root or write.
The selected provider supports ARRAY_LEN and ARRAY_COPY, ordinary typed stores
and terminal TRAP. Four dead-code fixtures prove that 0xA7/0xA8/0xAA/0xAB reject
at real instruction positions; corresponding Int32-immediate fixtures must load.
All producer-opcode checks decode instruction boundaries rather than scanning
raw PBX bytes. Neutral ordinary/optimized programs qualify stores and copy without
PBS types. A store followed by TRAP_EXPLICIT proves that terminal failure retains
previous effects and source spans survive lowering/optimization.
The controlled safepoint fixture expects 1,200 nodes/objects initially, one after
traversal, one after repeated next on the final node, and zero after releasing the
Cursor. It also requires no live source/snapshot array. Shared payload fields stay
observable; prefix roots and the final payload obey normal reachability and GC.
The installed fixture is compiled by the isolated installDist JVM using the actual
packaged spec/example/SDK, then loaded and executed by this production VM harness.
Eleven paired neutral copy cases independently check scalar/vec2/String groups,
snapshot overlap, empty ranges, bad ranges/receivers, negative/above-u32 counts
and fault precedence. At the actual copy PC, zero budget executes nothing;
positive budget admits a complete attempt with overshoot. N=10/W=1 costs 24,
including receiver/range/scratch refusal; W=2 costs 44. Invalid or empty counts
cost base 4 as defined by the provider. Refusals preserve the five operands and
previous storage, release scratch and do not count a successful step. Native
String owners release with the session. Checked cost-overflow defenses requiring
synthetic internal widths are provider evidence, not an assertion that admitted
consumer layouts can attain those widths.
Evidence prints compiler/provider source hashes, exact provider revision and dirty
state, toolchain, platform/profile, capabilities, every default VM ceiling and each
explicitly lowered refusal limit. Development runs against a dirty provider are
identified as such; final catalog verification requires its clean selected commit.
List source fixtures cover every mutator, exact growth, logical versus physical
bounds, int/long and named evaluation, holes, aliases and complete native/tuple/
Fn/contract/reference groups. Linked fixtures cover empty/single/multiple states,
reciprocal links, nearest-end lookup, complete values and both snapshot orders.
Logical SDK refusals now produce TRAP_EXPLICIT; physical instructions retain
their own faults. No missing ordinary or optimized fixture is silently skipped.
Four List and ten Linked source-generated mutation boundaries have normal and
optimized variants. GuestBytes, HandleSlots, AuxiliaryBytes and TemporaryBytes
ceilings are lowered from measured setup/success peaks. Non-owning diagnostic
observations inspect the original collection objects independently of guest code.
Every instruction prefix is compared with the corresponding successful prefix.
A refused instruction preserves its own observable entry state. Before visible
mutation the entire old collection must remain unchanged; after mutation the
previous successful writes remain, without a whole-method rollback or safe-reuse
claim. Successful single-instruction-budget traversal also qualifies suspension
and resumption in the middle of a source method. Snapshot capture failures must
always preserve their source and expose no partial result.
## SDK Linked and multi-object publication
No-growth insertion prepares a one-slot private array before shifting and copies
that complete stored group into place; candidate/optional/result and operand/
frame preparation remain charged. ARRAY_COPY scratch remains a mandatory observed
refusal. Linked prepares nodes/results before its sequential link updates. The
corpus retains explicit coverage requirements for these resource refusal paths;
it does not rename old publication guarantees as new evidence.
```sh
./gradlew :prometeu-compiler:prometeu-build-pipeline:test :prometeu-architecture-tests:test :prometeu-app:installedKnowledgeTest
python3 tools/pbx-conformance/run.py --runtime ../runtime --linked-only
```
Normal GC safepoints qualify removed nodes and payloads, collection clear,
snapshot independence, consumed-prefix reclamation and sticky final values.
The Cursor fixture requires 1,200 -> 1 -> 1 -> 0 snapshot nodes/payloads, with no
live source/snapshot array. Linked captures must not retain editable source nodes.
The actual installed SDK/spec/example is compiled outside the checkout and its
PBX is loaded/executed by the production VM; import/reexport fixtures also run.
The full harness requires this corpus too. Ordinary and optimized source programs
exercise the complete Linked API, both snapshot orders, empty/single/multiple
states, reciprocal links, identities and full native/tuple/contract/Fn groups,
logical and long bounds, contextual construction and source/named evaluation.
Neutral common-IR fixtures execute FIELDS_PUBLISH without PBS or collection types.
Catalog schema 2 is imported with all 25 fields, per-entry nullable masks,
explicit invocation/scratch/context profiles and cost parameters. Ordinary parity
and rejection tests need no runtime checkout. Explicit exporter verification uses
`tools/runtime-catalog/verify.py` and the selected clean SHA/digests. Nullable
hash.string metadata is qualified independently of older non-nullable String
entries; importing it does not deliver PBS hashing facades or Set/Map.
Ten explicit mutation boundaries qualify every mutation and both captures. The
harness lowers resource ceilings around measured setup/success peaks and compares
all prior Linked roots, optional-link carriers, nodes and complete groups after
each refusal. Node allocation, optional removed-value preparation, snapshot-node
allocation and frame/operand preparation must all produce observed refusals.
Publication itself uses no allocation or scratch; provider tests prove it succeeds
at already exhausted allocation ceilings and rejects late invalid groups before
any write, including for null destinations and aliased targets.
Normal GC safepoints qualify removal/clear without snapshots (1,200 → 1,197 → 0
nodes and payloads), and snapshot traversal (1,200 → 1 → 1 → 0). Fixtures introduce
ordinary garbage pressure so every asserted round performs an actual collection.
Snapshots retain no editable Linked nodes. Source imports/reexports and a separately
compiled installed-JAR example must execute; its forward/reverse traversals retain
final values 22/20 after later replacement and clear. Missing fixtures are failures.
Evidence prints consumer/provider source hashes, selected revision and clean state,
toolchain/platform/profile, lockfile/catalog hashes, capabilities, default ceilings
and lowered refusal limits. Keep new qualification separate from historical List/
Linked evidence; prior successful providers are not relabeled as the new target.