test: pin the mod-action serializer race fix

Six tests covering the kick-race regression fox hit 2026-06-04
("kicked two phones, only one was kicked") and the fix in commit
8d14873:

- single action signs with current epoch and resolves
- second action waits for state-update from the first (the key one
  — fires both actions back-to-back, asserts only the first runs
  before the simulated state-update, then asserts the second's fn
  signs against the FRESH epoch)
- third action queues behind first two and signs cumulatively
- queue does not wedge when state update never arrives (1.5s timeout)
- early state-update releases the gate immediately
- failure inside fn does not poison the queue

Extracts runModSerial / awaitStateUpdate / resolvePendingStateUpdate
from the live web/zebra-spaces.html so the assertions track shipped
code (same pattern as the other web test files). Each test gets a
fresh sandbox so lastModSettled doesn't leak between cases.

Makefile gets a test-mod-actions target plus a slot in test-all.
This commit is contained in:
Russell Ballestrini 2026-06-04 10:46:55 -04:00
parent 8d14873ed9
commit 84f591834f
No known key found for this signature in database
2 changed files with 233 additions and 1 deletions

View file

@ -44,6 +44,15 @@ test-video-removal:
test-mesh:
@node test/multi-peer-mesh.test.js
# Mod-action serializer — pins the kick race fix fox hit 2026-06-04
# ("kicked two phones, only one was kicked"). Extracts runModSerial +
# awaitStateUpdate + resolvePendingStateUpdate from the live page so
# the assertions track the shipped code, then drives synthetic mod
# actions through them with a stubbed roomEpoch counter to prove the
# second action signs against the FRESH epoch.
test-mod-actions:
@node test/mod-action-serializer.test.js
# zebra-spaces JS↔Go protocol parity + vault + ed25519 + (optionally) a live
# server flow. The live-server tier auto-runs when proxy.unturf.com sits
# alongside this checkout AND has a Go toolchain — we build the relay binary
@ -61,7 +70,7 @@ test-zebra-spaces:
ZEBRA_SPACES_BINARY=$$bin node test/zebra-spaces.test.js; \
rc=$$?; rm -f /tmp/zspc-signal-test; exit $$rc
test-all: test/unit test/integration test/functional test-web test-fsm test-video-removal test-mesh test-zebra-spaces
test-all: test/unit test/integration test/functional test-web test-fsm test-video-removal test-mesh test-mod-actions test-zebra-spaces
@echo "--- unit ---"
@./test/unit
@echo "--- integration ---"
@ -76,6 +85,8 @@ test-all: test/unit test/integration test/functional test-web test-fsm test-vide
@node test/video-track-removal.test.js
@echo "--- multi-peer-mesh ---"
@node test/multi-peer-mesh.test.js
@echo "--- mod-action serializer ---"
@node test/mod-action-serializer.test.js
@echo "--- zebra-spaces ---"
@$(MAKE) -s test-zebra-spaces