server/views.nim is the only place where world state becomes bytes: a Recipient builds a GmTokenView or a PlayerTokenView first, and only then a frame. Player frames carry the public props bucket (plus owner for the controller), the controller's vision_radius, and never kind, controller, gm_only, flags, radius_own or either raw name; the GM gets all of it plus both names. The per-connection Known table diffs on the built frame, so token/token_gone are exactly the changes and the vision frame is re-sent only when the polygons move. server/faults.nim compiles the negative-control hook only with -d:leakfault; the shipped binary contains no LEAK_FAULT string and tools/fault.test.mjs asserts it. hello gains the scene block (and extra for the GM); the protocol's implemented set now names the four token intents.
15 lines
692 B
Nim
15 lines
692 B
Nim
## Test-only fault injection for the negative controls of the leak harness (DESIGN 10.1, 10.3).
|
|
## The hook is compiled in only with `-d:leakfault`, and every fault checks
|
|
## `LEAK_FAULT=<name>` from the environment: a normal build cannot fault, it contains no `LEAK_FAULT`
|
|
## string, and tools/fault.test.mjs asserts that the shipped binary's bytes lack it.
|
|
when defined(leakfault):
|
|
import std/os
|
|
|
|
proc faultActive*(name: string): bool =
|
|
## True only in a `-d:leakfault` build whose LEAK_FAULT equals `name`. Without the define this is
|
|
## the constant false, so the shipped server has no fault path at all.
|
|
when defined(leakfault):
|
|
getEnv("LEAK_FAULT") == name
|
|
else:
|
|
false
|