docs(discussion): close atomic Registry delivery for PLN-0176 step 36

This commit is contained in:
2026-10-08 08:29:39 +01:00
parent dd3594240e
commit d48978988e
4 changed files with 152 additions and 3 deletions
@@ -0,0 +1,119 @@
---
id: LSN-0059
ticket: program-registry-type-and-function-metadata
title: Registry Boundaries and Owned Values
created: 2026-10-08
tags: [vm, bytecode, registry, ownership, planning]
---
## Context
DEC-0045, accepted from AGD-0061, established an image-owned Type/Function Registry,
typed signatures, PBX v1, compact stored values and bounded resource ownership.
PLN-0176 delivered the independent foundation and its sealed execution path. On
2026-10-08 the user corrected the plan's scope to its originating agenda and
closed that delivery. Coordinated production activation was explicitly received
as future-plan suggestions in AGD-0055. Closing this delivery does not mean the
old production loader or version-0 example generators were migrated.
The normative reference is [Program Registry and PBX v1](../../../docs/specs/runtime/02c-program-registry-and-pbx-v1.md).
The [permanent handoff](../../../docs/vm-arch/registry-producer-handoff.md) records
delivered APIs, producer oracles and pending integration ownership. This lesson
explains published mechanisms; it does not define callable/capture policy.
## Key Decisions and Published Patterns
### Identity, Execution Width and Stored Layout Have Different Jobs
A Registry TypeId identifies a semantic type within an image. Execution still
uses tagged Value slots; storage uses resolved size, alignment, defaults and
ownership maps. A vec2 occupies two Float execution slots and sixteen inline
array bytes. An array of Struct values holds generational references to objects.
Equal native carriers or names do not make semantic types equivalent.
This separation avoids scalar boxing per array element while preserving simple
stack roots. A stored Dynamic slot is larger because it preserves the semantic
tag and payload ownership.
### Publication Is an Ownership Boundary
ValidatedProgramImage::load decodes under bounded work/capacity budgets, resolves
metadata, binds native calls and performs structural/height/type-flow verification
before publishing a shared image. Sessions retain the same immutable Registry,
code, constants and debug owners. Rejected loads restore provisional ownership
counters while attempted work remains charged.
Conformance through that factory proves its behavior, but cannot prove that a
different production entry point already uses it. Keep activation distinct from
the provider API in handoff and validation evidence.
### Complete Groups Prevent Partial Type Checks
Typed CALL/RET/native entry validates ordered parameter/result groups, including
multi-slot values. A trait's receiver and ImplementationId are one group; a
Dynamic tag and payload are another. Validating only one carrier permits malformed
combinations to cross boundaries. Conservative verifier joins may produce Unknown;
runtime checks still validate complete groups before consuming operands or
publishing frames/results.
### String Sharing Requires Domain Ownership
Arc identity shares content, but an Arc alone does not explain which quota owns
it. Image constants and session-created strings have separate Weak ledgers.
Cloning within a domain preserves one allocation charge; equal independently
created content has independent ownership. Cross-session import copies and
accounts content in the destination domain.
Native ValueSnapshot owners retain provenance after the VM closes, while
serialization exports ordinary values. A String field and direct Dynamic field
can share one allocation; removing one storage owner keeps its charge alive until
the last owner disappears and reconciliation releases it. Content reservations
and temporary/result coexistence precede materialization.
### Dynamic Boxes Preserve Existing Receiver Identity
Single-slot Dynamic payloads remain direct. Present multi-slot values use an
immutable, exact-width Value box with Registry identity and TypeId. Copies and
repacking share its handle. Typed-null traits allocate no box. A box is an internal
category rather than a user object or collection receiver.
The real FRAME_SYNC test removes original receiver roots and retains the receiver
only through the operand-stack Dynamic pair and its trait box. Once unpack/POP
removes those roots, permitted GC invalidates both handles. Actual safepoint
execution proves more than constructing a box and checking its contents.
## Evidence and Its Limits
Independent literal PBX fixtures complement writer/reader roundtrips. The named
argument oracle evaluates y before x, records effect order 21, marshals x/y in
signature order and returns 1020. It checks runtime behavior without claiming an
external frontend implementation.
Baseline dd35942 passed 899 workspace tests with zero failures and nine ignored
tests; the two new ignored probes were explicitly run in release. Ownership,
quota rollback, stale handles, exact diagnostics and decoded conversion costs
have focused evidence. [Technical measurements](../../../docs/vm-arch/registry-layout-evidence.md)
record native representation, load high-water capacity and dense/sparse GC behavior.
These observations do not establish process RSS, game headroom or long-run stability.
## Pitfalls
Plan ownership was initially mixed: production migration depended on a callable
contract assigned to another agenda, yet remained a completion gate of the
Registry plan. Moving only the callable opcode step left that dependency in loader
activation, producer regeneration and final audits.
The correction preserves both facts: the foundation is delivered and integration
is pending with a named owner. It transfers exact targets and acceptance to
AGD-0055's future plan. It does not approve that agenda's proposal, weaken the
final PBX contract or label transferred code as executed. Other agendas retain
their own collection/string/stress/game obligations.
## Takeaways
- Keep each plan atomic to its originating agenda and identify integration ownership before execution.
- Distinguish validated publication APIs from activation of every production consumer.
- Treat semantic identity, execution carriers and compact storage as separate contracts.
- Preserve quota provenance for shared native owners and test release at the final owner.
- Use independent bytes and actual safepoints to substantiate boundary behavior.
- Close a user-corrected delivery with explicit handoff; future work belongs to its owner's plan.