Skip to content
quarry View Ticket
Login

View Ticket

2026-09-24
00:52 • Ticket [6dbaeb218d] Streaming binary through the op registry: archives are copied three times status still Closed with 1 other change artifact: b9f3b67c1b user: zeitgeist
2026-09-22
23:19 • Closed ticket [6dbaeb218d]. artifact: 532d1de2f2 user: zeitgeist
2026-08-19
12:10 • Ticket [6dbaeb218d]: 1 change artifact: af34048376 user: dmestas
11:04 • Ticket [6dbaeb218d]: 2 changes artifact: 71450c2e2e user: dmestas
2026-08-18
18:39 • Ticket [6dbaeb218d]: 1 change artifact: 5a8e0862e7 user: dmestas
14:41 • New ticket [6dbaeb218d]. artifact: 374c34d1d0 user: dmestas

Streaming binary through the op registry: archives are copied three times

Closed6dbaeb218dcf545420cc76c79f61221f1ed72085Created 104.4 days agoUpdated 67.9 days ago
Description2026-08-18 14:41:30
An archive request today reads the built file into memory, base64-encodes it into a JSON op result, and the web route decodes it back — three full copies of a 13MB payload plus a 17MB string, per request. The disk cache removed the rebuild cost (10.4s cold, 0.7s warm for sqlite trunk) but that residual 0.7s is entirely the copying.

The tension is 0001 §9: one registry serves HTML and JSON, so the web route cannot bypass the op. But ops return JSON values and an archive is bytes, which JSON has no type for.

Worth deciding: whether the registry grows a notion of a streaming/binary result (an op that yields an io.Reader plus content type, with the JSON surface returning a download URL rather than the bytes), or whether binary downloads are declared outside the op seam with their own rule. The former keeps §9 intact; the latter is smaller but carves an exception.

Also here: a 304 revalidation still runs the whole op before the ETag is compared, because the ETag contains the resolved check-in and resolution lives in the op. Cheap to fix once a resolution is available without building the archive.

2026-09-22 23:19:00

Closed on measurement, build 862080ecb8f7 (landing 5d43bd81, dmestas chose the registry-grows-a-file-result shape):

GET /api/v1/r/dantest-sandbox/archive/trunk?format=zip
  200  Content-Type: application/zip  Content-Length: 503737  ETag: "34267e69fcf6265306ff70f06de5abf967050bcc9175bea0fc9dd4751ee89acc-zip"
  body starts PK — the archive itself, 62 entries; no JSON envelope, no base64
same, If-None-Match: "34267e69fcf6265306ff70f06de5abf967050bcc9175bea0fc9dd4751ee89acc-zip"
  304, empty body, 0.26s — answered before any build
web route /r/jva/dantest-sandbox/archive/trunk with the same ETag -> 304
a version that does not exist -> 404 with a JSON body

ops.File: an op may answer bytes; the router serves them with content type, disposition, length and ETag; the web route hands the same value to the same writer. archive.get names the bytes and builds them in Open, after the 304 check; the bytes are copied to the socket once. A contract change for API clients of this one op, which is what a0770478 asked for.