docs(pbs): consolidate collection lessons and failure guarantees
This commit is contained in:
+76
-57
@@ -1,9 +1,9 @@
|
||||
---
|
||||
id: LSN-0091
|
||||
ticket: pbs-sdk-linked
|
||||
title: Private Linked Nodes and Atomic Publication
|
||||
title: Private Linked Nodes and Sequential Mutation Phases
|
||||
created: 2026-10-23
|
||||
tags: [compiler-pbs, collections, snapshot-cursor, atomic-publication, runtime-conformance]
|
||||
tags: [compiler-pbs, collections, snapshot-cursor, failure-phases, runtime-conformance]
|
||||
---
|
||||
|
||||
## Original problem and final result
|
||||
@@ -17,14 +17,18 @@ is the durable normative reference.
|
||||
PBS needed a dense sequence with private doubly linked nodes and useful end
|
||||
operations, while preserving the shared snapshot traversal already delivered for
|
||||
List. `linked<T>` now supplies that sequence through executable SDK source.
|
||||
Forward and reverse captures both return the existing Cursor<T> contract. A
|
||||
neutral FIELDS_PUBLISH operation provides complete publication across the collection
|
||||
and its neighbors, without moving node algorithms into the VM.
|
||||
Forward and reverse captures both return the existing Cursor<T> contract. Source
|
||||
algorithms prepare nodes/returns, then use ordinary typed field stores with
|
||||
explicit failure phases; node algorithms remain outside the VM.
|
||||
|
||||
The selected provider is clean commit `57992cf214e8a5f9de53a40dba9aaa7fab038c91`.
|
||||
Studio changes were qualified over base `c410e3500150de5e6d55c1da8f9b22076ca84251`.
|
||||
[Machine-readable evidence](runtime-conformance-evidence.json) records source/PBX
|
||||
hashes, commands, configuration, lowered refusal limits and observed GC states.
|
||||
This lesson was reconciled during AGD89 closure on 2026-10-27 with accepted
|
||||
DEC-0077 / PLN-0155, consolidated in
|
||||
[LSN-0092](../DSC-0096-runtime-storage-isa-consumer-migration/LSN-0092-sequential-collection-mutations-need-explicit-failure-boundaries.md).
|
||||
That migration retired FIELDS_PUBLISH and replaced the original whole-method
|
||||
preservation guarantee. The filename preserves the original delivery's provenance;
|
||||
its atomic-publication wording does not describe today's contract. The original
|
||||
[evidence JSON](runtime-conformance-evidence.json) remains unchanged and is discussed
|
||||
separately as historical evidence below.
|
||||
|
||||
## Dense positions do not change the optional API
|
||||
|
||||
@@ -86,38 +90,35 @@ The [distributed example](../../../prometeu-compiler/frontends/prometeu-frontend
|
||||
captures both orders, then replaces a source element and clears Linked. Both
|
||||
traversals still sum to 42, retaining final values 22 and 20 respectively.
|
||||
|
||||
## Prepare every object before changing any object
|
||||
## Prepare nodes and returns, then update links sequentially
|
||||
|
||||
Insertion can update the collection's head/tail/size and two existing neighbors.
|
||||
Removal also prepares the returned optional value. Separate successful field
|
||||
stores are insufficient: a later allocation or frame/operand refusal could leave
|
||||
half of a neighbor pair updated.
|
||||
Insertion can update head/tail/size and two existing neighbors. Removal also
|
||||
prepares the returned optional value. Prepare bounds, checked next size, candidate
|
||||
nodes, neighbor values and complete groups before visible mutation. This preparation
|
||||
does not make every later instruction infallible: a later allocation or frame/operand
|
||||
refusal can leave a neighbor pair only partly updated.
|
||||
|
||||
The existing range-based STORAGE_PUBLISH operation covered an Array and two
|
||||
fields of one owner. Its guarantee did not automatically extend to Linked.
|
||||
The new generic FIELDS_PUBLISH uses a normal Struct TypeId as a schema: each
|
||||
schema field names one destination Struct type. The stack supplies each nullable
|
||||
destination followed by all its complete field groups. No request object, new
|
||||
Registry category or public preparation token is needed.
|
||||
Logical checks run as PBS comparisons/branches ending in the trusted private
|
||||
TRAP_EXPLICIT binding. Insertion first updates previous.next or head, then
|
||||
next.previous or tail, then length. Removal prepares its result/neighbors and
|
||||
updates those two sides in the same order before length. Indexed replacement
|
||||
changes only value. Clear assigns head, tail and length in that order. These are
|
||||
ordinary typed stores, without a publication schema, compound opcode, callbacks
|
||||
or explicit suspension between updates. Do not reconstruct the whole list on
|
||||
every mutation to simulate the retired mechanism.
|
||||
|
||||
All non-null destinations must have the exact concrete type and live provenance.
|
||||
All supplied value groups are validated, including those paired with a null
|
||||
(skipped) destination. The original operands stay rooted and unconsumed until the
|
||||
whole attempt is admitted. The VM then commits in schema order without allocation,
|
||||
validation, callbacks or GC/scheduler interleaving, and consumes the operands.
|
||||
Repeated destinations have ordered last-write semantics using pre-captured inputs.
|
||||
| Outcome | Current guarantee |
|
||||
| --- | --- |
|
||||
| Rejection/preparation refusal before visible mutation | Old roots, size, payloads and neighbor links survive; argument effects/provisional allocations are not undone |
|
||||
| Successful return | All reciprocal-link, size, group, identity, cleanup and snapshot invariants hold |
|
||||
| Internal/resource fault after visible mutation starts | Earlier stores may remain and topology/size can be incomplete; no rollback, safe reuse, retry or recovery is promised |
|
||||
|
||||
The SDK selects topology and values. It allocates and initializes a private
|
||||
candidate node before publishing an insertion. Removal prepares its optional
|
||||
result first. Private helper bindings lower those source-selected values to the
|
||||
neutral operation. A refusal preserves the old roots, size, values and reciprocal
|
||||
links; already evaluated caller argument effects remain ordinary source effects.
|
||||
|
||||
Publication itself needs no heap object or scratch. This does not make a source
|
||||
mutation allocation-free: optional carriers, candidate nodes, packing and call
|
||||
preparation still have their normal costs. Provider tests execute publication at
|
||||
already exhausted allocation ceilings, preserve native String/reference identity
|
||||
and multi-slot groups, and reject a late invalid group before every shared write.
|
||||
Individual instruction refusal preserves its own entry state, not earlier stores.
|
||||
This is not a basic-consistency guarantee for a faulted method. BudgetExhausted
|
||||
and debugger pauses are resumable instruction boundaries; host observation is
|
||||
not atomic. No catch, poison flag or recovery API is introduced. Candidate nodes,
|
||||
optional carriers, packing and call/operand preparation retain their normal
|
||||
allocation, rooting and quota costs; immediate reclamation is not promised.
|
||||
|
||||
## GC proofs require an actual collection, not only a safepoint
|
||||
|
||||
@@ -162,38 +163,55 @@ The full harness also needed its original scalar/input corpus selector to exclud
|
||||
the new Linked fixture prefix. Linked cases remain mandatory in their dedicated
|
||||
validator; they are not silently treated as older scalar fixtures or skipped.
|
||||
|
||||
## Qualification and limits
|
||||
## Current qualification and historical delivery evidence
|
||||
|
||||
| Gate | Observed result |
|
||||
The current pin is [the catalog revision](../../../docs/vm-arch/runtime-catalog.properties),
|
||||
`dcf6561ea73446e0a3e1cf1c73eda20923b38df0`. The
|
||||
[migration evidence](../DSC-0096-runtime-storage-isa-consumer-migration/runtime-conformance-evidence.json)
|
||||
qualifies source checks, sequential stores and failure phases. Later complete
|
||||
[debug/release evidence](../DSC-0097-pbs-sdk-stack-queue/evidence/README.md) includes
|
||||
the current Linked corpus and both producers. No suites were rerun by this
|
||||
editorial reconciliation.
|
||||
|
||||
The table below records the original delivery on clean provider
|
||||
`57992cf214e8a5f9de53a40dba9aaa7fab038c91`, over Studio base
|
||||
`c410e3500150de5e6d55c1da8f9b22076ca84251`. Its original JSON preserves source/PBX
|
||||
hashes, commands, lowered limits and GC observations unchanged. Compound publication
|
||||
and whole-method refusal results in that evidence were superseded by LSN-0092;
|
||||
they are not current guarantees or current-provider reproduction results.
|
||||
|
||||
| Historical delivery gate | Result on the original pin |
|
||||
| --- | --- |
|
||||
| Full Studio regression | 1,030 tests; no failures/errors; 13 existing skips |
|
||||
| Installed knowledge | Both tests passed, including standalone Linked PBX generation |
|
||||
| Provider bytecode/VM libraries | 6 + 305 passed; 2 existing measurement tests ignored |
|
||||
| Linked source to production VM | 26 cases in each producer mode: 52 passed |
|
||||
| Neutral storage/publication | Four common-IR fixtures executed, including ordinary/optimized FIELDS_PUBLISH |
|
||||
| Whole-operation refusals | 231; all ten mutation/capture boundaries preserved previous source state |
|
||||
| Retired publication fixtures | Four common-IR fixtures, including ordinary/optimized FIELDS_PUBLISH on the original pin |
|
||||
| Original whole-operation refusals | 231; original mutation/capture boundaries preserved previous source state on that pin |
|
||||
| Linked removal/clear GC | 1,200 → 1,197 → 0 → 0 nodes and payloads |
|
||||
| Snapshot GC | 1,200 → 1 → 1 → 0 captured nodes/payloads, with no retained Linked topology |
|
||||
| Imports/installed traversal | Passed; installed forward/reverse final values 22/20 |
|
||||
| Catalogs and canonical mirrors | Clean selected provider; catalog/exporter parity and all four mirrors match |
|
||||
|
||||
The refusal matrix observed GuestBytes, HandleSlots and AuxiliaryBytes refusals.
|
||||
TemporaryBytes was checked against the measured setup/success peaks; no additional
|
||||
peak required a lowered refusal case in this Linked corpus. FIELDS_PUBLISH has no
|
||||
scratch allocation, and the direct provider test proves publication succeeds with
|
||||
TemporaryBytes already capped at current usage. This is not a claim that general
|
||||
source preparation never needs temporary resources.
|
||||
The original refusal matrix observed GuestBytes, HandleSlots and AuxiliaryBytes
|
||||
refusals. TemporaryBytes was checked against its measured setup/success peaks;
|
||||
no additional peak required a lowered refusal case in that historical corpus.
|
||||
The former no-scratch FIELDS_PUBLISH tests belong only to the retired design.
|
||||
Current source preparation, carriers and sequential stores retain normal quota
|
||||
costs and use the phase-specific evidence linked above.
|
||||
|
||||
Qualification used macOS 27.0.1 arm64, Rust 1.98.1/LLVM 22.1.8, the dev runtime
|
||||
profile with resource-diagnostics, capabilities NONE, Gradle 9.3.1 and the Java 21
|
||||
toolchain; the installed JVM was Corretto 21.0.4. No release or cross-platform claim
|
||||
is made. Two pre-existing full-harness response-schema gaps, LifecycleRole and
|
||||
toolchain; the installed JVM was Corretto 21.0.4. That historical run made no
|
||||
release or cross-platform claim; later debug/release qualification is linked
|
||||
separately above. Two pre-existing full-harness response-schema gaps, LifecycleRole and
|
||||
NonFiniteValue, remain explicitly reported with original payloads.
|
||||
|
||||
## Pitfalls to preserve
|
||||
|
||||
- Do not implement a multi-object mutation as a sequence of fallible stores.
|
||||
- Prepare the optional removed-value carrier before publishing the removal.
|
||||
- Prepare values and use source-selected sequential stores with explicit failure
|
||||
phases. Do not claim whole-method atomicity or safe reuse after a later fault.
|
||||
- Prepare the optional removed-value carrier before unlinking the node.
|
||||
- Preserve every field group and native/reference identity, including unchanged
|
||||
payloads when updating neighbor links.
|
||||
- Never expose source nodes to support traversal. Snapshot and collection links
|
||||
@@ -209,15 +227,16 @@ NonFiniteValue, remain explicitly reported with original payloads.
|
||||
- [Linked specification](../../../docs/compiler/pbs/specs/sdk-linked-and-cursor.md),
|
||||
[List/shared Cursor](../../../docs/compiler/pbs/specs/sdk-list-and-cursor.md),
|
||||
[generic structs](../../../docs/compiler/pbs/specs/generic-structs-and-free-functions.md)
|
||||
and [generic Registry/PBX publication](../../../docs/compiler/general/specs/typed-registry-and-pbx-v0.md).
|
||||
and [generic Registry/PBX storage](../../../docs/compiler/general/specs/typed-registry-and-pbx-v0.md).
|
||||
- [SDK source](../../../prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/game/stdlib/1/sdk/collections/main.pbs),
|
||||
[source corpus](../../../prometeu-architecture-tests/src/test/java/p/studio/compiler/backend/irvm/PbsLinkedTest.java),
|
||||
[neutral producer](../../../prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/backend/registry/StoragePublicationPipelineTest.java)
|
||||
and [production harness instructions](../../../tools/pbx-conformance/README.md).
|
||||
- [Provider publication implementation](../../../../runtime/crates/console/prometeu-vm/src/virtual_machine/storage_publication.rs)
|
||||
and [previous List/Cursor lesson](../DSC-0090-pbs-sdk-list/LSN-0090-mutable-lists-and-stable-snapshot-cursors.md).
|
||||
- [Current provider typed storage](../../../../runtime/crates/console/prometeu-vm/src/virtual_machine/collections.rs),
|
||||
[sequential mutation migration](../DSC-0096-runtime-storage-isa-consumer-migration/LSN-0092-sequential-collection-mutations-need-explicit-failure-boundaries.md)
|
||||
and [List/Cursor lesson](../DSC-0090-pbs-sdk-list/LSN-0090-mutable-lists-and-stable-snapshot-cursors.md).
|
||||
|
||||
Run `./gradlew test :prometeu-app:installedKnowledgeTest --console=plain`, followed
|
||||
by `python3 tools/pbx-conformance/run.py --runtime ../runtime`, after selecting the
|
||||
recorded provider. The evidence file retains command/configuration details and
|
||||
R1–R12 traceability after removal of the completed workflow controls.
|
||||
by `python3 tools/pbx-conformance/run.py --runtime ../runtime`, using the current
|
||||
pin and the migration/later evidence for current qualification. The original JSON
|
||||
retains its original provider/configuration and R1–R12 delivery traceability.
|
||||
|
||||
Reference in New Issue
Block a user