From 54ecf7bf6a62a7a473a484fd2251038b240d7c22 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sun, 15 Nov 2026 12:01:30 +0100 Subject: [PATCH] tools: nine mutations for the name rule, the snapshots and the character link (#23) --- tools/mutation.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/mutation.sh b/tools/mutation.sh index 1eff1f6..433e7bb 100755 --- a/tools/mutation.sh +++ b/tools/mutation.sh @@ -17,6 +17,11 @@ # ae: a player token frame carries the GM-only `kind` | af: explored forgets the cells outside the current polygon # ag: the chunk row stride is dropped | ah: a cell coordinate used as a chunk coordinate | ai: restore forgets rows # aj: chunks keyed by scene, not player | ak: a chunk rewrite ignored (INSERT OR IGNORE) | al: dirty chunks keyed by row only +# slice 8 (#23): av: everyone is told the actual name | aw: an unrevealed name lands in the snapshot +# ax: a rename tells a player an actual name it never knew | ay: a linked token may keep its own names +# az: in-use not enforced | b1: player.remove forgets the characters | b2: an encountered rename +# overwrites a name the player never knew | b3: cprops carries the character owner bucket | +# b4: a player is sent every character # Parallel: MUTATION_JOBS (default nproc/4) jobs, each in its own temp copy + nimcache; output collected, printed in fixed order. # Tests run with FFF_MUTATION=1 (iteration counts ~/10, see tests/testutil.nim scaled()); only test files holding an expected # test are run per mutation (control runs all). Debug build. Wrapped in systemd-inhibit (sleep:idle) when that works. @@ -153,10 +158,21 @@ run ar "a failed grow is not flagged squeezed" server/moverules.nim '/^ sc.toke run as "a failed door push sticks instead of squeezing" server/moverules.nim 's/^ sc.tokens\[i\]\.squeezedWalls = true$/ sc.tokens[i].stuckWalls = true/' "push: both sides invalid" run at "one bucket budget shared by all buckets" server/props.nim 's/and p\[bucket\]\.len >= MaxPropKeys/and p[pbPublic].len >= MaxPropKeys/' "64 keys per bucket" run au "a grow that already fits still pushes" server/moverules.nim 's/^ if not overlapsAny(sc, sc.tokens\[ti\]):$/ if false:/' "a grow that already fits does not move the token" +# slice 8 (#23): the name rule, the encountered snapshot, the token link, in-use, the transfer and +# the character buckets +run av "everyone is told the actual name" server/characters.nim 's/^ isOwner or revealAll or revealed$/ true/' "a character owner sees the actual name|a linked token borrows" +run aw "the encountered snapshot ignores what the player knows" server/characters.nim 's/actualName: (if knowsActual: some(n\.actual) else: none(string))/actualName: some(n.actual)/' "a first sighting records|a rename follows the subject" +run ax "a rename tells a player an actual name it never knew" server/characters.nim 's/ if e\.actualName\.isSome: result\.actualName = some(actual)/ result.actualName = some(actual)/' "a rename follows the subject" +run ay "a linked token may keep its own names" server/tokens.nim 's/ if t\.characterId\.isSome: t\.descriptiveName\.len == 0/ if false: t.descriptiveName.len == 0/' "a linked token carries no names" +run az "in-use is not enforced" server/characters.nim 's/^ if t\.characterId\.isSome and t\.characterId\.get == characterId: inc result$/ discard/' "a character still figured by a token is in use" +run b1 "player.remove forgets the characters" server/characters.nim 's/WHERE owner_player_id = ?", gmId, playerId)/WHERE owner_player_id = ? AND 0", gmId, playerId)/' "hands the player" +run b2 "an encountered rename overwrites a secret" server/characters.nim 's/AND actual_name <> .."""/AND 1 = 1"""/' "a character rename follows the snapshots" +run b3 "cprops carries the character owner bucket" server/views.nim 's/cpropsPublic: objectOf(if ch\.isSome and not ownsCharacter: ch\.get\.props\[pbPublic\]/cpropsPublic: objectOf(if ch.isSome and not ownsCharacter: ch.get.props[pbOwner]/' "cprops carries the character" +run b4 "a player is sent every character" server/views.nim 's/ if c\.owner != playerId: continue/ if false: continue/' "a player gets only its own characters" wait rc=0; : > "$LOG" -for id in control a b c d1 d2 e f g h i j k l m n o p q r s t u v w x y z z2 aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au; do +for id in control a b c d1 d2 e f g h i j k l m n o p q r s t u v w x y z z2 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; do [ -f "$T/$id/res" ] && cat "$T/$id/res" >> "$LOG" if [ -f "$T/$id/verdict" ]; then tee -a "$LOG" < "$T/$id/verdict"; [ "$(cat "$T/$id/rc")" = 0 ] || rc=1 else echo "$id: NO RESULT (job killed?)" | tee -a "$LOG"; rc=1; fi