# Journey of an Internet Message

## Learning goal
Watch each message chunk travel through routers. Lost data and lost acknowledgements reveal why retries and duplicate detection matter.

## Model and limits
A local discrete-event teaching model with fixed routes, 512-byte data chunks, 32-byte ACKs, shared link serialization, stop-and-wait delivery, duplicate detection and five attempts per chunk. Loss applies independently to every hop, including ACKs. This is not a full TCP implementation: no congestion window, DNS, TLS, dynamic routing or real network requests.

## Primary references
- [RFC 9293: Transmission Control Protocol](https://www.rfc-editor.org/rfc/rfc9293.html)
- [RFC 6298: retransmission timers](https://www.rfc-editor.org/rfc/rfc6298.html)

## Experiment design
- **Reliable delivery**: Data goes out; acknowledgements travel back. Parameters: `{"loss":0}`.
- **Lose and retry**: A seeded run with packet loss and exponential timeout backoff. Parameters: `{"loss":0.2}`.
- **Route around a failure**: Remove R3 and find the alternate path. Parameters: `{"outage":1,"loss":0}`.
- **No way through**: The receiver has no active link. Parameters: `{"outage":2}`.

These presets are design predictions to investigate, not claims from a usability study. All readouts, animation positions and exported observations come from the same local model. The 2D view uses the same state. Saved setups restart from their parameters, rather than claiming to resume exact progress. Captured baselines are stored separately and survive resets and preset changes.

## Verification
Run `node --test apps/shared/discovery/tests/models.test.cjs` for numerical invariants, limiting cases, determinism and failure-state checks. Run `node apps/shared/tests/catalog.test.cjs` for routes and references. Browser and keyboard validation must be reported separately from numerical tests; automated tests are not user research.

## Discovery studio interaction layer
The studio adds selectable model objects, ray-based 3D picking, keyboard-accessible object selection, an inspector, scene editing where appropriate, model-specific stepping, and 24 measured challenges across the twelve labs. This is an interaction redesign, not a claim of measured learning improvement.

Most parameter changes now preserve current state. Structural changes explicitly start a new run; the exact per-app list is in `apps/shared/discovery/studio-model.js`. Current settings, independently captured baselines and challenge progress retain separate storage. Undo/redo keeps up to 30 edit checkpoints; the timeline keeps the latest 80 model snapshots. Resuming from a historical state creates a new branch. Saved setups still restart from parameters; they do not claim to retain the timeline or local particle pin edits.

Additional instruments derive from the existing model and cited references. Camera and light sweeps hold the remaining inputs fixed; neural curves separate training and validation; compression uses actual coefficients and recomputed quality samples; traffic uses recorded car positions/speeds; factory queues and utilisation use actual events and busy time. Visible instruments can continue collecting data while the hidden 3D view stops drawing.

Run `node --test apps/shared/discovery/tests/studio.test.cjs` for live edits, preserved state, all challenge solutions, direct manipulation, rewind, picking, instrument exports and controller integration. These DOM/renderer-double checks do not replace rendered browser and device review.


## Detailed 3D apparatus
Shared procedural geometry in `apps/shared/discovery/apparatus.js` adds mechanical housings, lens and iris parts, cables, wheels, connectors, moving machine heads and subject-specific markings. The scene uses bevelled housings, smoother curved geometry, instanced material families, a key/fill/rim light arrangement and bounded soft shadows. Cloth has a procedural weave bump map attached to its original model coordinates.

Full detail can be switched to Essential detail without resetting the model. All movements use model state or model time: wheel markers use road position, machine heads use scheduled job progress, conveyors use accumulated worker time, iris blades use the illustrated aperture, and network packets use their scheduled flights. Signal and energy markers illustrate direction, not measured transit speed. The fan is an indicator of the wind setting; it does not add a fluid simulation. Shells, grippers, cables and surface textures do not change the underlying collision model. The 2D fallback retains the same state and geometry.

Additional checks: `node --test apps/shared/discovery/tests/apparatus.test.cjs`. Geometry, state preservation, bounded batching, semantic selection, pause/rewind consistency and fallback behavior are checked with renderer doubles; browser pixels and device frame rates remain unverified.


## Authored model assets
The physical-object labs now load original Blender-authored GLB assets through `model-assets.js` and `model-worlds.js`: articulated industrial arm, mirrorless camera, car (overview and inspection versions), network router, gantry station, optical laser and companion character. The geometry, authored material surfaces and packed texture maps replace corresponding primitive bodies only after loading succeeds. Source `.blend` files, reproducible Python generators, manifests and inspected Blender renders are retained in `assets/models/` and `scripts/`. Mathematical data surfaces stay tied to their original calculations.

The robot uses actual solved joints; camera iris hinges respond to the aperture and a Cutaway toggle exposes the sensor/rays; car wheels and brake lights follow model position/acceleration; factory heads use scheduled job progress. GLB equipment covers remain illustrative, not new collision or optical physics. Camera cutaway distances are display distances; numerical thin-lens readings remain authoritative. The companion uses the motion model's translation and squash/stretch.

Assets load on demand, repeated equipment shares instanced geometry/materials, and only the selected close-up car upgrades from the lighter road mesh. Failure preserves the diagram and exposes Retry model. Inspect model fits the selected geometry rather than applying a fixed camera distance. Full/Essential detail, pause, rewind and existing models/data remain available. A procedural studio reflection environment lights PBR surfaces without external network requests.

Run `node --test apps/shared/discovery/tests/model-assets.test.cjs` for real GLB parsing, file loading, texture/UV presence, hierarchy transforms, exact solver alignment, cutaways, pause/rewind, fitting and car detail selection. Asset product renders were visually inspected in Blender. Browser pixels and device frame rates are still unverified; product renders are not screenshots of the web app.


## Bespoke rebuild (2026-10)
The page no longer uses the shared discovery template. `model.js` and `config.js` are unchanged.

- `journey.js` drives `model.js` in steps of at most 20 ms of model time and copies every flight, retry timer (read from the model's scheduled timeout events) and receipt into an uncapped record, because the model itself keeps only the latest 160 flights and 150 log lines. It also runs a lossless "shadow" copy of the same settings: its first ACK time is the round trip shown, and "Delay from loss" is the actual time to reach N confirmed chunks minus the shadow's time for N. Goodput = stored chunks × 512 bytes ÷ elapsed model time. The odds box uses independent per-hop loss: one try succeeds with (1−p)^(2·hops), a chunk fails with (1−that)^5.
- `network-views.js` draws the two 2D diagrams. The network map is a plan of the six machines and eight links with one-way delays, the Dijkstra route highlighted, packets in flight, losses, a draining retry-timer ring and offline/unplugged states (R3 and the Receiver are clickable/keyboard toggles for the existing `outage` parameter). It switches to a tighter layout when narrow. The timing diagram is the classic sequence diagram: one vertical line per machine on the route, time running down, every hop a sloped line, ACKs dashed, losses marked ✕, retry timers as brackets beside the sender and "stalled" bands from a loss until its timer fires.
- `app.js` is the controller: six question presets (seeds chosen so the intended event happens early: 108 loses chunk 1 on R1→R3, 3 loses two chunks, 30 loses the first ACK), transport (play, next model event, skip to result, restart, slowed playback), readouts, a live explanation, the model's own predict question, and three checked challenges (duplicate with no loss and a ≥900 ms timer; deliver ≥4 chunks at ≥25% loss; bring two-timeout delay under 1.5 s with no duplicates, solvable from preset 03 with a ~650 ms timer).
- Layout: on desktop the diagrams sit in the centre with the key controls in a side column (secondary settings in "More settings"); on phones the diagram is sticky at the top while the controls scroll beneath it.

No 3D view: the subject is a graph and a timeline, both clearer flat, and the router GLB would add decoration rather than understanding. The page title and description in the SEO head still mention a 3D network; that block was kept unchanged as required.

Limits added by the views: the loss position on a link is drawn at the midpoint (the model decides loss per hop, not a place). Because the sender is stop-and-wait, chunks cannot arrive out of order here; the honest-limits note explains how real TCP windows and multiple routes cause reordering.
