Launch the JavaFX 2 project shell on Java 25 with an interactive viewport, managed Play lifecycle and project mutation guards. Preserve headless/MCP and save compatibility, and qualify exact runtime executable bundles. Separate unit JaCoCo gates from opt-in integration suites and use the internal Pong fixture for the headless visual pilot. Move maintenance and native conformance tools into tooling; retain the VS Code extension and update current navigation links. Validation: tooling make verify passed, including 1064 Studio unit tests, JaCoCo thresholds and 22 headless integration tests.
243 lines
15 KiB
Markdown
243 lines
15 KiB
Markdown
---
|
||
id: LSN-0091
|
||
ticket: pbs-sdk-linked
|
||
title: Private Linked Nodes and Sequential Mutation Phases
|
||
created: 2026-10-23
|
||
tags: [compiler-pbs, collections, snapshot-cursor, failure-phases, runtime-conformance]
|
||
---
|
||
|
||
## Original problem and final result
|
||
|
||
Owner: `compiler/pbs`. Transversal owners: `compiler/general` for neutral IR/PBX
|
||
and the provider for typed storage, faults, ownership, GC and resource accounting.
|
||
DSC-0091 executed accepted DEC-0076 through PLN-0154, covering R1–R12. Their
|
||
workflow control artifacts are disposable; the [Linked specification](../../../docs/specs/compiler-languages/pbs/22.%20SDK%20Linked%20and%20Cursor%20Specification.md)
|
||
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. Source
|
||
algorithms prepare nodes/returns, then use ordinary typed field stores with
|
||
explicit failure phases; node algorithms remain outside the VM.
|
||
|
||
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
|
||
|
||
A Linked contains one present value per private node. Its size counts nodes;
|
||
capacity, holes, reserve, trim, resize and clearAt do not exist. Valid indexed
|
||
reads/removals return a present optional, and invalid indices fault even when
|
||
empty. First/last and their removal operations return none for an empty collection.
|
||
This preserves the accepted API rather than changing return types because a
|
||
particular representation cannot contain holes.
|
||
|
||
Construction is empty and takes no capacity. Explicit and contextual applications
|
||
follow the existing generic struct rules. Directly optional elements are rejected,
|
||
including through grouping, just as in Array/List. An optional collection and an
|
||
otherwise valid element containing optional fields remain valid.
|
||
|
||
The executable API includes size, first/last, bracket read/write, add/addFirst,
|
||
insert, removeAt/removeFirst/removeLast, clear and both capture methods. Adding
|
||
appends, while addFirst prepends. Replacement preserves size; insertion/removal
|
||
changes following logical indices. Read/replace/remove require an index below
|
||
size; insert also accepts size. Long indices are not truncated, int arguments have
|
||
the same localized lossless promotion as List, and growth is checked before signed
|
||
long overflow without inheriting Array's structural size maximum.
|
||
|
||
Preserving inserted object identity is separate from choosing a comparison policy.
|
||
There is no remove(value), generic equality or uniqueness rule in this delivery.
|
||
Repeated occurrences, including repeated references to one instance, remain
|
||
independent sequence positions. List similarly leaves value search/removal outside
|
||
its current contract.
|
||
|
||
## Keep collection topology separate from traversal topology
|
||
|
||
Linked nodes have reciprocal previous/next links. The SDK locates indexed values
|
||
from the nearer end, so search remains O(n) in the worst case; end operations do
|
||
not search. A constant number of link updates does not make indexed access O(1).
|
||
|
||
Snapshot nodes are different objects: private immutable singly linked nodes with
|
||
no circular links or editable source association. Forward capture walks Linked
|
||
backwards and prepends; reverse capture walks it forwards and prepends. Both cost
|
||
O(n) work and additional nodes, and both finish before returning a Cursor.
|
||
|
||
For a source `[20, 22]`, forward starts at 20 and reverse starts at 22. Replacing
|
||
source values, removing elements or clearing the collection cannot change either
|
||
captured sequence. Referenced objects remain shared, so later field mutations
|
||
remain visible. Snapshots preserve occurrences and object identity, not deep copies.
|
||
|
||
The existing state table remains the only traversal protocol:
|
||
|
||
| State | hasNext() | current() | next() |
|
||
| --- | --- | --- | --- |
|
||
| Empty | false | none | No change |
|
||
| Current node has a successor | true | Present current value | Follow successor |
|
||
| Last node, including a singleton | false | Present final value | No change |
|
||
|
||
Process current before testing whether to advance. A hasNext-only loop omits the
|
||
last element; waiting for current to become absent never finishes a nonempty
|
||
snapshot. There is no removal/reset through Cursor.
|
||
|
||
The [distributed example](../../../prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/pbs-knowledge/examples/game/1/src/linked.pbs)
|
||
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 nodes and returns, then update links sequentially
|
||
|
||
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.
|
||
|
||
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.
|
||
|
||
| 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 |
|
||
|
||
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
|
||
|
||
Removal disconnects a node from the collection. Clear removes the collection's
|
||
roots to the whole chain. Unreachable double-link cycles are handled by the normal
|
||
tracing collector; neither operation promises immediate collection or quota return.
|
||
A retained snapshot owns captured values through its own nodes and does not need
|
||
the editable Linked nodes.
|
||
|
||
A controlled fixture uses normal GC safepoints and independent non-owning storage
|
||
observations. With no snapshot, nodes and payloads fall from 1,200 to 1,197 after
|
||
three removals, then to zero after clear. A second fixture clears the source while
|
||
retaining its snapshot: original Linked nodes disappear, captured nodes/items go
|
||
from 1,200/1,200 to 1/1 after traversal, stay at 1/1 after repeated next, and reach
|
||
0/0 after the final Cursor owner is dropped.
|
||
|
||
A safepoint alone does not force this collector to run. The removal/clear fixture
|
||
therefore creates ordinary garbage pressure and asserts that the collection
|
||
counter advances at each observed round. Without that check, a test can mistake
|
||
an uncollected unreachable node for a retention bug. The observer introduces no
|
||
guest root or mutation.
|
||
|
||
## Compiler, tooling and distribution
|
||
|
||
Linked reuses ordinary generic specialization, methods, field groups and imports.
|
||
Origin-checked SDK metadata adds constructor/index integration and the same
|
||
localized int-to-long argument promotion as List. User homonyms or copied
|
||
attributes do not acquire those privileges.
|
||
|
||
Public projections show concrete Linked methods, optional results and source SDK
|
||
locations. They hide head/tail/length, private nodes and storage adapters, including
|
||
the internal nearest-end lookup method. Negative workspace cases reject optional
|
||
elements, capacity construction, unsupported APIs and private access. Invalid
|
||
constructor selection now reports diagnostics instead of throwing from lowering.
|
||
|
||
The normative English spec and example ship with installed knowledge. An isolated
|
||
installDist JVM, outside the checkout, loads the actual JAR resources and compiles
|
||
the Linked example. The production harness executes its emitted PBX and observes
|
||
both completed traversals. Imports/reexports are qualified separately.
|
||
|
||
The full harness also needed its original scalar/input corpus selector to exclude
|
||
the new Linked fixture prefix. Linked cases remain mandatory in their dedicated
|
||
validator; they are not silently treated as older scalar fixtures or skipped.
|
||
|
||
## Current qualification and historical delivery evidence
|
||
|
||
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 |
|
||
| 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 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. 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
|
||
|
||
- 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
|
||
have different mutability and lifetime responsibilities.
|
||
- Keep optional results despite dense positions, and faults distinct from absence.
|
||
- Keep private SDK authority tied to origin through aliases and specialization.
|
||
- Check GC collection counters when asserting reclamation at a safepoint.
|
||
- Record clean provider provenance, explicit lowered limits and mandatory fixture
|
||
counts; metadata defaults or small unit tests alone do not qualify execution.
|
||
|
||
## References and reproduction
|
||
|
||
- [Linked specification](../../../docs/specs/compiler-languages/pbs/22.%20SDK%20Linked%20and%20Cursor%20Specification.md),
|
||
[List/shared Cursor](../../../docs/specs/compiler-languages/pbs/21.%20SDK%20List%20and%20Cursor%20Specification.md),
|
||
[generic structs](../../../docs/specs/compiler-languages/pbs/17.%20Generic%20Structs%20and%20Free%20Functions%20Specification.md)
|
||
and [generic Registry/PBX storage](../../../docs/specs/compiler/25.%20Typed%20Registry%20and%20PBX%20v0%20Specification.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](../../../../tooling/scripts/pbx-conformance/README.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`, 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.
|