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
+8 -1
View File
@@ -209,10 +209,17 @@ run c3 "an out-of-grid tile coordinate is accepted" server/tiles.nim 's/^ x >=
run c4 "a leading-zero tile coordinate is canonical" server/tiles.nim "s/ if raw\[0\] == '0' and raw.len > 1: return false/ discard/" "$TILE_ZERO"
# slice 10 (#25): scene.set needs at least one patch field (server/world.nim parseScenePatch)
run d3 "scene.set accepts a patch with no field" server/world.nim 's/^ if not any: return none(ScenePatch)$/ discard/' "a patch with none is invalid"
# #32: the rollback on a Defect, in both transaction helpers, and the one-ack decision
run e4 "a Defect skips the ordinary rollback" server/db.nim 's/^ except Exception:$/ except CatchableError:/' "rolls back a Defect and leaves"
run e5 "a Defect skips the authoring rollback" server/world.nim 's/^ except Exception:$/ except CatchableError:/' "authoringTransaction rolls back a Defect"
# #35: the three opaque-object caps (server/props.nim checkOpaqueObject)
run f1 "the opaque size cap is not enforced" server/props.nim 's/> MaxOpaqueObjectBytes: return olSize/> MaxOpaqueObjectBytes + 100000: return olSize/' "size: exactly 8 KB"
run f2 "the opaque key cap is not enforced" server/props.nim 's/if n\.len > MaxOpaqueObjectKeys: return olKeys/if false: return olKeys/' "keys: 64 per object"
run f3 "the opaque depth cap is not enforced" server/props.nim 's/if depth > MaxOpaqueObjectDepth: return olDepth/if false: return olDepth/' "depth: 8 containers"
wait
rc=0; : > "$LOG"
for id in control a b c d1 d2 d3 e e1 e2 e3 f g h i j k l m n o p q r s t u v w x y z z2 \
for id in control a b c d1 d2 d3 e e1 e2 e3 e4 e5 f1 f2 f3 f g h i j k l m n o p q r s t u v w x y z z2 \
s1 s2 s3 s4 s5 s6 s7 aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au \
av aw ax ay az b1 b2 b3 b4 c1 c2 c3 c4; do
[ -f "$T/$id/res" ] && cat "$T/$id/res" >> "$LOG"