Nothing checks that the same lab replays identically #1419

Closed
opened 2026-11-11 04:01:05 +00:00 by jaylouisw · 0 comments
Owner

Three engine modules compute with the simulator's own step and say so in a comment:

engine/flow.js:177   "A per-connection identity that is stable across runs: no Math.random(), no Date.now().
                      The same lab replays identically ..."
engine/nat.js:15     "Steps are caller-supplied logical ticks, never Date.now()"
engine/dhcp.js:15    "... never Math.random. `step` is the simulator's tick"

Nothing enforces it. That is the same shape as the six drifts already landed here (port state #1238, PoE #1293, routes #1301, the switchport sentence #1291, ARP/LLDP rows #1327, counters #1417): a rule written down once, reimplemented per surface, checked nowhere.

The failure is silent. One Date.now() in a newly written module and two servers running the same document publish different payloads - which shows up as a test that fails once a week, or as a diff between two boards that an operator reads as a real difference.

What should be true

  1. no Math.random(, Date.now(, new Date(, performance.now(, crypto.randomUUID( or process.hrtime anywhere in engine/*.js (comments and strings excluded - the modules discuss all of these in prose);
  2. the same lab built twice, in one process and across a real wall-clock second, fingerprints the same (every show output plus serialize());
  3. the same document driven through two independent servers with the same commands publishes a byte-identical state payload;
  4. reading one server's board a second later changes nothing - i.e. nothing in fullState() is clock-derived;
  5. and the guard can fail: the fingerprint must tell three different labs apart, and the payload compared across servers must be one traffic actually crossed.
Three engine modules compute with the simulator's own `step` and say so in a comment: ``` engine/flow.js:177 "A per-connection identity that is stable across runs: no Math.random(), no Date.now(). The same lab replays identically ..." engine/nat.js:15 "Steps are caller-supplied logical ticks, never Date.now()" engine/dhcp.js:15 "... never Math.random. `step` is the simulator's tick" ``` Nothing enforces it. That is the same shape as the six drifts already landed here (port state #1238, PoE #1293, routes #1301, the switchport sentence #1291, ARP/LLDP rows #1327, counters #1417): a rule written down once, reimplemented per surface, checked nowhere. The failure is silent. One `Date.now()` in a newly written module and two servers running the same document publish **different payloads** - which shows up as a test that fails once a week, or as a diff between two boards that an operator reads as a real difference. ### What should be true 1. no `Math.random(`, `Date.now(`, `new Date(`, `performance.now(`, `crypto.randomUUID(` or `process.hrtime` anywhere in `engine/*.js` (comments and strings excluded - the modules discuss all of these in prose); 2. the same lab built twice, in one process and across a real wall-clock second, fingerprints the same (every `show` output plus `serialize()`); 3. the same document driven through two independent servers with the same commands publishes a byte-identical state payload; 4. reading one server's board a second later changes nothing - i.e. nothing in `fullState()` is clock-derived; 5. and the guard can fail: the fingerprint must tell three different labs apart, and the payload compared across servers must be one traffic actually crossed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1419
No description provided.