From 44c798d583eedf1a3bfe5a746481c3243fffb6f3 Mon Sep 17 00:00:00 2001 From: Libby Date: Thu, 12 Nov 2026 02:20:07 +0000 Subject: [PATCH] union-parity: outcomes.msgpack stays main's nine rows; the unit arm is pinned only by its store record The bare extra-slot-unit-arm.msgpack and its outcomes row are deleted: the TS, Python and Rust walkers count outcomes.msgpack exactly, so a shared vector does not grow before their leaf cuts. The unit arm's outcome is the unit-arm row of slot-outcomes.msgpack (record unit-arm of extra-slot-store.cc, Denied2 1/0 at depth 1). The README says so. Co-Authored-By: Claude Opus 5.5 --- .../UnionParityVectorTests.cs | 9 +-------- tests/vectors/union-parity/README.md | 13 +++++++------ .../union-parity/extra-slot-unit-arm.msgpack | 1 - tests/vectors/union-parity/outcomes.msgpack | Bin 563 -> 502 bytes 4 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 tests/vectors/union-parity/extra-slot-unit-arm.msgpack diff --git a/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs b/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs index 067a6cef..9265b2ef 100644 --- a/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs +++ b/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs @@ -297,9 +297,6 @@ namespace GameCult.Caching.Tests Surface(extra: new Extra(RootArm: true))), new Case("extra-slot-list-element.msgpack", "read-only", "Node", 1, "list-element", Surface(extra: new Extra(ListElement: true))), - // A bare UnitOutcome arm (the fixture's unit-arm union), not a UnionSurface payload: [2, [extra]] where Denied2 declares no slot. - new Case("extra-slot-unit-arm.msgpack", "read-only", "UnitOutcome", 2, "unit-arm", - Raw(ArmOf(2, ExtraSlot))), }; private static byte[] OutcomesFile() => Raw((ref MessagePackWriter w) => @@ -320,7 +317,6 @@ namespace GameCult.Caching.Tests "Node" => typeof(Node).FullName!, "Outcome" => typeof(Outcome).FullName!, "CraftedItem" => typeof(CraftedItem).FullName!, - "UnitOutcome" => typeof(UnitOutcome).FullName!, "UnionSurface" => typeof(UnionSurface).FullName!, _ => throw new ArgumentOutOfRangeException(nameof(logical), logical, null) }; @@ -620,10 +616,7 @@ namespace GameCult.Caching.Tests { Assert.That(outcome, Is.EqualTo("read-only"), file); // The extra slot is read past; that the record then loads read-only is asserted in SlotReadOnlyTests, store by store. - if (union == "UnitOutcome") - Assert.That(MessagePackSerializer.Deserialize(payload, UnitOptions), Is.TypeOf(), $"{file}: the extra slot is read past"); - else - Assert.That(Describe(Decode(payload)), Is.EqualTo(golden), $"{file}: the extra slot is read past"); + Assert.That(Describe(Decode(payload)), Is.EqualTo(golden), $"{file}: the extra slot is read past"); } } } diff --git a/tests/vectors/union-parity/README.md b/tests/vectors/union-parity/README.md index 235e2aef..fbf9c6c1 100644 --- a/tests/vectors/union-parity/README.md +++ b/tests/vectors/union-parity/README.md @@ -52,8 +52,8 @@ Rulings `cultlib-gaps:ruling:extra-trailing-slots` and `cultlib-gaps:ruling:slot slot past its reader's declared slots, in any object at any depth, is read, held read-only, and every write or removal of it is refused before anything is staged. The first four payloads are `union-surface.msgpack` with the string `"extra-slot"` appended as one more slot of one object; a reader decodes the value of `union-surface.msgpack` -from each. The fifth is a bare arm of union `UnitOutcome` (0 Waiting `[Message]`; 2 Denied2, -2147483648 Floor2 and -2147483647 Ceiling2, each `[]`), the union of the `unit-arm-*` files; a reader decodes Denied2 from it. +from each. A unit arm with an extra slot is pinned only as a store record, `unit-arm` in `extra-slot-store.cc` +(below): `outcomes.msgpack` keeps the nine rows the leaf walkers count. An object's declared slots are the slots its type's own formatter writes for one instance (for these fixtures, the highest key plus one); a reader derives them from the layout it writes, never from a list of public members. @@ -74,17 +74,18 @@ key (Image's slot 2) does not mark. A union adds no depth: an arm's array is cou | `extra-slot-nested-record.msgpack` | nested-record | Composition `comp` | nested | Composition, 3, 2 | | `extra-slot-arm.msgpack` | arm | the Root Box arm | nested | Box, 3, 2 | | `extra-slot-list-element.msgpack` | list-element | Text `s1`, an element of Use.Slots | nested | Text, 3, 2 | -| `extra-slot-unit-arm.msgpack` | unit-arm | Denied2 in `[2, ["extra-slot"]]` (union `UnitOutcome`, key 2) | as placed | Denied2, 1, 0 | +| record `unit-arm` of `extra-slot-store.cc` | unit-arm | Denied2 in `[2, ["extra-slot"]]` (union `UnitOutcome`, key 2), slot 1 of the document | 1 | Denied2, 1, 0 | | `depth-skipped-at-limit.msgpack` (bounds file) | depth | the document (slot 7, a value of nested arrays) | 0 | UnionSurface, 8, 7 | -Each payload marks exactly one object. Five rows of `outcomes.msgpack` are `read-only` (record, nested-record, arm, -list-element, unit-arm); the sixth `read-only` payload is in `bounds-outcomes.msgpack`. The payload nesting check +Each payload marks exactly one object. Four rows of `outcomes.msgpack` are `read-only` (record, nested-record, arm, +list-element); the fifth `read-only` payload is in `bounds-outcomes.msgpack`, and the unit arm's outcome is its row +in `slot-outcomes.msgpack`. The payload nesting check runs before the mark: `depth-skipped-past-limit.msgpack` is refused, never marked. ### What a runtime asserts for a `read-only` payload Load it as a store record under the reader's own schema id (the C# reference puts each UnionSurface payload in a -`tests.union_surface` store; the unit arm goes in slot 1 of a document `[Name, Outcome: UnitOutcome]`). Then: +`tests.union_surface` store; the unit arm is already a store record, `unit-arm` of `extra-slot-store.cc`). Then: 1. the value is read past the extra slot; 2. the record reports the mark as in the table: the first type read with extra slots, the slots it carried and the diff --git a/tests/vectors/union-parity/extra-slot-unit-arm.msgpack b/tests/vectors/union-parity/extra-slot-unit-arm.msgpack deleted file mode 100644 index 6c780d1d..00000000 --- a/tests/vectors/union-parity/extra-slot-unit-arm.msgpack +++ /dev/null @@ -1 +0,0 @@ -’‘ªextra-slot \ No newline at end of file diff --git a/tests/vectors/union-parity/outcomes.msgpack b/tests/vectors/union-parity/outcomes.msgpack index 217d86c6f70dbb3d62d65b6d263c98fcc034dff0..bbf1a2a0755e5ab3a8e43b245b48d937d2dc797d 100644 GIT binary patch delta 10 RcmdnY@{O5s=0?V^i~ts<1M>g? delta 72 zcmeyyyqSe@)<(v!jJ8vEr&g2{CF&OE