Contracts, CHANGELOG, vector README: written-count slots, consent cap, flatten refusal, IsWritable is the write's answer

CHANGELOG Unreleased (org.gamecult.cultlib): Breaking gains the flatten-through-an-unowned-base
refusal, MintElementIds refusing a store holding a marked memory-only record, and the
written-count rule with the [MessagePackFormatter] and unmeasurable-type exclusions; Added
corrects IsWritable. The vector README says what a runtime walks for extra-slot-consent.cc,
the unit-arm record and slot-outcomes.msgpack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-12 00:33:08 +00:00
commit 63911a8db0
4 changed files with 68 additions and 16 deletions

View file

@ -205,8 +205,14 @@ the next write stores it under the writing type's own id and sheds the slots.
A record whose payload carries a slot past the slots its reader declares, at any depth (nested object, list
element, union arm, unit arm), is read-only the same way, whatever id it is stored under. The one consent
is the declaration above, and it reaches only depth-0 slots the schema comparison reports ignored under a
listed compatible id: a mark anywhere else, or at depth 0 under the reader's own id, is not consented to.
`CultCache.IsWritable(key)` answers the same question the staging refusal asks.
listed compatible id, up to the highest slot it reports: a mark anywhere else, past that slot, or at depth 0
under the reader's own id, is not consented to. Declared slots are what the type's own formatter writes; a
type with its own `[MessagePackFormatter]`, or one no instance of which can be written, is not checked.
A flatten of a variant whose base chain holds a record that is not owned is refused with that record's
refusal, because it would write the base's decoded view; the variant's own writes persist only its delta and
stay allowed. A plain write to another key of a value read from a read-only record is a copy this rule does
not police. `CultCache.IsWritable(key)` answers what the staging refusal answers for a removal or a write of
the record's type, read-only and missing home stores included; it does not predict that flatten.
The rule is checked again where the write lands, under the store's lock: a write or removal at a key
whose durable record is not owned, because another writer rewrote it after this cache

View file

@ -119,8 +119,23 @@ served, `CultStoredDocument.UnreadSlots` names the first type read with extra sl
`CultSchemaConflictException` (`UnreadSlots` set; the message names the type and the counts, never a slot
value). A missing trailing slot keeps its default and stays writable; a non-nil value in a retired gap below
the highest key is not extra. Declaring an id compatible consents only to depth-0 slots the schema comparison
reports ignored under that id; any other mark (nested, list element, arm, unit arm, or depth 0 under the
reader's own id) keeps the record read-only whatever is declared.
reports ignored under that id, and only up to the highest slot it reports: a payload carrying a slot past that
one is not consented to. Any other mark (nested, list element, arm, unit arm, or depth 0 under the reader's
own id) keeps the record read-only whatever is declared.
A type's declared slots are the array its own formatter writes for one instance (an uninitialized instance,
else one from a parameterless constructor), never a reflected member list, so a non-public `[Key]` member of
an `AllowPrivate` type counts. Only concrete int-keyed `[MessagePackObject]` types are checked. A type that
names its own `[MessagePackFormatter]` owns its layout and its tolerance and is not checked, and neither is a
type no instance of which can be written (no parameterless constructor and a `[Key]` getter that throws on an
uninitialized one): extra slots in such a type are read past and dropped on the next write, as before.
`Flatten` of a variant writes its base chain's decoded view into a plain record, so it is refused when any
record on that chain is not owned by its home store (a mark nothing explains, or undeclared drift that drops
slots), with that record's own refusal naming its key. Writing or removing the variant itself stays allowed:
it persists only its delta. `CultCache.IsWritable(key)` is the write's own answer for a removal or a write of
the record's type: it is also false when the record's home store is read-only or no attached store is home to
its type. The one write it does not predict is that flatten.
The cache emits a typed migration report with: