{"draft":null,"from":25,"to":26,"files":[{"path":"client/test/client.test.ts","added":58,"removed":23,"diff":"--- a/client/test/client.test.ts\n+++ b/client/test/client.test.ts\n@@ -20,12 +20,13 @@\n \tutimesSync,\n \twriteFileSync,\n } from \"node:fs\";\n+import { createServer as createHttpServer } from \"node:http\";\n import { type AddressInfo, createServer as createTcpServer } from \"node:net\";\n import { tmpdir } from \"node:os\";\n import { dirname, join, relative, sep } from \"node:path\";\n import { after, before, describe, it } from \"node:test\";\n import { fileURLToPath } from \"node:url\";\n-import { timeoutFor } from \"../src/api.ts\";\n+import { Api, LOG_PAGE, PUBLISH_TIMEOUT_MS, timeoutFor } from \"../src/api.ts\";\n import { parseArgs } from \"../src/args.ts\";\n import { globTest } from \"../src/at.ts\";\n import { forgetBox, readBox, writeBox } from \"../src/box.ts\";\n@@ -1299,27 +1300,6 @@\n \t\t);\n \t\tassert.equal(sh.status, 137);\n \t});\n-\n-\tit(\"sends one run, and takes each command as one quoted word\", async () => {\n-\t\tconst { folders } = await project({ \"a.txt\": \"a\\n\" }, \"alice\");\n-\t\tconst before = fake.runStarts.length;\n-\t\tawait main([\"run\", \"--parallel\", \"npm test\", \"node bench.js\"], {\n-\t\t\tcwd: folders.alice!,\n-\t\t\tenv: ENV,\n-\t\t\twrite: () => {},\n-\t\t\twriteErr: () => {},\n-\t\t});\n-\t\tconst sent = fake.runStarts.slice(before);\n-\t\tassert.equal(sent.length, 1);\n-\t\tassert.ok(sent[0]!.cmd.endsWith(parallelScript([\"npm test\", \"node bench.js\"])), sent[0]!.cmd);\n-\t\tconst bad = await main([\"run\", \"--parallel\", \"--\", \"npm\", \"test\"], {\n-\t\t\tcwd: folders.alice!,\n-\t\t\tenv: ENV,\n-\t\t\twrite: () => {},\n-\t\t});\n-\t\tassert.equal(bad.exit, 1);\n-\t\tassert.match(bad.stderr, /--parallel takes each command as one quoted word/);\n-\t});\n });\n \n describe(\"paths from the server never leave the folder (Security)\", () => {\n@@ -2490,6 +2470,61 @@\n \t\tassert.equal(timeoutFor(30_000, \"x\".repeat(3_000_000)), 60_000);\n \t});\n \n+\tit(\"reads a log longer than the server's page by following next, and starts below --before\", async () => {\n+\t\t// A stand-in for the server's log: versions 0-449, newest first, at most LOG_PAGE a page, as version-log.ts pages.\n+\t\tconst asked: string[] = [];\n+\t\tconst paged = createHttpServer((req, res) => {\n+\t\t\tconst q = new URL(req.url ?? \"\", \"http://x\").searchParams;\n+\t\t\tasked.push(`${q.get(\"limit\")} ${q.get(\"before\") ?? \"-\"}`);\n+\t\t\tconst limit = Math.min(Number(q.get(\"limit\") ?? 50), LOG_PAGE);\n+\t\t\tlet v = Math.min(449, Number(q.get(\"before\") ?? 450) - 1);\n+\t\t\tconst versions = [];\n+\t\t\tfor (; v >= 0 && versions.length < limit; v--)\n+\t\t\t\tversions.push({ version: v, agent: \"a\", message: `v${v}`, time: 0, files: [] });\n+\t\t\tconst next = v >= 0 && versions.length > 0 ? versions[versions.length - 1]!.version : undefined;\n+\t\t\tres.writeHead(200, { \"content-type\": \"application/json\" });\n+\t\t\tres.end(JSON.stringify({ draft: null, version: 449, versions, ...(next !== undefined ? { next } : {}) }));\n+\t\t});\n+\t\tawait new Promise<void>((ok) => paged.listen(0, \"127.0.0.1\", ok));\n+\t\ttry {\n+\t\t\tconst server = `http://127.0.0.1:${(paged.address() as AddressInfo).port}`;\n+\t\t\tconst api = new Api({ server, project: \"p\", agent: \"a\", token: \"t\" } as ConstructorParameters<typeof Api>[0]);\n+\t\t\tconst all = await api.log({ draft: null }, 2000);\n+\t\t\tassert.equal(all.versions.length, 450);\n+\t\t\tassert.deepEqual([all.versions[0]!.version, all.versions[449]!.version], [449, 0]);\n+\t\t\tassert.equal(all.next, undefined, \"nothing older is left\");\n+\t\t\tassert.deepEqual(asked, [\"200 -\", \"200 250\", \"200 50\"]);\n+\t\t\tconst some = await api.log({ draft: null }, 250, undefined, 300);\n+\t\t\tassert.deepEqual([some.versions[0]!.version, some.versions.at(-1)!.version, some.next], [299, 50, 50]);\n+\t\t\tassert.equal((await api.log({ draft: null })).versions.length, 50, \"no -n: the server's own default, one page\");\n+\t\t} finally {\n+\t\t\tpaged.closeAllConnections();\n+\t\t\tawait new Promise((ok) => paged.close(ok));\n+\t\t}\n+\t});\n+\n+\tit(\"waits for a publish and a land as long as the server may work on them, past the base timeout\", async () => {\n+\t\tassert.ok(PUBLISH_TIMEOUT_MS > 120_000, \"longer than the server's 2 minutes for one request\");\n+\t\t// Every answer comes after 300 ms; the client's base timeout here is 100 ms.\n+\t\tconst slow = createHttpServer((_req, res) => {\n+\t\t\tsetTimeout(() => res.writeHead(200, { \"content-type\": \"application/json\" }).end('{\"version\": 7}'), 300);\n+\t\t});\n+\t\tawait new Promise<void>((ok) => slow.listen(0, \"127.0.0.1\", ok));\n+\t\ttry {\n+\t\t\tconst server = `http://127.0.0.1:${(slow.address() as AddressInfo).port}`;\n+\t\t\tconst api = new Api(\n+\t\t\t\t{ server, project: \"p\", agent: \"a\", token: \"t\" } as ConstructorParameters<typeof Api>[0],\n+\t\t\t\t100,\n+\t\t\t);\n+\t\t\tassert.deepEqual(await api.publish(\"slow\"), { version: 7 });\n+\t\t\tassert.deepEqual(await api.land(\"slow\"), { version: 7 });\n+\t\t\tawait assert.rejects(api.json(\"GET\", \"/status\"), /no answer within 100 ms/);\n+\t\t} finally {\n+\t\t\tslow.closeAllConnections();\n+\t\t\tawait new Promise((ok) => slow.close(ok));\n+\t\t}\n+\t});\n+\n \tit(\"lists a change by its message's first line, and an import's commit as a short hash (#43, Git Lessons)\", () => {\n \t\tconst imported =\n \t\t\t\"Issues' own Worker: the skeleton\\n\\nA long body\\nover lines.\\n\\ngit ad107af03b56, Alex Rivera, 2026-10-07T14:00:00-05:00\";\n@@ -4086,7 +4121,7 @@\n \t\tconst logText = await main([\"log\", \"-n\", \"1\"], { cwd: alice, env: ENV, write: () => {} });\n \t\tassert.match(\n \t\t\tlogText.stdout,\n-\t\t\t/^shared is at version 2\\.\\nversion 2 by bob, .* UTC: bob: change b\\n {2}1 file: b\\.txt\\nOlder versions: abso log -n 51\\n$/,\n+\t\t\t/^shared is at version 2\\.\\nversion 2 by bob, .* UTC: bob: change b\\n {2}1 file: b\\.txt\\nOlder versions: abso log --before 2\\n$/,\n \t\t);\n \n \t\tconst show = await avcs(alice, \"show\", \"1\");"}],"unmatched":[]}