test(m4): finish audit, measurement and archive (#76)
- client/e2e/audit.test.mjs: independent player-browser traffic audit (own frame catalogue and banned-key list, never leakcheck.nim), with a -d:leakfault/otherVision negative control. - client/e2e/fogbench.test.mjs + tools/fogbench.nim: 50 tokens on a 16384 px map (server move path and headless SwiftShader cadence); results/m4-fog-bench.md records both honestly (SW is not the phone gate). - Archive prototype-* under docs/archive/prototypes (Q24); DESIGN 13 M4 done, TESTING 13 M4 accept result, HANDOFF-M4 close-out. - mutation.sh c1/c2 patch the post-#65 tile-gate line again (they had silently become sed no-ops).
This commit is contained in:
@@ -148,7 +148,7 @@ DESIGN is 23 134 B (10.4 %) smaller. TESTING is larger than the moved bytes beca
|
||||
| old DESIGN | new TESTING | what moved |
|
||||
|---|---|---|
|
||||
| §3.1 notes | §3.1 | `GMONLY_TOKEN` fault-class pointer |
|
||||
| §3.3 | §3.3 | `/_tiles/` 404 evidence, tile-allowed `[MEASURED]` leak (d) counts, `prototype-tile-leak` evidence, test-vhost note, slice-9 status-split pin (was in §6.6) |
|
||||
| §3.3 | §3.3 | `/_tiles/` 404 evidence, tile-allowed `[MEASURED]` leak (d) counts, `docs/archive/prototypes/tile-leak` evidence, test-vhost note, slice-9 status-split pin (was in §6.6) |
|
||||
| §3.4 | §3.4 | the `Test` column of T1-T17, as a proving-test table |
|
||||
| §4.1 | §4.1 | `vision_ms move-monster` `[MEASURED]` |
|
||||
| §4.2 | §4.2 | "order proven correct by 3 x 60 s runs" |
|
||||
|
||||
@@ -7,9 +7,9 @@ Date: 2026-11-10. Parent: map #2. Scope: facts + source refs only. No decisions.
|
||||
- **mummy tag 0.4.8** = commit `77a7563e87a1045e4e407a3a68731e299fa3507e` (GitHub API `refs/tags/0.4.8`). Repo is **`guzba/mummy`**, not `treeform/mummy` as the ticket says (nimble `url` = github.com/guzba/mummy). Files fetched raw from that commit: `src/mummy.nim` (1561 L), `src/mummy/{common,internal,routers,multipart}.nim`. Link base: `https://github.com/guzba/mummy/blob/77a7563e87a1045e4e407a3a68731e299fa3507e/`. Refs below are `src/mummy.nim:N` unless noted.
|
||||
- **mummy at main `01deb1ff`** (devbox cache): `mummy.nim` is 54023 B, same size as the tag copy. q20 doc says only `.github/workflows` differ. Not re-diffed here.
|
||||
- **webby 0.2.1** (`treeformwebby`), local pkgcache `/home/davide/.nimble/pkgcache/githubcom_treeformwebby_021/src/webby/`: `httpheaders.nim`, `queryparams.nim`. Upstream tag not fetched.
|
||||
- **db_connector** commit `29450a2063970712422e1ab857695c12d80112a6` (nimble `specialVersions` 0.1.0; `srcDir = "src"`). Read from local cache `prototype-server-vision/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/` (`db_sqlite.nim`, `db_common.nim`, `sqlite3.nim`). Upstream file path inferred as `src/db_connector/db_sqlite.nim`. Not fetched from GitHub.
|
||||
- **db_connector** commit `29450a2063970712422e1ab857695c12d80112a6` (nimble `specialVersions` 0.1.0; `srcDir = "src"`). Read from local cache `docs/archive/prototypes/server-vision/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/` (`db_sqlite.nim`, `db_common.nim`, `sqlite3.nim`). Upstream file path inferred as `src/db_connector/db_sqlite.nim`. Not fetched from GitHub.
|
||||
- **Nim stdlib** `hashes.nim` (devbox Nim 2.2.12): `/nix/store/274jzpwhdklcga24bd9cxywba9apvpic-nim-unwrapped-2.2.12/nim/lib/pure/hashes.nim`.
|
||||
- Repo: `prototype-server-vision/src/server.nim`, `docs/DESIGN.md` §3.2, §4.2–4.4, §6.2, `docs/research/q20-nix-packaging.md`.
|
||||
- Repo: `docs/archive/prototypes/server-vision/src/server.nim`, `docs/DESIGN.md` §3.2, §4.2–4.4, §6.2, `docs/research/q20-nix-packaging.md`.
|
||||
|
||||
## mummy 0.4.8: facts
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ Pins used below: treeform/ws `c9c0c7b` (v0.6.0), guzba/whisky `494fb10`, status-
|
||||
- Only `package.json` in prototype is `client/package.json` (pixi.js, vite, typescript, @types/node). Tools do not import it.
|
||||
- `ws` npm package: not used and not evaluated.
|
||||
|
||||
Sources: [P1] `/home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/tools/lib.mjs`; [P2] `.../tools/smoke.mjs` L9; [P3] `.../tools/leak.mjs`, `.../tools/leakcheck.nim` (under `prototype-server-vision/tools/`); [P4] `prototype-server-vision/devbox.json`; [P5] `prototype-server-vision/client/package.json`.
|
||||
Sources: [P1] `/home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/tools/lib.mjs`; [P2] `.../tools/smoke.mjs` L9; [P3] `.../tools/leak.mjs`, `.../tools/leakcheck.nim` (under `docs/archive/prototypes/server-vision/tools/`); [P4] `docs/archive/prototypes/server-vision/devbox.json`; [P5] `docs/archive/prototypes/server-vision/client/package.json`.
|
||||
|
||||
## 3. Node availability and deps (b)
|
||||
|
||||
- Main `devbox.json` packages: nim 2, nimble, coreutils, gnused, diffutils, gnugrep. No node, no nginx. [M1] `/home/davide/Projects/GDR/FFF_vtt/devbox.json`
|
||||
- Prototype `devbox.json`: `nodejs: "latest"`, `nginx`, `sqlite`. [P4]
|
||||
- Prototype `devbox.lock` L300-303: `nodejs@latest` resolved to `nixpkgs 8edc0c7#nodejs_26`, version 26.11.1. [P6] `prototype-server-vision/devbox.lock`
|
||||
- Prototype `devbox.lock` L300-303: `nodejs@latest` resolved to `nixpkgs 8edc0c7#nodejs_26`, version 26.11.1. [P6] `docs/archive/prototypes/server-vision/devbox.lock`
|
||||
- System node (outside devbox): v24.22.1, `/run/current-system/sw/bin/node`. Not the devbox version.
|
||||
- Node `WebSocket` header option: tested by capturing raw upgrade on a local `net` server. Wire request contained `Cookie: sid=abc` and `Origin: https://evil.example`. Test script: `<scratchpad>/nodetest/hdr.mjs`. Node docs for the `headers` option were not checked; behavior is observed, not documented.
|
||||
- Browser-standard WebSocket has no headers arg; this path depends on Node/undici.
|
||||
@@ -105,10 +105,10 @@ Pinned upstream (commit links):
|
||||
- [WH-src] https://github.com/guzba/whisky/blob/494fb1046f5a563defc87ac36b8c62846ee7ea2c/src/whisky.nim (newWebSocket L156, receiveFrame L28)
|
||||
- [WH-readme] https://github.com/guzba/whisky/blob/494fb1046f5a563defc87ac36b8c62846ee7ea2c/README.md
|
||||
- [MUM-default] https://github.com/guzba/mummy/blob/01deb1ff694988635c7bf0f24f6088a0bdf6db5d/mummy.nim (newServer defaults L1476-1481: maxMessageLen = 64 KB; enforced L658)
|
||||
- [SRV-newserver] local `/home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/src/server.nim` L363 (`newServer(handler, wsHandler, workerThreads = 8)`, no maxMessageLen)
|
||||
- [SRV-newserver] local `/home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/src/server.nim` L363 (`newServer(handler, wsHandler, workerThreads = 8)`, no maxMessageLen)
|
||||
- [S-httpclient] local `/nix/store/3y9syv0p41rdaqzddashmdl475l0rbv0-nim-unwrapped-2.2.4/nim/lib/pure/httpclient.nim` L711-724 (getSocket)
|
||||
- [P1..P6] local files cited in sections 2-3.
|
||||
- [M1] `/home/davide/Projects/GDR/FFF_vtt/devbox.json`
|
||||
- Node header test: `<scratchpad>/nodetest/hdr.mjs` (scratch, not committed).
|
||||
- nimble index (names/URLs only): `/home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/.devbox/nimble/packages_official.json`
|
||||
- nimble index (names/URLs only): `/home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/.devbox/nimble/packages_official.json`
|
||||
- GitHub API metadata: `gh api repos/treeform/ws`, `repos/guzba/whisky`, `repos/status-im/nim-websock`, `repos/niv/websocket.nim` (pushed dates, archived flag).
|
||||
|
||||
@@ -85,7 +85,7 @@ Consequence: browsers answer server Pings with Pongs in the network stack, witho
|
||||
|
||||
## Corrections to repo docs
|
||||
|
||||
- `prototype-server-vision/HANDOFF.md` L29 and `prototype-server-vision/README.md` L110-114: "one unbounded server-wide deque" is the entry point only. The backlog is per socket (`outgoingBuffers`, pin L133, L1248). The "no ==/hash, keyed by raw bytes" caveat is stale at this pin (generic field-wise `hash`/`==` apply).
|
||||
- `docs/archive/prototypes/server-vision/HANDOFF.md` L29 and `docs/archive/prototypes/server-vision/README.md` L110-114: "one unbounded server-wide deque" is the entry point only. The backlog is per socket (`outgoingBuffers`, pin L133, L1248). The "no ==/hash, keyed by raw bytes" caveat is stale at this pin (generic field-wise `hash`/`==` apply).
|
||||
- `docs/DESIGN.md` L48: "no upstream tags" is wrong. Tags `0.4.6`-`0.4.8` exist, and the pin's `src/` equals `0.4.8`.
|
||||
- `docs/DESIGN.md` L192 and H18 (L500): the mitigation "close when sent - acked-by-pong exceeds a bound" cannot be executed as an immediate close at this pin. `close(ws)` queues behind the backlog. The workable action is to stop feeding the client and close once the peer responds or sends data.
|
||||
- `docs/DESIGN.md` L192: "per-connection byte counter we maintain ourselves" is fine, but acks must come from server-solicited Pings. WHATWG says user agents must not use pings or unsolicited pongs to aid the server, so the server must solicit every Pong it relies on. JS cannot send or observe Pongs.
|
||||
@@ -122,7 +122,7 @@ Upstream's position (issue #141) assumes a reverse proxy handles timeouts. A pro
|
||||
Not evaluated. Would need a separate research pass against each candidate's pinned source. Not recommended before A is tried, because A removes the risk that motivates the switch.
|
||||
|
||||
### Option E: caps only (DESIGN v1 mitigations, no slow-client logic)
|
||||
Connection cap, size limits, pong timeout detection without enforcement. Memory per stuck client grows until the process restarts or the kernel errors the socket. Illustrative arithmetic only: the prototype's ~3.4-3.7 KB per vision delivery (`prototype-server-vision/HANDOFF.md`, README) at an assumed 10 deliveries/s is ~2 MB per minute per stuck client. The 10/s is an assumption, not measured.
|
||||
Connection cap, size limits, pong timeout detection without enforcement. Memory per stuck client grows until the process restarts or the kernel errors the socket. Illustrative arithmetic only: the prototype's ~3.4-3.7 KB per vision delivery (`docs/archive/prototypes/server-vision/HANDOFF.md`, README) at an assumed 10 deliveries/s is ~2 MB per minute per stuck client. The 10/s is an assumption, not measured.
|
||||
|
||||
## Recommendation
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Source pins:
|
||||
- nim_lk README: sourcehut is bot-walled from my environment. I could NOT read the README. Whether `nim_lk` accepts `requires "pkg#<commit>"` and whether it reads `nimble.lock` is UNVERIFIED. Test it.
|
||||
|
||||
### 2.4 Dependency graph and revisions
|
||||
Pinned in the owner's devbox nimble cache (`prototype-server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json`, `vcsRevision`). Use as the first lock target, then compare with nim_lk output.
|
||||
Pinned in the owner's devbox nimble cache (`docs/archive/prototypes/server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json`, `vcsRevision`). Use as the first lock target, then compare with nim_lk output.
|
||||
|
||||
| dep | constraint in mummy/registry | devbox-resolved vcsRevision | upstream tag check |
|
||||
|---|---|---|---|
|
||||
@@ -137,7 +137,7 @@ Upstream:
|
||||
|
||||
Local (read-only):
|
||||
- devbox.json / devbox.lock: /home/davide/Projects/GDR/FFF_vtt/devbox.json, /home/davide/Projects/GDR/FFF_vtt/devbox.lock
|
||||
- devbox nimble cache (vcsRevision): /home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json
|
||||
- devbox nimble cache (vcsRevision): /home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json
|
||||
- nim 2.2.4 stdlib (threads default, no db_* modules): /nix/store/aa4fgarndnvq417l50imvqx5fdrrx9sn-nim-unwrapped-2.2.4/nim/config/nim.cfg, /nix/store/aa4fgarndnvq417l50imvqx5fdrrx9sn-nim-unwrapped-2.2.4/nim/lib
|
||||
- owner config: /home/davide/Projects/server_nixos_configuration/configuration.nix, foundryvtt.nix
|
||||
- repo .gitignore: /home/davide/Projects/GDR/FFF_vtt/.gitignore
|
||||
|
||||
Reference in New Issue
Block a user