{"draft":null,"from":62,"to":63,"files":[{"path":"client/test/box.test.ts","added":33,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -13,6 +13,7 @@\n \tforgetBox,\n \tlogin,\n \tlogout,\n+\tmintFreeName,\n \tmintKey,\n \treadBox,\n \tsignedInServers,\n@@ -305,3 +306,35 @@\n \t);\n \tassert.equal(serverFrom(args(SERVER), none, h), SERVER, \"--server settles it\");\n });\n+\n+test(\"join with no --agent takes the box's name, skips names this box holds, and moves past a taken one (abso issue 351)\", async () => {\n+\tconst seen: Seen = [];\n+\tconst fetcher = server(\n+\t\t[\n+\t\t\t[200, { box_id: record.id, agents: [{ project: \"abso\", agent: \"snow\", key_id: \"k_0\" }] }],\n+\t\t\t[409, { error: \"that agent name is already in use in this project; pick a new one\" }],\n+\t\t\t[200, { key: \"abso_sk_new\", id: \"k_3\" }],\n+\t\t],\n+\t\tseen,\n+\t);\n+\tconst got = await mintFreeName(record, \"abso\", \"snow\", fetcher);\n+\tassert.deepEqual(got, { key: \"abso_sk_new\", id: \"k_3\", agent: \"snow-3\" });\n+\tassert.deepEqual(\n+\t\tseen.map((s) => [new URL(s.url).pathname, (s.body as { agent?: string } | null)?.agent ?? null]),\n+\t\t[\n+\t\t\t[\"/box\", null],\n+\t\t\t[\"/box/agent-key\", \"snow-2\"],\n+\t\t\t[\"/box/agent-key\", \"snow-3\"],\n+\t\t],\n+\t\t\"snow is this box's already: never minted again, which would replace its key\",\n+\t);\n+\n+\tconst limit = server(\n+\t\t[\n+\t\t\t[200, { box_id: record.id, agents: [] }],\n+\t\t\t[409, { error: \"this box is at its agent limit\" }],\n+\t\t],\n+\t\t[],\n+\t);\n+\tawait assert.rejects(mintFreeName(record, \"abso\", \"snow\", limit), /this box is at its agent limit \\(5\\)/);\n+});"}],"unmatched":[]}