Race condition diagnostics
Codes in the MGS4xxx range are emitted by the magus race condition detector.
Enable with magus run <target> --race.
The --race flag follows the --output pattern: an enumerated mode value.
Modes are orthogonal and can be combined with a comma:
magus run build # no race diagnostics
magus run build --race=watch # cheap: fsnotify + static checks
magus run build --race=replay # determinism only
magus run build --race=watch,replay # everything
| Mode | Codes emitted | Cost |
|---|---|---|
| (omitted) | MGS4002 only |
free (static check, always on) |
watch |
MGS4001, MGS4002, MGS4004 |
near-zero (fsnotify) |
replay |
MGS4002, MGS4003 |
roughly doubles wall-clock |
watch,replay |
all four | watch overhead + 2× wall-clock |
MGS4002 (declared-output overlap) is always emitted: a static check
at graph construction time, with zero runtime cost, no flag required.
watch is safe to leave on for every CI run. replay re-executes the
affected set sequentially with the cache bypassed, so reserve it for a scheduled audit
or a manual audit rather than every push.
Codes
- MGS4001: filesystem race condition.
- MGS4002: declared output overlap.
- MGS4003: non-deterministic output.
- MGS4004: potential undeclared dependency.
- MGS4007: undeclared source modified. Always on, like
MGS4002, and needs no--race: the comparison is between two hashes of the declared source set, which every run computes anyway.