Index string provenance with metered image and session tables

This commit is contained in:
2026-10-14 13:55:16 +01:00
parent bb6f212779
commit 3f9d235546
16 changed files with 848 additions and 15 deletions
@@ -109,6 +109,36 @@ 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.
## Index ownership identity without owning content
Provenance is an allocation-identity question, not an equality-of-text question.
The image index sorts the existing Weak records by address and length during
sealed loading. The session index uses a half-full open-addressed table. Both
preserve Arc values and explicit native leases, so ordinary string reads remain
direct and accounting does not keep content alive strongly.
The allocation lifetime matters as much as the key. A Weak prevents the allocator
from recycling an address while its record remains indexed. Remove the key before
dropping that Weak. Tombstones preserve collision chains, and a metered rebuild
removes them without losing live identities. Admit the new capacity and its
coexistence with old storage before moving entries or constructing new strings;
failed admission must leave live owners recognizable and unpublished charges
refunded.
The [release qualification](../../../docs/vm-arch/string-provenance-qualification.md)
measured the existing linear boundary queries before changing them. At 65,536
owners the indexed image took 16–17 comparisons and the session fixtures took
1–2 probes, with no lookup allocation. The tradeoff is explicit: session metadata
rose from about 4 MiB to 10 MiB and setup became more expensive under the same
quotas. This is boundary-work evidence, not a claim of faster game frames.
Synthetic collision keys and work-limit tests complement real-address timings;
allocator-selected address order is not a stable test oracle across loads.
This implementation follows [DEC-0065](../../workflow/decisions/DEC-0065-q8-index-string-provenance-within-existing-quotas.md).
The [published ownership contract](../../../docs/specs/runtime/02c-program-registry-and-pbx-v1.md#memory-ownership-and-quotas)
remains normative; native import, snapshot retention and typed storage tests
verify the same owner lifetimes through the new indices.
## Takeaways
- Keep each plan atomic to its originating agenda and identify integration ownership before execution.