## 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=` 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 proc crashNow*() = ## `-d:leakfault` only: die at a chosen point with no shutdown, modelling a hard kill between two ## transactions (the `markerCrash` hook, TESTING 10.3, #60). A shipped build has no death path. when defined(leakfault): quit(70)