Commit b420b8f
feat(wire): brotli transport compression + Wire v3 metadata protocol (default on)
Two stacked wire overhauls, measured on a real 68MB/3830-request session:
Axis B — brotli compression (br|identity negotiation, per-event flush):
/events and /api/local-log SSE streams and /api/requests compress under
Content-Encoding: br via the single seam server/lib/wire-compress.js; every
SSE write (broadcasts, workspace reload, update badge) routes through
sseWrite so no plaintext byte can corrupt a compressed stream.
Encoder-aware backpressure (awaitWireDrain), br;q=0 honored, Vary on both
branches, encoder destroyed on close/eviction. Cold load 176.8MB -> 8.5MB
under br. Escape hatches: CCV_WIRE_COMPRESSION=off, CCV_BROTLI_QUALITY.
Wire v3 — metadata rows + native chat wire (spec docs/refactor/
WIRE_FORMAT_V3.md), DEFAULT ON (CCV_WIRE_V3=0|off is the escape hatch):
- request list = journal-fold metadata rows (v2_requests /
v2_requests_delta; typeTag via the client's own classifyRequest — the
requestType chain now carries .js extensions and src/utils/ ships in the
npm files array; cacheLoss computed server-side in a bounded Pass B)
- detail on demand: GET /api/v2-entry rebuilds one full entry + prevMain
(per-member checkpoint promotion in the window materializer)
- chat = raw conv/responses lines (cold: from the last snapshot at-or-before
the window start, ~512KB chunked frames; live: per-line forwarding, the
full-entry broadcast suppressed); the client v3Assembler replays them into
v1-shape entries feeding the EXISTING ingest pipeline (parity oracle vs
the legacy reconstructed stream), so merge guards and consumers keep
their exact semantics
- since-scoped incremental reconnects; single-flighted cold reads; v3
client state resets on every baseline reset (workspace switch,
full_reload, fresh cold frame); build-stamp reload guard for tabs that
survive a server upgrade
- loading UX: no mask — the list is interactive from the first frame, the
chat area shows its inline Spin + an exact received/total byte meter
(load_start.v3Bytes), and the assembly yields to the main thread
Cold plaintext 176.8MB -> 42.5MB (the remote plain-http path browsers
cannot brotli), client JSON parse /4.2, live channel per-turn delta-sized
instead of re-broadcasting the full history twice per turn (was 3.7GB per
client per session). Retained surfaces unchanged: /api/local-log v1-shape
output, downloads, workspaces preview, ccv verify, v1 legacy files;
entry-slim retained (idle on the v3 path).
Hardened by a 6-perspective team review (all P0/P1/P2 adopted): npm
packaging fix, baseline-reset lifecycle, assembler race buffering, teammate
fixture tests (caught a real teammate-session cold-load crash), legacy
loading-state regression, event-loop yields, kv/context depth parity.
test:cli 8235/8247 green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent cf0c21b commit b420b8f
35 files changed
Lines changed: 3059 additions & 136 deletions
File tree
- docs
- refactor
- server
- lib
- v2
- routes
- src
- components
- chat
- dashboard
- utils
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
0 commit comments