Keep PBX at v0 and simplify Jenkins quality gate
Intrepid/Prometeu/Runtime/pipeline/pr-master There was a failure building this commit

This commit is contained in:
2026-10-14 14:35:44 +01:00
parent 39468740c3
commit a2275932a5
51 changed files with 155 additions and 297 deletions
@@ -160,9 +160,9 @@ Primary cause:
enemy.updateAI(): 1,012 cycles
```
## Program Registry v1 integration
## Program Registry integration
The [Dynamic/reference instruction table](02c-program-registry-and-pbx-v1.md#dynamic-and-reference-instructions) specifies fixed costs of 8/4/3/4/4/5/4 cycles for opcodes 0x0090–0x0096. Each decoded attempt charges once, including a trap. Input retains the existing one-cycle INTRINSIC rule. Load work quotas are deterministic analysis units, not execution cycles or a wall-clock timeout.
The [Dynamic/reference instruction table](02c-program-registry-and-pbx-v0.md#dynamic-and-reference-instructions) specifies fixed costs of 8/4/3/4/4/5/4 cycles for opcodes 0x0090–0x0096. Each decoded attempt charges once, including a trap. Input retains the existing one-cycle INTRINSIC rule. Load work quotas are deterministic analysis units, not execution cycles or a wall-clock timeout.
## Collection Attempt Charging
+3 -3
View File
@@ -129,9 +129,9 @@ The PVM is:
- single execution context; retired SPAWN/YIELD/SLEEP are rejected;
- embedded inside the larger PROMETEU console model, not equal to it.
## Program Registry v1 integration
## Program Registry integration
[Program Registry and PBX v1](02c-program-registry-and-pbx-v1.md) defines typed immediate domains, opcodes 0x0090–0x0096, complete multi-slot groups and conservative type-flow verification. Unknown facts require runtime validation and do not alone reject an otherwise valid join. Opcode bytes remain u16; TypeId immediates are u32 little-endian.
[Program Registry and PBX v0](02c-program-registry-and-pbx-v0.md) defines typed immediate domains, opcodes 0x0090–0x0096, complete multi-slot groups and conservative type-flow verification. Unknown facts require runtime validation and do not alone reject an otherwise valid join. Opcode bytes remain u16; TypeId immediates are u32 little-endian.
## Typed Collection Instructions
@@ -154,7 +154,7 @@ STRUCT operations require a Struct descriptor; ARRAY operations require an Array
After charging the attempt, incomplete temporary operands trap with STACK_UNDERFLOW. Instance operations check receiver carrier, absence, liveness/generation, category, Registry and exact TypeId first; array access then checks exact Int64 index and bounds; SET checks the complete value group last. There is no numeric, Trait or Dynamic coercion. Negative lengths or indices and indices at/above length trap with OOB (0x03); wrong carriers/types/groups trap with TYPE (0x04); absent receivers with NULL_REFERENCE (0x0E); invalid/dead/stale handles with INVALID_HANDLE (0x0F). Positive lengths above u32, checked size/cost overflow, resource quotas and recoverable allocation failures trap with RESOURCE_LIMIT (0x10), preserving resource reason/requested/limit. Static invalid TypeIds/categories/fields produce LOAD_INVALID_REFERENCE; proven stack/type conflicts produce LOAD_INVALID_CODE. Runtime TrapInfo preserves the attempted PC, opcode and available source span.
Publication and ownership follow [typed collection memory](03-memory-stack-heap-and-allocation.md); charging follows [time and cycles](01-time-model-and-cycles.md). See the [producer handoff](../../vm-arch/collection-producer-handoff.md) for independent byte oracles and construction examples. Production consumers must enter through the validated PBX v1 image boundary described in [Program Registry](02c-program-registry-and-pbx-v1.md).
Publication and ownership follow [typed collection memory](03-memory-stack-heap-and-allocation.md); charging follows [time and cycles](01-time-model-and-cycles.md). See the [producer handoff](../../vm-arch/collection-producer-handoff.md) for independent byte oracles and construction examples. Production consumers must enter through the validated PBX v0 image boundary described in [Program Registry](02c-program-registry-and-pbx-v0.md).
Typed callable instructions are MAKE_CLOSURE `(FunctionId,FnTypeId)`, CALL_CLOSURE `(FnTypeId)`, GET_CAPTURE `(index)` and CALL_TRAIT `(TraitTypeId,method_index)`. Their groups, encodings and attempted costs are defined in the [Fn contract](02b-vm-function-values-and-closures.md). Numbers 0x54–0x56 stay reserved and reject anywhere at load.
@@ -128,7 +128,7 @@ Verifier decodes every function range, validates instruction boundaries/IDs/jump
Use a bounded worklist to fixed point, reprocessing widened states; decide state-dependent type errors after convergence so visitation order cannot cause rejection. Signature contracts suffice for calls; no interprocedural body inference is required. Partial group mutation invalidates relational facts. Unknown is not proof of compatibility and does not alone reject code: retain complete runtime checks. Type knowledge alone does not eliminate null/generation/bounds checks. CALL_CLOSURE uses expected FnTypeId to establish parameter/result groups even for unknown concrete targets. GET_CAPTURE accesses typed metadata of the enclosing function; environment is retained by CallFrame without hidden arg0. Known mismatch rejects, Unknown retains runtime checks. Exceeding memory/work budget rejects loading, never skips verification.
Builtin IDs, exact slot carriers, nullable defaults and stored layouts are defined in [Program Registry and PBX v1](02c-program-registry-and-pbx-v1.md#values-storage-and-initialization). A fixed list of results does not imply a tuple object or boxing. Parameter names are optional signature metadata; frontend argument reordering must preserve source evaluation order.
Builtin IDs, exact slot carriers, nullable defaults and stored layouts are defined in [Program Registry and PBX v0](02c-program-registry-and-pbx-v0.md#values-storage-and-initialization). A fixed list of results does not imply a tuple object or boxing. Parameter names are optional signature metadata; frontend argument reordering must preserve source evaluation order.
## Finite Float and explicit math conversions
@@ -33,7 +33,7 @@ private typed Struct cells with ordinary field operations, common to creator and
closures. Another factory can allocate another cell. No Cell category or
SET_CAPTURE is introduced; language lowering belongs to each frontend.
PBX v1 MUST include exactly one captures section, kind 8: little-endian
PBX v0 MUST include exactly one captures section, kind 8: little-endian
`function_count:u32`, then per FunctionId `capture_count:u32` and ordered capture
TypeIds:u32. Outer count equals the function table; empty lists are explicit.
Offsets/widths/maps derive at load. Records, capacities and graph work use existing
@@ -99,7 +99,7 @@ Optional SystemOS lifecycle entry uses Registry roles and the controlled boundar
described below; it does not introduce arbitrary native reentry.
See [memory](03-memory-stack-heap-and-allocation.md),
[Registry/PBX](02c-program-registry-and-pbx-v1.md) and
[Registry/PBX](02c-program-registry-and-pbx-v0.md) and
[host ABI](16-host-abi-and-syscalls.md).
## Random core integration
@@ -109,7 +109,7 @@ See [memory](03-memory-stack-heap-and-allocation.md),
## System-owned lifecycle entry
Optional zero-argument, zero-result, capture-free lifecycle targets are bound by
[Registry roles](02c-program-registry-and-pbx-v1.md#optional-lifecycle-roles).
[Registry roles](02c-program-registry-and-pbx-v0.md#optional-lifecycle-roles).
They are ordinary functions called through a controlled SystemOS boundary, not
closure values or replacement boot entries. The boundary retains the existing
stacks and roots, appends its frame, and returns to SystemOS immediately on outer
@@ -1,9 +1,9 @@
# Program Registry, Typed Values and PBX v1
# Program Registry, Typed Values and PBX v0
Domain: VM program metadata, binary format, typed storage and resource boundaries
Function: normative
The production loader, internal producers and runtime examples use this sealed v1 contract. Typed Fn and frame environments follow [the function-value contract](02b-vm-function-values-and-closures.md); retired coroutine instructions reject at load. No provisional untyped reference is authorized.
The production loader, internal producers and runtime examples use this sealed v0 contract. Typed Fn and frame environments follow [the function-value contract](02b-vm-function-values-and-closures.md); retired coroutine instructions reject at load. No provisional untyped reference is authorized.
Didactic companion: [Registry Boundaries and Owned Values](../../../discussion/lessons/DSC-0058-program-registry-type-and-function-metadata/LSN-0059-registry-boundaries-and-owned-values.md).
@@ -21,9 +21,11 @@ The requirements below use MUST/MUST NOT semantics. The Registry owns type/funct
- Parameter names are optional signature metadata independent of debug. Frontends reorder named arguments to signature order while preserving source evaluation order, using temporaries. Mixing/default-argument syntax and diagnostics stay with frontends; optional/default parameters are not implicitly introduced.
- Trait implementations are unique per (Struct, Trait), complete, immutable and ordered by method index. Explicit parameter/result TypeIds, order and arity match exactly; the implementation function has its concrete receiver as first parameter. No variance or implicit adaptation: frontend adapter functions may satisfy the exact signature. CALL_TRAIT resolves TraitTypeId/method index through this immutable table; targets have empty captures and receive concrete receiver first, never ImplementationId as an argument.
## PBX v1 encoding
## PBX v0 encoding
PBX v1 only: magic `PBX\0`, little-endian, 32-byte header, zero reserved bytes and directory triples `(kind:u32, offset:u32, length:u32)`. Preserve existing non-Registry section encodings except expressly required changes. Reject unsupported versions, unknown/duplicate/missing sections, overlap, overflow, truncation and trailing table bytes. Section Code is raw instructions without a count prefix.
The format remains in development at version 0; changes to the current schema do not imply a version bump or compatibility with earlier development layouts.
PBX v0 only (u16 version at offset 4 MUST be zero): magic `PBX\0`, little-endian, 32-byte header, zero reserved bytes and directory triples `(kind:u32, offset:u32, length:u32)`. Preserve existing non-Registry section encodings except expressly required changes. Reject unsupported versions, unknown/duplicate/missing sections, overlap, overflow, truncation and trailing table bytes. Section Code is raw instructions without a count prefix.
| Kind | Section | Presence |
| --- | --- | --- |
@@ -42,7 +44,7 @@ The fixed header is:
| Byte offset | Encoding | Meaning |
| --- | --- | --- |
| 0 | four bytes | `PBX\0` |
| 4 | u16 | version 1 |
| 4 | u16 | version 0 |
| 6 | u8 | endianness 0 (little-endian) |
| 7 | u8 | reserved, zero |
| 8 | u32 | section count |
@@ -103,7 +105,7 @@ are not the binding mechanism.
Pause/resume hooks may be absent. MemcardBoot is required for a cartridge with
the memcard capability and is invoked only at its explicit bootstrap gate.
Additional roles require a future contract; there is
no termination role. PBX remains version 1, with no old-layout fallback or
no termination role. PBX remains version 0, with no old-layout fallback or
external-artifact compatibility. Producers MUST regenerate their images and
emit this byte for every function, including zero for ordinary functions.
Frontend compilers choose their own source syntax and lower it to these roles.
@@ -303,4 +305,4 @@ precedence, conversions, catalog metadata and producer examples.
## Random core integration
[Random](02e-vm-owned-random-core.md) adds BuiltinId 0x0016 and intrinsic IDs 0x4000–0x4003 using existing PBX v1 encoding. Registry categories remain unchanged; unsupported identities are rejected, without fallback.
[Random](02e-vm-owned-random-core.md) adds BuiltinId 0x0016 and intrinsic IDs 0x4000–0x4003 using existing PBX v0 encoding. Registry categories remain unchanged; unsupported identities are rejected, without fallback.
@@ -6,7 +6,7 @@
It occupies one execution slot: present values use `Value::HeapRef`; the default
is `Value::Null`. Typed storage uses index:u32 and generation:u32, eight bytes
aligned to eight, with GuestReference ownership. Registry categories remain
Builtin, Struct, Array, Trait and Fn. PBX v1 encoding is unchanged.
Builtin, Struct, Array, Trait and Fn. PBX v0 encoding is unchanged.
ObjectKind::Random has tag 9; DynamicBox remains 8 and tag 6 remains reserved.
Its private logical payload is State:u128 and Inc:u128, 32 bytes with no child
@@ -131,7 +131,7 @@ generator state and prior owners, releases provisional resources and publishes
no partial handle. range draws on private candidate state and rolls it back
on any fault, including the rejection limit. Executed cycles are not refunded.
Loader/verifier recognize Random and all signatures without changing PBX v1.
Loader/verifier recognize Random and all signatures without changing PBX v0.
Unknown intrinsic IDs, including unreachable ones, use LOAD_INVALID_CODE/NativeId;
runtime INVALID_INTRINSIC is invariant defense. Invalid Registry IDs/signatures
retain existing categories. Unknown type analysis requires full runtime checks.
@@ -161,7 +161,7 @@ claim unexecuted host comparisons. CPU benchmarks do not set virtual costs.
Frontend and reference-game integration consume the published contract through
separate handoffs. Local core completion does not require those implementations
or acquisition of hardware. See [numeric semantics](02d-gameplay-math-and-numeric-semantics.md),
[Registry/PBX](02c-program-registry-and-pbx-v1.md),
[Registry/PBX](02c-program-registry-and-pbx-v0.md),
[memory](03-memory-stack-heap-and-allocation.md) and
[cycles](01-time-model-and-cycles.md).
@@ -199,9 +199,9 @@ Any violation results in a trap or rejected program image.
- [`08-save-memory-and-memcard.md`](08-save-memory-and-memcard.md) defines save storage outside VM heap ownership.
- [`16a-syscall-policies.md`](16a-syscall-policies.md) defines host-root rules and host/heap interaction policy.
## Program Registry v1 integration
## Program Registry integration
[Program Registry and PBX v1](02c-program-registry-and-pbx-v1.md#values-storage-and-initialization) specifies compact typed layouts, defaults, native String/Dynamic ownership and generational handles. Its [memory quotas](02c-program-registry-and-pbx-v1.md#memory-ownership-and-quotas) apply jointly before allocation. Registry metadata is immutable image-owned native memory, outside guest GC. Stack/local execution retains Value.
[Program Registry and PBX v0](02c-program-registry-and-pbx-v0.md#values-storage-and-initialization) specifies compact typed layouts, defaults, native String/Dynamic ownership and generational handles. Its [memory quotas](02c-program-registry-and-pbx-v0.md#memory-ownership-and-quotas) apply jointly before allocation. Registry metadata is immutable image-owned native memory, outside guest GC. Stack/local execution retains Value.
## Typed Array and Struct Storage
+1 -1
View File
@@ -84,7 +84,7 @@ Input.pad().up().hold()
Input.touch().x()
```
Source syntax MUST lower directly to one fixed zero-argument query; pad/touch/button are catalogue prefixes, not guest values. Endpoints cannot be stored or passed, even transiently. The complete 54-query table and removed IDs are specified in [Program Registry input](02c-program-registry-and-pbx-v1.md#input). Unknown IDs are invalid intrinsics; a known unavailable query raises TRAP_UNAVAILABLE (0x11), never a fabricated false/zero.
Source syntax MUST lower directly to one fixed zero-argument query; pad/touch/button are catalogue prefixes, not guest values. Endpoints cannot be stored or passed, even transiently. The complete 54-query table and removed IDs are specified in [Program Registry input](02c-program-registry-and-pbx-v0.md#input). Unknown IDs are invalid intrinsics; a known unavailable query raises TRAP_UNAVAILABLE (0x11), never a fabricated false/zero.
## 6 Determinism and Replay
+1 -1
View File
@@ -172,4 +172,4 @@ Every PROMETEU game that uses TOUCH:
## Fixed query catalogue
Touch button queries occupy 0x2130–0x2133 (pressed/released/down/hold); x/y use 0x2134/0x2135. All have zero arguments and read the frame snapshot. Button states return Bool; hold and coordinates return Int64. See the [complete input contract](02c-program-registry-and-pbx-v1.md#input).
Touch button queries occupy 0x2130–0x2133 (pressed/released/down/hold); x/y use 0x2134/0x2135. All have zero arguments and read the frame snapshot. Button states return Bool; hold and coordinates return Int64. See the [complete input contract](02c-program-registry-and-pbx-v0.md#input).
@@ -352,6 +352,6 @@ All machine diagnostics and profiling data:
- do not require a guest-visible debug ABI;
- are consistent regardless of whether host diagnostics are active or not.
## Program Registry v1 integration
## Program Registry integration
Loader diagnostics MUST preserve the [structured load tags, reasons and context](02c-program-registry-and-pbx-v1.md#errors-and-publication). Signature names remain available independently of debug data; names do not establish identity. Tools must distinguish image Registry, guest heap, native strings, auxiliary execution state and temporary quotas rather than reporting their sum as RSS.
Loader diagnostics MUST preserve the [structured load tags, reasons and context](02c-program-registry-and-pbx-v0.md#errors-and-publication). Signature names remain available independently of debug data; names do not establish identity. Tools must distinguish image Registry, guest heap, native strings, auxiliary execution state and temporary quotas rather than reporting their sum as RSS.
@@ -175,8 +175,8 @@ structured faults, progress on partial failure and retained desktop run/debug.
Neither Studio UI nor an AI model is required. See `tests/automation_process.rs`
in prometeu-cli and the in-process deterministic-control tests in the headless crate.
## Program Registry v1 integration
## Program Registry integration
When exposing initialization failures, retain the [structured load error](02c-program-registry-and-pbx-v1.md#errors-and-publication) code, typed reason and available context. Human-readable messages are not a parsing contract; a load error has no fabricated runtime PC. Failed loads must not publish executable sessions. Existing protocol request names and transport behavior are unchanged.
When exposing initialization failures, retain the [structured load error](02c-program-registry-and-pbx-v0.md#errors-and-publication) code, typed reason and available context. Human-readable messages are not a parsing contract; a load error has no fabricated runtime PC. Failed loads must not publish executable sessions. Existing protocol request names and transport behavior are unchanged.
Heap reference inspection values use `{"kind":"heap_ref","value":{"index":u32,"generation":u32}}`. Both components are required to distinguish a live incarnation from a reused slot; the wire representation must not truncate handles to indices. Inspection does not grant cross-session transfer authority.
+2 -2
View File
@@ -229,9 +229,9 @@ The cartridge spec therefore distinguishes:
- [`14-boot-profiles.md`](14-boot-profiles.md) defines cartridge selection at boot.
- [`15-asset-management.md`](15-asset-management.md) defines the `assets.pa` envelope, asset table semantics, preload lifecycle, and residency semantics.
## Program Registry v1 integration
## Program Registry integration
Program payloads MUST use the PBX v1 envelope and mandatory sections defined in [Program Registry and PBX v1](02c-program-registry-and-pbx-v1.md#pbx-v1-encoding). The file limit is 64 MiB and Code is limited to 32 MiB. Unsupported versions are rejected; runtime examples are regenerated rather than converted by a compatibility loader. The existing func_id = 0 boot authority is unchanged.
Program payloads MUST use the PBX v0 envelope and mandatory sections defined in [Program Registry and PBX v0](02c-program-registry-and-pbx-v0.md#pbx-v0-encoding). The file limit is 64 MiB and Code is limited to 32 MiB. Unsupported versions are rejected; runtime examples are regenerated rather than converted by a compatibility loader. The existing func_id = 0 boot authority is unchanged.
## Fn Execution Boundary
@@ -372,9 +372,9 @@ Only user-defined functions and closures are first-class.
- [`08-save-memory-and-memcard.md`](08-save-memory-and-memcard.md) defines persistent save-domain semantics.
- [`02a-vm-values-and-calling-convention.md`](02a-vm-values-and-calling-convention.md) defines the slot/call philosophy reused by the syscall ABI.
## Program Registry v1 integration
## Program Registry integration
Native boundaries MUST respect the [Registry typed-value and ownership contract](02c-program-registry-and-pbx-v1.md): exact carriers and complete groups, generational reference validation, string provenance and preallocation quotas. Existing SYSC binding errors remain structured and separate from Registry errors. Input consists of 54 VM-owned fixed queries, never endpoint objects or host syscalls.
Native boundaries MUST respect the [Registry typed-value and ownership contract](02c-program-registry-and-pbx-v0.md): exact carriers and complete groups, generational reference validation, string provenance and preallocation quotas. Existing SYSC binding errors remain structured and separate from Registry errors. Input consists of 54 VM-owned fixed queries, never endpoint objects or host syscalls.
## Fn Execution Boundary
+1 -1
View File
@@ -78,7 +78,7 @@ In the current state, no chapter under the active `docs/specs/runtime/` root is
| [`02-vm-instruction-set.md`](02-vm-instruction-set.md) | VM subsystem overview | normative |
| [`02a-vm-values-and-calling-convention.md`](02a-vm-values-and-calling-convention.md) | VM values and calling convention | normative |
| [`02b-vm-function-values-and-closures.md`](02b-vm-function-values-and-closures.md) | VM closures and function values | normative |
| [`02c-program-registry-and-pbx-v1.md`](02c-program-registry-and-pbx-v1.md) | Registry, typed storage, PBX v1 and quotas | normative |
| [`02c-program-registry-and-pbx-v0.md`](02c-program-registry-and-pbx-v0.md) | Registry, typed storage, PBX v0 and quotas | normative |
| [02d-gameplay-math-and-numeric-semantics.md](02d-gameplay-math-and-numeric-semantics.md) | VM math, numeric faults, cycles and consumer examples | normative |
| [`03-memory-stack-heap-and-allocation.md`](03-memory-stack-heap-and-allocation.md) | VM memory model | normative |
| [`04-gfx-peripheral.md`](04-gfx-peripheral.md) | virtual hardware: graphics | normative |