refactor(vm)!: remove publication and logical guard opcodes
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good

Remove INDEX_GUARD, ARRAY_CHECK_LENGTH, STORAGE_PUBLISH and FIELDS_PUBLISH
from decoding, metadata, tooling, verification and execution. Keep ARRAY_LEN
and overlap-safe ARRAY_COPY with complete-group ownership and early charging
of calculable copy work, including refused attempts.

Update specifications, producer handoff, qualification evidence and lessons.
Share collection test support and remove redundant Copy clones for Clippy.

Validation: make ci-domains passed with 1,095 workspace tests, five separately
executed debugger socket tests and all 15 unchanged coverage domain gates.
VM release, resource diagnostics and layer/quality suites also passed.

BREAKING CHANGE: PBX using opcodes 0xA7, 0xA8, 0xAA or 0xAB is rejected,
including unreachable instructions. Consumers must adapt their emission and
collection algorithms or operational guarantees.
This commit is contained in:
2026-10-23 23:37:56 +01:00
parent 69ad1931de
commit dcf6561ea7
27 changed files with 1407 additions and 1013 deletions
+39 -1
View File
@@ -15,6 +15,7 @@ Opcodes are little-endian u16, followed by little-endian u32 immediates. TypeId
| ARRAY_LEN | 0xA4 | TypeId | ref → Int64 length |
| ARRAY_GET | 0xA5 | TypeId | ref, Int64 index → complete element group |
| ARRAY_SET | 0xA6 | TypeId | ref, Int64 index, complete element group → [] |
| ARRAY_COPY | 0xA9 | TypeId | source, sourceStart, target, targetStart, count → [] |
The single-immediate forms are six bytes; field forms are ten. Width is one for scalar/String/color/concrete references, two for vec2/Trait/Dynamic, three for pixel. A Trait contains receiver then ImplementationId; Dynamic contains TypeId then payload. Preserve the whole group, including absent [Null, Null]. ImplementationId zero is valid. GET does not implicitly box; Dynamic copies share immutable boxes. NEW initializes canonical defaults without constructing referenced instances. Arrays have fixed lengths. SDKs implement List, Set and Map algorithms using these runtime capabilities.
@@ -58,7 +59,7 @@ Static bad IDs/categories/fields reject load with typed LOAD_INVALID_REFERENCE c
## Consumer integration and evidence
Consumers must recognize all seven encodings, invoke Registry-derived effects in bounded structural/height/type verification and use validated-image execution. The metadata-free verifier and legacy decoder have been removed. Reuse compact typed storage, default initialization, native ownership maps and generational handles; do not replace them with raw Value arrays or SDK container implementations.
Consumers must recognize all eight encodings, invoke Registry-derived effects in bounded structural/height/type verification and use validated-image execution. The metadata-free verifier and legacy decoder have been removed. Reuse compact typed storage, default initialization, native ownership maps and generational handles; do not replace them with raw Value arrays or SDK container implementations.
Executable oracles live in bytecode `tests/registry_isa.rs`, VM `tests/collection_conformance.rs`, VM `virtual_machine/collections_tests.rs` and layer `tests/typed_collections.rs`. They cover independent bytes, default/alias/group operations, attempt costs and refusals, malformed/proven types, ownership and actual FRAME_SYNC graph reclamation. VM unit tests inject otherwise unreachable invalid state only inside tests. Optimized ownership/conformance runs complement debug evidence.
@@ -70,3 +71,40 @@ never invokes callbacks. Threshold GC runs at FRAME_SYNC and successful last-roo
RET after rooting results. Quota refusal cannot invoke rescue GC.
The published patterns and validation limits are explained in [Collection Attempts Preserve Groups and Charge Work Before Publication](../../discussion/lessons/DSC-0051-game-state-collections-and-objects/LSN-0060-collection-attempts-preserve-groups-and-charge-work-before-publication.md).
## Range-copy migration contract
ARRAY_LEN stays 0xA4. ARRAY_COPY is six bytes: `A9 00 04 03 02 01` for encoding
oracle TypeId 0x01020304. Actual execution needs an existing exact Array descriptor.
The five operands use Int64 offsets/count and exact Array receivers. Physical
ranges are strict; an empty range may start at length. Copy snapshots complete
source groups before writing, preserving tags, native owners and identity under
overlap without boxing. Reserve complete TemporaryBytes scratch first; release it
on success/failure. Failed attempts preserve operands/storage; no request token,
guest object, callback, GC or scheduler occurs inside the instruction.
For available five temporary operands and exact Int64 count N in 0..u32::MAX,
precharge representable C=4+2*N*W before receiver/range/group validation or scratch
reservation. Retain it on refusal: N=10/W=1 costs 24 for success, bad receiver,
bad range or scratch quota. Other counts/underflow cost base 4 with normal fault
order. Checked cost overflow costs 4 and traps SizeOverflow before ordinary
validation. Empty copies validate receivers/ranges and cost 4; aliases give no
discount. See the [copy contract](../specs/runtime/02-vm-instruction-set.md#typed-array-range-copy)
for exact precedence. Positive budget admits the full attempt with overshoot;
Trap wins on refusal and only successful steps count. Zero budget does no work.
Encodings 0xA7, 0xA8, 0xAA and 0xAB are unsupported in actual instruction
positions, including dead code. They are not remapped or emulated. Producers
must remove their emission, adapt logical checks/error paths and re-evaluate
algorithms, representations and collection guarantees. Sequential stores do not
preserve the former multi-owner publication guarantee. Prepare fallible values
before mutation and explicitly define the remaining source contract.
Compiler/SDK migration, provider pinning/catalog import and source/optimized/
installed-resource conformance belong to the consumer. Prior List/Linked evidence
qualifies earlier providers only. Identity/hash catalog schema 2 import is a
separate consumer dependency, not a storage or new-collection implementation here.
See `virtual_machine/array_copy_tests.rs` and collection/Registry conformance for
current executable oracles. Qualification provenance is recorded in
[storage qualification](STORAGE_QUALIFICATION.md); an uncommitted implementation
must not be attributed to an earlier committed provider SHA.