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
@@ -1,7 +1,7 @@
# SDK Linked and bidirectional snapshot capture
Owner: `compiler/pbs`. Linked algorithms belong to executable PBS SDK source.
Multi-object publication, storage, faults, ownership, GC and quotas remain generic
Typed storage, faults, ownership, GC and quotas remain generic
compiler/provider mechanisms. This contract builds on [generic structs](generic-structs-and-free-functions.md),
[arrays and optional](typed-arrays-and-optional-execution.md) and the
[shared Cursor protocol](sdk-list-and-cursor.md#cursor-protocol).
@@ -44,8 +44,8 @@ successor nodes beyond the ends. Nodes and private helpers are not a public API.
| `reverseCursor()` | Cursor<T> | Capture last to first |
Reading, replacing and removing by index require `0 <= i < size`; invalid indices
raise TRAP_OOB even when empty. Insertion accepts size, including zero in an empty
collection. Other insertion indices raise TRAP_OOB. Every valid position contains
raise TRAP_EXPLICIT even when empty. Insertion accepts size, including zero in an empty
collection. Other insertion indices raise TRAP_EXPLICIT. Every valid position contains
an element, so indexed read/removal returns a present optional. Zero and false are
present values. Empty-end results do not suppress type or resource faults.
@@ -56,8 +56,8 @@ Value search/removal is outside this API, consistently with List.
Size is nonnegative long. Indices accept int and long with localized lossless
promotion, without general numeric conversion or truncation. The SDK checks the
current size against the maximum signed long before incrementing, using the generic
logical guard; an unrepresentable next size is rejected before arithmetic or
current size against the maximum signed long before incrementing, using SDK comparisons
and terminal TRAP_EXPLICIT; an unrepresentable next size is rejected before arithmetic or
mutation. Array's u32 structural maximum is not a Linked size limit. Provider
quotas and applicable structural limits can refuse allocation much earlier.
Receiver/arguments evaluate once in source order, including named application.
@@ -83,21 +83,29 @@ work and O(n) additional nodes; next follows one link in O(1). Allocation,
optional-carrier preparation, ownership and eventual GC retain their normal
costs. Repeated indexed reads are not an efficient traversal strategy.
## Complete mutation attempts and lifetime
## Mutation phases and lifetime
Before publication, prepare bounds, next size, candidate nodes, optional results,
all field values and call/operand resources. Private generic FIELDS_PUBLISH
publishes complete field groups of source-selected objects after validating all
receivers and groups. Null destinations represent missing neighbors. Algorithms
select the new head/tail/size and neighbor fields in SDK source; the VM has no
Linked opcode or syscall.
Before the first visible write, prepare bounds, next size, candidate nodes,
optional results and complete field values. Insertion updates previous.next or
head, then next.previous or tail, then length. Removal prepares its result and
neighbors, updates the same two sides, then length. Indexed replacement updates
only value; clear assigns head, tail and length in that order. Source algorithms
own these choices; the VM has no Linked instruction, publication schema or syscall.
No fallible allocation, callback, scheduler or GC boundary may expose partial
publication. A refused mutation preserves all previous head/tail/size values,
elements and neighbor links. This includes optional return preparation for
removals and mutations without new nodes. Individually atomic stores do not prove
whole-operation atomicity. Previously evaluated argument effects are ordinary
source effects and are not rolled back.
A logical rejection or preparation refusal before mutation preserves the previous
head/tail/size, elements and neighbor links. Successful return restores all public
invariants. An internal/resource fault after the first visible write propagates
without rollback: earlier writes may remain and topology/size can be incomplete.
No safe reuse, retry or automatic recovery is promised. This explicitly replaces
the former whole-method refusal guarantee, and is not a basic-consistency claim.
Previously evaluated argument effects remain ordinary source effects.
Individual instruction failures preserve their own entry state. Operand/call/
optional preparation remains charged and can fail; sequential stores are not a
transaction. No user callback or explicit suspension is inserted during updates.
BudgetExhausted and debugger pauses can stop between instructions and resume at
the current PC without completing or undoing the method. Host/debugger observation
is not atomic. No catch, poison flag or recovery API is introduced.
Unpublished candidates follow normal ownership and quotas. Capture failure returns
no partial Cursor and does not change the source. Removal and clear release
@@ -117,11 +125,11 @@ optional-element diagnostics, both Cursor orders/states and mutation independenc
Independently observe all original fields, link carriers, nodes and groups around
quota refusals, including node/result/operand preparation. Exercise ordinary GC
safepoints for removed nodes/values, clear, snapshots and prefix/final release.
Generic publication also requires non-PBS producers and malformed/dead operand
coverage. Regress shared Array/List/generic/contract/Cursor behavior and editor/LSP
Neutral stores/copy/terminal failure also require non-PBS producers and
malformed/dead instruction coverage. Regress shared Array/List/generic/contract/Cursor behavior and editor/LSP
projections. Ship the specification and executable example with installed SDK
knowledge, compile the actual packaged example outside the checkout and execute
its emitted PBX with the production provider.
See [generic Registry/PBX publication](../../general/specs/typed-registry-and-pbx-v0.md)
See [generic Registry/PBX storage](../../general/specs/typed-registry-and-pbx-v0.md)
for the language-neutral instruction contract.