Thing 2.0 cut 4b: committed provider-state stores, fixture README rows, the contract crate docs name the stack hazard

This commit is contained in:
Meta Vens 2026-11-28 02:32:41 +01:00
commit 12da48c2dc
4 changed files with 12 additions and 1 deletions

View file

@ -8,6 +8,12 @@
//! `Deserialize` (CultCache's `DatabaseEntry` requires it). The domains therefore live in the
//! field types (`Seq`, `Version`, `Count`, `Segment`), whose `Deserialize` calls the same
//! `new` the constructors call, so no door skips a check.
//!
//! Stack hazard: `Node` nests without a bound of its own, and serde's `Deserialize` recurses
//! once per level, so a hostile payload nested deep enough overflows the stack of a caller that
//! decodes it directly. CultCache refuses such a payload on read and on write
//! (`cultcache_rs::check_payload_depth`, 256 containers); a caller that decodes bytes outside a
//! CultCache must run that check first.
mod asset;
mod command;

View file

@ -20,6 +20,8 @@ frozen, and a normal test run only compares and reads them. The rows are the fix
| `f11-deep.surface.cc` | One surface: the deepest Box chain whose payload CultCache's `check_payload_depth` accepts, found by the builder | - |
| `f11-deep-refused.bin` | The payload of the same chain one Box level deeper, raw: `check_payload_depth` refuses it at depth 257 and so does CultCache. No store can hold it | - |
| `f12-text-edge.surface.cc` | One surface of five Text nodes: bidi (Hebrew and Arabic in Latin), CJK wide characters, combining marks, emoji ZWJ sequences, and a paragraph long enough to wrap | - |
| `state-swarm.state.cc` | Provider state, not contract documents: f01's four swarm records (`summary`, `mind-1`..`mind-3`, schema `gamecult.thing.test.swarm.v1`) written with the test type registered, so the store's catalog publishes the member rows `Id`, `Name`, `Load` | - |
| `state-swarm-members-empty.state.cc` | The same four records written through a hand-implemented twin of the type, whose catalog publishes `[]`: every read of it is refused | - |
A payload the contract refuses cannot live in a store: f11's refused payload is a raw file here, and an
unknown union arm is `crates/thing-contract/tests/goldens/node-unknown-arm.bin`, read in place and fed to
@ -28,5 +30,5 @@ unknown union arm is `crates/thing-contract/tests/goldens/node-unknown-arm.bin`,
## Regenerate
`THING_BLESS=1 cargo test -p thing-testkit --test fixtures every_fixture_round_trips` rewrites
the files through `golden::check`, the one bless door; review the diff before committing. Run
the files (the two state stores: `--test state the_committed_stores`) through `golden::check`, the one bless door; review the diff before committing. Run
the tests without `THING_BLESS` to compare.

View file

@ -0,0 +1,3 @@
“²cultcache.store.v1‘—¹gamecult.thing.test.swarm¹gamecult.thing.test.swarm¼gamecult.thing.test.swarm.v1¹gamecult.thing.test.swarmÙf{"schemaName":"gamecult.thing.test.swarm","schemaVersion":"gamecult.thing.test.swarm.v1","members":[]}‘¹gamecult.thing.test.swarm<EFBFBD>””¦mind-1¹gamecult.thing.test.swarm´2026-01-01T00:00:00ZÄ“¦mind-1¦EurekaË?Ó×
=p£×”¦mind-2¹gamecult.thing.test.swarm´2026-01-01T00:00:00ZÄ“¦mind-2¥LibbyË?â=p£×
=”¦mind-3¹gamecult.thing.test.swarm´2026-01-01T00:00:00ZÄ“¦mind-3¤KikoË?´záG®{”§summary¹gamecult.thing.test.swarm´2026-01-01T00:00:00ZÄ“§summary¥SwarmË?ÚáG®zá

Binary file not shown.