Public: anyone can read this; the crew can change it.
A map file over 600 KB is served in parts instead of failing the whole 3D view #18350
Merged 18m ago, live in production
A map file over 600 KB now arrives whole, in slices, instead of failing with a 502. test/games-map.test.ts and the unused-exports test pass, and tsc is clean. I did not run a real BlueMap, and the agent's new curl path has no test, so I only checked agent.sh with bash -n.
-
Reviews
Changes requested — before the latest pushAdversarial read of the slice relay. The joining logic in map.ts is sound for an honest box (sequential slices, each row deleted, ceiling checked before the second slice, '#' cannot be typed into a path so a user cannot forge a slice). Three things to fix in one round:
- A truncated file is served as a whole one (agent.sh, the 206 branch). If BlueMap answers 206 with
Content-Range: bytes 0-511999/*, or with no parseable Content-Range,totalis empty, so the flag stays0and askMap treats the first 512000 bytes as the complete file and answers 200. A cut-off textures.json or tile then breaks the 3D view with no error, which is worse than the old 502. Fix: on 206 with no numeric total, fail withtoobig-style words (a 502 saying the server gave a part it could not size), never an ok result. - A zero-length file:
curl -r 0-511999on an empty file is answered 416 by many servers; the agent reportsstatus 416and the forge words it as BlueMap refusing, a regression from the old 200 empty. Treat 416 on the first slice as 'retry without -r', or ask the first slice without a range and only range when the answer says it is bigger. - No test reaches the agent's new code. Box 1 of the issue (a path asks bytes a..b, the agent returns that slice and the total) is only tested with a faked box. test/game-agent-exec.test.ts already runs agent.sh: add a case with a tiny local server that honours Range, asserting the
0 <total>flag line for a slice, the 'not a slice' refusal forto < fromand for a span of 600000 or more, and the 206-without-total case from point 1.
Smaller: in the join loop, a slice that returns more bytes than asked pushes
havepasttotaland the oversize file is served; rejectnext.bytes.length > MAP_SLICEorhave > totalas 'not a file'. Slow case worth stating in the docs: 8 MiB is 17 sequential slices, each up to the 12 s wait, so one request can hold a connection and up to 8 MiB for minutes, 24 per person; the 'how it holds up' paragraph in docs/features/game-map.md should say so rather than only the 1.2 MB sync figure.ApprovedEarlier asks, all met on this head: (1) a 206 without a numeric total is
unsized, never ok, and has a 502 sentence plus agent and forge tests; (2) an empty file's 416 on the first slice is asked again whole, and the test through agent.sh shows ok with an empty body; (3) the join loop refuses a slice longer than MAP_SLICE, one that overruns the total, one with a different total, and an empty one; (4) the agent now runs against a Range-honouring stand-in. I tried to break it with: backwards and 600000-wide slices (refused in the agent), a total of 10^12 (413 before any further slice is asked), a server that ignores Range on a later slice (the answer has no total, so it is a 502 and never joined), a 200 whole file of exactly 600 KB (served as before), a total at or below the first slice (served as whole), and a total of*(unsized). Rows are deleted on every path and counted per slice. I found nothing that serves a truncated or oversize file. Two things to do next: (a) require each middle slice to be exactly min(MAP_SLICE, total-have) bytes, because a box that answers short slices turns one request into thousands of 12 s waits; (b) also require the slice's gzip flag to match the first one's. - A truncated file is served as a whole one (agent.sh, the 206 branch). If BlueMap answers 206 with
-
Checks
shipped production is serving it deploy e036110
-
History
- Merge main into the map slices branch 10bf30d
- Game map: a part without a total, a slice longer than asked and an empty file are handled; the agent's slices are tested 17dd3f8
- The terminal and the Apple app's API offer no captain (#18353) 9a9ebf0
- The lane-stopped card carries a Merge action for each green pull waiting on a person (#18348) 67ae93f
- Talk no longer lists, selects or routes to the captain on the web (#18346) 7406da3
- Publishing an app from the tab forge mints the visitor principal, and only then (#18243) 64017fd
- A server's page shows whether its map answers, with the reason, before anyone opens the 3D view (#18349) bca1c31
- The Apple app can list and answer the actions Talk is holding for a person (#18342) 8a995aa
- Keep the slice size and ceiling private to the relay d1a1fdc
- Rewrap comments de249bd
- The Apple app can read the game door, lock it and open a write window, through one JSON route (#18341) 37d7870
- Game map: a file over 600 KB is asked in slices and joined, up to a stated ceiling, else a 413 82b81be
- The game map says which way it failed: not listening, too large, too slow or refused by BlueMap (#18347) f1e92e5
- Full suite red: test/spawn-move-cell-sizes.test.ts (#18340) 6034a7d
- Game door: lock automatically when the player leaves the network, as a setting (#18329) f698c54
- Connections: email_check.verified_at is read nowhere once #18222 lands, and is dropped when no release in play reads it (#18327) 0ccd5dd
- Connections: one place says an email is proven, with the sign-in proof reading it (#18320) 181d662
- Talk opens on the conversation the person was in, at the place they left it (#18322) 3eab8eb
- Universal runner: a Mac registers itself, ships TestFlight from main with the forge's secrets, and has one switch (#18291) 08c168a
- Game door: the desk snapshot carries each player's allowed servers, from whoMayReach (#18325) 9b34956
2 earlier comments
A map file over 600 KB now arrives whole, in slices, instead of failing with a 502. test/games-map.test.ts and the unused-exports test pass, and tsc is clean. I did not run a real BlueMap, and the agent's new curl path has no test, so I only checked agent.sh with bash -n. fast.ts named 2,922 test files for this change, so I ran only the map and unused-exports tests and left the rest to the forge's check.
- Agent (
src/games/agent.sh): a bare path now fetches its first 512,000 bytes withcurl -r. A command text ofpath#from-tofetches that slice, and a slice of 600,000 bytes or more is refused. When BlueMap answers 206, the reply says the whole file's size in its flag line (0 1500000\n<base64>). A server that ignores ranges and sends a whole file of 600 KB or less still works as before. - Joining (
src/games/map.ts):askMapasks the first slice, reads the total from it, then asks the remaining slices one at a time and joins them. Each slice is its own command row, so MAP_PENDING and MAP_PER_PERSON count it. Each row is deleted as it is read. A slice with an unexpected total or no bytes is a 502. - Ceiling: it is 8 MiB, set by
FORGE_GAME_MAP_MOST(in bytes, never below one slice), and the reason is beside it in the code. It rests on the largest BlueMap files being a few MB and on the forge holding all slices in memory until the file is whole. A file past it answers 413 with "…larger than the 8 MB the forge joins…", and no further slice is asked. - Words and docs:
mapWords.tooBignow means a server that ignores ranges and sends over 600 KB, andmapWords.tooLargeis the new 413 sentence.docs/features/game-map.mdis updated. - Tests: a 1.5 MB file arrives byte-identical in three slices, with no rows left. A file declared at 9 MiB is a 413 naming the ceiling, and nothing past the first slice is asked.
- Doors: the page and the terminal both call
askMap, so both gain it. The commit saysNo door:for that reason. - Reused:
queueCommand,commandOf,watchBoxand the existing result path.
I did not parallelize the slices: they go one at a time, so a 1.5 MB file costs about three check-ins, and the 12-second wait now applies to each slice. I also did not add a setting in the games settings UI; it is an environment variable. Agents that predate this change refuse a path#from-to command, so rolling out the new agent is what lets large files through.
I've addressed all three of juniper's points and the smaller ones. The two affected test files (test/games-map.test.ts, test/game-agent-exec.test.ts) pass, and tsc is clean. I didn't run the full suite or scripts/design-lint.ts, since no page changed.
- Truncated file served as whole: a 206 with no numeric total (
bytes 0-511999/*, or no Content-Range) now fails with the wordunsized. The forge turns that into a 502 saying the server gave a part without the whole size (mapWords.unsized). It is never an ok result. - Empty file: a 416 on the first slice (
from= 0) is asked again without-r, so an empty file gives a 200 with an empty body again. The retry has its own curl exit code, sorefused,toobigandslowstill map correctly. - Join loop: a slice longer than
MAP_SLICE, or one that pusheshavepasttotal, is rejected as "not a file" (502). - Test through
agent.sh:test/game-agent-exec.test.tsnow runs the agent against a small local server that honours Range. It asserts:- the
0 700000flag line and the slice lengths (512000 and 188000); - the "not a slice" refusal for
to < fromand for a span of 600000 or more; unsizedfor a 206 without a total;- the empty-file 416 retry giving ok with an empty body.
- the
- Forge side:
test/games-map.test.tshas a new test for the oversized slice and anunsizedcase in the failure-words test. - Docs: the "how it holds up" paragraph in
docs/features/game-map.mdnow says an 8 MiB file is 17 sequential slices, each waiting up to 12 s. One request can hold a connection and up to 8 MiB for minutes, and one person can have 24 of them. The refusals list namesunsized.
I didn't change any web page or terminal screen, so neither door is touched. The gate notes one over-100-column comment line in the test file; it is only a note, and I left it for the nightly rewrap.
I merged main into the branch and pushed it. The merge had one conflict, in docs/features/game-map.md.
- The conflict: both sides had edited the "How it holds up" bullet. I kept my slice-timing and refusal wording there, and added
main's new "Whether it answers, before you open it" section unchanged. I also capitalised the "A first look" sentence, which my earlier edit had left lowercase. - Checks:
tscis clean, and thetest/games-map.test.tsandtest/game-agent-exec.test.tssuites pass (20 tests).scripts/gate.tsonly notes the over-100-column comment intest/game-agent-exec.test.tsagain. I didn't run the full suite; the forge runs it on the push.
A map file over 600 KB now arrives whole, in slices, instead of failing with a 502.
test/games-map.test.tsand the unused-exports test pass, andtscis clean. I did not run a real BlueMap, and the agent's new curl path has no test, so I only checkedagent.shwithbash -n.fast.tsnamed 2,922 test files for this change, so I ran only the map and unused-exports tests and left the rest to the forge's check.src/games/agent.sh): a bare path now fetches its first 512,000 bytes withcurl -r. A command text ofpath#from-tofetches that slice, and a slice of 600,000 bytes or more is refused. When BlueMap answers 206, the reply says the whole file's size in its flag line (0 1500000\n<base64>). A server that ignores ranges and sends a whole file of 600 KB or less still works as before.src/games/map.ts):askMapasks the first slice, reads the total from it, then asks the remaining slices one at a time and joins them. Each slice is its own command row, so MAP_PENDING and MAP_PER_PERSON count it. Each row is deleted as it is read. A slice with an unexpected total or no bytes is a 502.FORGE_GAME_MAP_MOST(in bytes, never below one slice), and the reason is beside it in the code. It rests on the largest BlueMap files being a few MB and on the forge holding all slices in memory until the file is whole. A file past it answers 413 with "…larger than the 8 MB the forge joins…", and no further slice is asked.mapWords.tooBignow means a server that ignores ranges and sends over 600 KB, andmapWords.tooLargeis the new 413 sentence.docs/features/game-map.mdis updated.askMap, so both gain it. The commit saysNo door:for that reason.queueCommand,commandOf,watchBoxand the existing result path.I did not parallelize the slices: they go one at a time, so a 1.5 MB file costs about three check-ins, and the 12-second wait now applies to each slice. I also did not add a setting in the games settings UI; it is an environment variable. Agents that predate this change refuse a
path#from-tocommand, so rolling out the new agent is what lets large files through.Closes #18344