From a4600ac09811adf7e08e3c0a3d81c6547347681a Mon Sep 17 00:00:00 2001 From: Libby Date: Thu, 12 Nov 2026 19:52:34 +0000 Subject: [PATCH] cultcache-py: pin the variant row of extra-slot-store.cc as a refused store Settles py-store-reads-variant-row by ruling: this runtime refuses a five-slot persisted record whole and does not carry variants; the single flattenRefusedBy row is the one it cannot walk. Co-Authored-By: Claude Sonnet 5.5 --- .../cultcache-py/tests/test_slot_readonly.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/cultcache-py/tests/test_slot_readonly.py b/packages/cultcache-py/tests/test_slot_readonly.py index 77d4a989..68e389f3 100644 --- a/packages/cultcache-py/tests/test_slot_readonly.py +++ b/packages/cultcache-py/tests/test_slot_readonly.py @@ -16,6 +16,7 @@ from cultcache_py import ( SlotCodec, SchemaConflictError, SingleFileMessagePackBackingStore, + StoreUnreadableError, UnionArm, UnreadSlots, database_entry_field, @@ -178,6 +179,22 @@ class StoreRowTests(unittest.TestCase): return slot_unit_document return declaring_document if store == "extra-slot-consent.cc" else surface_document + def test_the_variant_row_is_refused_as_a_store_not_walked_and_the_rest_of_the_store_reads_without_it(self) -> None: + # This runtime holds no variant records (ruling: refuse, not carry; the reference's marked-variant row, the one + # row with a flattenRefusedBy, is the C# reader's). A five-slot persisted record makes the whole store + # unreadable, the file is left as it was, and the store without exactly that row reads. + variants = [row for row in _rows() if row[8] is not None] + self.assertEqual([(row[0], row[1], row[8]) for row in variants], [("extra-slot-store.cc", "marked-variant", "marked")]) + path = self.tmp / "extra-slot-store.cc" + shutil.copyfile(VECTORS / "extra-slot-store.cc", path) + before = path.read_bytes() + with self.assertRaises(StoreUnreadableError): + _open(path, surface_document, slot_unit_document) + self.assertEqual(path.read_bytes(), before) + _, cache = self._store("extra-slot-store.cc") + self.assertIsNone(cache.get(surface_document, "marked-variant")) + self.assertIsNotNone(cache.get(surface_document, "marked")) + def test_every_row_is_writable_exactly_where_the_vector_says_and_refuses_with_its_mark(self) -> None: walked = 0 for store, key, writable, explained, type_name, carried, declared, occurrences, flatten in _rows(): -- 2.47.3