fix: cap wall flags and scene extra as opaque objects (#35)

One shared validator next to the property caps: 8 KB serialized, 64 keys
per object, depth 8 (top-level object = 1). At a cap is accepted; over
is invalid and applies nothing. Both call sites use it, and a refusal is
logged once with the field and limit, never the value. Token flags and
props keep their existing rules; stored over-cap rows still load as
stored.
This commit is contained in:
2026-11-20 21:46:53 +01:00
parent 41c2fe695b
commit b0e1633aa9
9 changed files with 264 additions and 8 deletions
+10 -2
View File
@@ -1431,7 +1431,13 @@ switches, never `thickness`, `position` or `height` (#50).
no sight, movement or status rule; a marker is emitted only for a wall that is both
`player_marker:true` and derives `window` (5.8).
- `flags` is a JSON object or absent (absent = `{}`); anything else is `invalid`. It is stored
verbatim and never interpreted — the switches are fields, not flags (5.8).
verbatim and never interpreted — the switches are fields, not flags (5.8). The object is opaque
but bounded [FIXED (owner-delegated), 2026-11-20, #35], on the same measure as a prop value:
serialized JSON is at most 8 KB, at most 64 keys per object, and nesting depth at most 8 (a
top-level object is depth 1, nested objects and arrays each add one). A value at every cap is
accepted; one byte, key or level over is `invalid` and nothing is stored. A refused value is
logged once with the field and the limit it broke, never its contents. A row already stored above
a cap is loaded and echoed as stored: the cap is an input rule, not a migration.
- `wall.update` patches `a`, `b`, `thickness`, `position`, `height`, the switches except `open` (or
one `preset`), `label` and `flags`; at least one of them is required, otherwise `invalid`. A patch
is absolute, not additive: everything named is set to the value given (`null` clears `height` and
@@ -1486,7 +1492,9 @@ switches, never `thickness`, `position` or `height` (#50).
- `name`: the 6.5 text rule, 1..64 code points, already trimmed, no control characters.
- `grid_size`: a finite number `>= 0` (0 = no grid; `classify` rejects NaN/Inf).
- `vision_radius_default`, `token_radius_default`: a finite number `> 0`, no upper cap (#4).
- `extra`: a JSON object, stored verbatim and never interpreted; the GM sees it in `hello`.
- `extra`: a JSON object, stored verbatim and never interpreted; the GM sees it in `hello`. It
carries the same opaque caps as wall `flags` [FIXED (owner-delegated), 2026-11-20, #35]: 8 KB
serialized, 64 keys per object, depth 8; over a cap is `invalid` and applies none of the patch.
- `w`, `h`, `tile_size`, `cell` and `art_version` are **not** patch fields (import is the M6 CLI):
they are unknown fields and ignored (6.2), so a patch carrying only one of them has no field at
all and is `invalid`.