Linora

0311. Snapshot downloads revalidate (no-cache + ETag), and the prod-like stack runs a large compactor

Status: Accepted (2026-11-28). Amends the load path of 0010 (“immutable caching”) and applies 0706 to docker-compose.prod.yml.

Context

A user on the prod-like stack saw every reload “sync again”: the Layers count climbed to about 6,000 while the pill said “Syncing…”, then dropped to 1. The count is the Layers panel’s row count (top-level layers while collapsed). It came from the doc as it was rebuilt: an old snapshot with thousands of generated frames, then a journal replay that ended with “Clear canvas” and one new page. Nothing was unsent. Every open repeated the replay, for two reasons:

  1. Stale browser copy. GET .../snapshot names the page, not a seq, so its content changes with each compaction. It was served Cache-Control: private, max-age=31536000, immutable. A browser keeps the first copy it gets for a year and never asks again. The client then loads that old seq and replays the whole journal since it on every open. On the throwaway stack the first copy was the empty page (38 B), so each reload replayed 27 MB over the socket. Once retention prunes the journal, the client loops: realtime answers SNAPSHOT_STALE, and the client refetches the same cached copy.
  2. No compactor for big pages. The stack’s only compactor has LINORA_COMPACTOR_MAX_BYTES = 256 MiB, so it never claims pages above 335,544 nodes, and the stack had no large-memory compactor. The page’s last compaction took it from 308,532 nodes to 463,465, and everything after that (78 rows, 10.6 MB) stayed in the tail for good. pages.node_count changes only on compaction, so the page stayed listed at 463,465 nodes even after it shrank to 310.

Decision

Alternatives

Consequences