seriesoftubes/scripts
jvanvik c5c7ea9508 Server-run engine: a restored network plays on exactly as before
A network loaded from its checkpoint drifted from the one that never stopped:
after a checkpoint on day 1, 2 or 5 its R differed at once (bizDem at Ashburn
6426 against 26, then cityDem, citySrv, tNet), and from the next day S too
(cash, eyeball growth). Three causes, each shown by a probe:

- R after a day is the R of the day's last routing, made before the day's end
  changed S (customers who left or signed, moods, bills, transit history) and
  routed from the memory of the R before it. srvLoad routed the saved S again
  from R's own memory: another R, which the next day reads (sfOf for eyeball
  growth, the peering share). Every compute() in the realm now keeps, for the
  R it makes, S as it routed it (one JSON per top-level key, 0.8 ms big) and
  the memory it started from. rt carries that routing point (pt: the memory,
  the keys that changed since, the keys S did not have then), and srvLoad
  routes that S again from it: the same R, byte for byte. The old restore test
  checkpointed after day 10, where a failure or event routed again at the end
  of the day and nothing changed after it: it passed by luck.
- The sales desk's tried offers (UI.slTried, an offer that did not fit waits a
  week) live outside S. A fresh realm forgot them and the desk tried other
  offers. rt carries them (sl); a day mark keeps them and the in-place restore
  after a throw puts them back (before, a parsed S dropped them).
- A save and a reload give some keys back in another key order (a customer's
  defaults go last, the intern's week tally in its own order), and the week's
  report lists the tally in that order. At a checkpoint rt carries the live
  text of each such key (ord, srvGate's round trip, about 8 ms), taken on load
  only where it holds what sanitize() made of the save. A fresh realm after a
  timeout takes the mark's own text the same way (live).

The plain game drifts across a save and a reload too (jsdom: from the first
day after it; the page routes a reloaded S with an empty R and keeps no desk
memory): a game property, so the engine carries what is missing.

The envelope keeps its shape {s, uidN, rt, last, day}; rt keeps R's own route
memory, so an older checkpoint loads as before (close, not exact). Big network:
the checkpoint grows from about 42-49 KB gzip to 54-79 KB (rt 7-29 KB; the
whole R would be 375 KB), srvSave from 2-2.5 ms to 7-8 ms, a load by one
routing. A day with its mark costs the same (big 39.8 -> 37.8 ms, busy
90.0 -> 88.8 ms, within noise: the day mark joins per-key JSON now, which pays
for the routing point).

Tests: the restore test checkpoints after days 1, 2, 5 and 10 of the scenic big
network and of the same network busy (intern on every order, the desk signing
on its own, failures, events, an attack), those after days 2 and 10 right after
an action and a what-if (sent to the copies too), each compared byte for byte
at once and 10 days later (SIM_LONG: after every day to 30, 60 checkpoints). It
fails on the old engine, and without any one of the three parts. The retry test
plays busy networks (fails without the desk memory in srvRestore). The market
checkpoint compares bytes too; canon() is gone.
2026-11-09 20:16:38 +01:00
..
agent Tests wait for state instead of sleeping, on free ports 2026-11-05 11:38:26 +01:00
legacy Docs: the single-file page and English keys lasted until 1.34 2026-10-27 11:28:17 +01:00
lib Server-run engine: a restored network plays on exactly as before 2026-11-09 20:16:38 +01:00
build.js Server-run play, part 1: game prerequisites and shared contracts 2026-11-07 10:26:06 +01:00
dev.js Multiplayer for self-hosted copies: sessions, server-side saves, a leaderboard 2026-11-07 00:42:39 +01:00
gpu-bench.js Fix CodeQL code-scanning alerts 2026-11-05 21:24:26 +01:00
i18n-add.js Harden workflows and dev scripts against code-scanning findings 2026-11-05 21:04:21 +01:00
i18n-check.js Server-run play, part 1: game prerequisites and shared contracts 2026-11-07 10:26:06 +01:00
mcp.js Fix CodeQL code-scanning alerts 2026-11-05 21:24:26 +01:00
mp-server.js Multiplayer for self-hosted copies: sessions, server-side saves, a leaderboard 2026-11-07 00:42:39 +01:00
perf-bench.js The page stays free while big networks play: ambient map at 30 fps, saves in the worker, less to carry back 2026-11-07 22:22:51 +01:00
perf-browser.js The page stays free while big networks play: ambient map at 30 fps, saves in the worker, less to carry back 2026-11-07 22:22:51 +01:00
perf-fixture.js Performance benchmark on a big network, posted on every PR 2026-10-26 06:39:23 +01:00
perf-stats.js Benchmark in real Chromium too, and only call a row slower when the samples say so 2026-10-26 12:04:57 +01:00
release-notes.js Release notes: a story for big releases, and the 2.0 story 2026-10-30 16:28:19 +01:00
route-fuzz.js Differential random games: main's page and this checkout's play the same seeded game move for move 2026-11-01 21:44:30 +01:00
test-timings.js Faster tests, split everywhere: one sharded CI for pushes and releases 2026-11-07 07:24:09 +01:00
test.js Faster tests, split everywhere: one sharded CI for pushes and releases 2026-11-07 07:24:09 +01:00
weekly-architect.js Fix CodeQL code-scanning alerts 2026-11-05 21:24:26 +01:00
weekly-puzzle.js Fix CodeQL code-scanning alerts 2026-11-05 21:24:26 +01:00
weekly-scenario.js Fix CodeQL code-scanning alerts 2026-11-05 21:24:26 +01:00