{"path":"client/test/issues.test.ts","version":2,"newest":2,"draft":"login-timeout","agent":null,"exists":true,"lines":[{"n":1,"text":"// The Issues commands (#54) as far as the client alone decides them: which","author":"init","version":0},{"n":2,"text":"// Issues Worker a folder talks to, whether the token may go there, the MCP","author":"init","version":0},{"n":3,"text":"// tools, and the usage mistakes refused before any call. The Issues server","author":"init","version":0},{"n":4,"text":"// here is a stand-in that only counts calls; the commands against the real","author":"init","version":0},{"n":5,"text":"// store are issues/test/client-commands.test.ts, on the platform side (abso","author":"init","version":0},{"n":6,"text":"// issue 141).","author":"init","version":0},{"n":7,"text":"","author":"init","version":0},{"n":8,"text":"import assert from \"node:assert/strict\";","author":"init","version":0},{"n":9,"text":"import { mkdtempSync, rmSync, writeFileSync } from \"node:fs\";","author":"init","version":0},{"n":10,"text":"import { createServer, type Server } from \"node:http\";","author":"init","version":0},{"n":11,"text":"import type { AddressInfo } from \"node:net\";","author":"init","version":0},{"n":12,"text":"import { tmpdir } from \"node:os\";","author":"init","version":0},{"n":13,"text":"import { join } from \"node:path\";","author":"init","version":0},{"n":14,"text":"import { after, before, describe, it } from \"node:test\";","author":"init","version":0},{"n":15,"text":"import { readConfig, readMachineServers } from \"../src/config.ts\";","author":"pinch","version":23},{"n":16,"text":"import { issuesServerFor, tokenGoesTo } from \"../src/core.ts\";","author":"init","version":0},{"n":17,"text":"import { issuePage, searchLines } from \"../src/issues.ts\";","author":"pinch","version":53},{"n":18,"text":"import type { IssuePage } from \"../src/issues-wire.ts\";","author":"pinch","version":53},{"n":19,"text":"import { main } from \"../src/main.ts\";","author":"init","version":0},{"n":20,"text":"import { argvFor, mcpTools } from \"../src/mcp.ts\";","author":"init","version":0},{"n":21,"text":"import { type Fake, startFake } from \"./fake-server.ts\";","author":"init","version":0},{"n":22,"text":"","author":"init","version":0},{"n":23,"text":"const TOKEN = \"test-token-not-secret\";","author":"init","version":0},{"n":24,"text":"","author":"init","version":0},{"n":25,"text":"let fake: Fake;","author":"init","version":0},{"n":26,"text":"let issues: Server;","author":"init","version":0},{"n":27,"text":"let issuesUrl: string;","author":"init","version":0},{"n":28,"text":"/** Every call the stand-in Issues server took. */","author":"init","version":0},{"n":29,"text":"const seen: string[] = [];","author":"init","version":0},{"n":30,"text":"/** The bodies of the copy requests it took. */","author":"pinch","version":23},{"n":31,"text":"const copies: Record<string, unknown>[] = [];","author":"pinch","version":23},{"n":32,"text":"const dirs: string[] = [];","author":"init","version":0},{"n":33,"text":"","author":"init","version":0},{"n":34,"text":"before(async () => {","author":"init","version":0},{"n":35,"text":"\tfake = await startFake(0, TOKEN);","author":"init","version":0},{"n":36,"text":"\tissues = createServer((req, res) => {","author":"init","version":0},{"n":37,"text":"\t\tseen.push(`${req.method} ${req.url}`);","author":"init","version":0},{"n":38,"text":"\t\tconst send = (status: number, body: unknown) =>","author":"pinch","version":23},{"n":39,"text":"\t\t\tres.writeHead(status, { \"content-type\": \"application/json\" }).end(JSON.stringify(body));","author":"pinch","version":23},{"n":40,"text":"\t\tif (req.method === \"POST\" && /\\/copy$/.test(req.url ?? \"\")) {","author":"pinch","version":23},{"n":41,"text":"\t\t\tlet raw = \"\";","author":"pinch","version":23},{"n":42,"text":"\t\t\treq.on(\"data\", (c: Buffer) => (raw += c.toString(\"utf8\")));","author":"pinch","version":23},{"n":43,"text":"\t\t\treq.on(\"end\", () => {","author":"pinch","version":23},{"n":44,"text":"\t\t\t\tconst body = JSON.parse(raw) as Record<string, unknown>;","author":"pinch","version":23},{"n":45,"text":"\t\t\t\tcopies.push(body);","author":"pinch","version":23},{"n":46,"text":"\t\t\t\t// Issue 403 stands for a live server refusing an agent's copy.","author":"pinch","version":23},{"n":47,"text":"\t\t\t\tif (body.issue === 403 && body.dryRun !== true)","author":"pinch","version":23},{"n":48,"text":"\t\t\t\t\treturn send(403, { error: \"copying an issue out of its project takes an owner of that project\" });","author":"pinch","version":23},{"n":49,"text":"\t\t\t\tconst skipped = { comments: [4], asks: [2] };","author":"pinch","version":23},{"n":50,"text":"\t\t\t\tif (body.dryRun === true)","author":"pinch","version":23},{"n":51,"text":"\t\t\t\t\treturn send(200, {","author":"pinch","version":23},{"n":52,"text":"\t\t\t\t\t\tdryRun: true,","author":"pinch","version":23},{"n":53,"text":"\t\t\t\t\t\tplan: {","author":"pinch","version":23},{"n":54,"text":"\t\t\t\t\t\t\tfrom: { project: body.from, issue: body.issue },","author":"pinch","version":23},{"n":55,"text":"\t\t\t\t\t\t\ttitle: \"Sync is slow\",","author":"pinch","version":23},{"n":56,"text":"\t\t\t\t\t\t\tedited: [\"description\"],","author":"pinch","version":23},{"n":57,"text":"\t\t\t\t\t\t\tlabels: [\"client\"],","author":"pinch","version":23},{"n":58,"text":"\t\t\t\t\t\t\tclosed: { how: \"done\" },","author":"pinch","version":23},{"n":59,"text":"\t\t\t\t\t\t\tcomments: [{ edited: false }, { edited: true }],","author":"pinch","version":23},{"n":60,"text":"\t\t\t\t\t\t\tasks: [{ edited: false }],","author":"pinch","version":23},{"n":61,"text":"\t\t\t\t\t\t\tskipped,","author":"pinch","version":23},{"n":62,"text":"\t\t\t\t\t\t},","author":"pinch","version":23},{"n":63,"text":"\t\t\t\t\t});","author":"pinch","version":23},{"n":64,"text":"\t\t\t\tsend(200, { ok: true, id: 31, from: { project: body.from, issue: body.issue }, skipped });","author":"pinch","version":23},{"n":65,"text":"\t\t\t});","author":"pinch","version":23},{"n":66,"text":"\t\t\treturn;","author":"pinch","version":23},{"n":67,"text":"\t\t}","author":"pinch","version":23},{"n":68,"text":"\t\t// An ack answers with the ask, acknowledged and still open.","author":"pinch","version":53},{"n":69,"text":"\t\tconst ack = /\\/a\\/([^/]+)\\/ack\\/(\\d+)$/.exec(req.url ?? \"\");","author":"pinch","version":53},{"n":70,"text":"\t\tif (req.method === \"POST\" && ack)","author":"pinch","version":53},{"n":71,"text":"\t\t\treturn send(200, {","author":"pinch","version":53},{"n":72,"text":"\t\t\t\task: { id: Number(ack[2]), by: \"desk\", of: ack[1], answer: null, ack: { at: Date.now(), note: \"\" } },","author":"pinch","version":53},{"n":73,"text":"\t\t\t});","author":"pinch","version":53},{"n":74,"text":"\t\tsend(500, { error: \"a stand-in\" });","author":"pinch","version":23},{"n":75,"text":"\t});","author":"init","version":0},{"n":76,"text":"\tawait new Promise<void>((ok) => issues.listen(0, \"127.0.0.1\", ok));","author":"init","version":0},{"n":77,"text":"\tissuesUrl = `http://127.0.0.1:${(issues.address() as AddressInfo).port}`;","author":"init","version":0},{"n":78,"text":"});","author":"init","version":0},{"n":79,"text":"after(async () => {","author":"init","version":0},{"n":80,"text":"\tawait fake.close();","author":"init","version":0},{"n":81,"text":"\tawait new Promise((ok) => issues.close(ok));","author":"init","version":0},{"n":82,"text":"\tfor (const d of dirs) rmSync(d, { recursive: true, force: true, maxRetries: 5 });","author":"init","version":0},{"n":83,"text":"});","author":"init","version":0},{"n":84,"text":"","author":"init","version":0},{"n":85,"text":"const ENV = (): Record<string, string> => ({","author":"init","version":0},{"n":86,"text":"\tAVCS_TOKEN: TOKEN,","author":"init","version":0},{"n":87,"text":"\tAVCS_HOOK_FORCE: \"1\",","author":"init","version":0},{"n":88,"text":"\tAVCS_ISSUES_SERVER: issuesUrl,","author":"init","version":0},{"n":89,"text":"\tAVCS_SERVERS_FILE: \"no-servers.json\",","author":"init","version":0},{"n":90,"text":"});","author":"init","version":0},{"n":91,"text":"","author":"init","version":0},{"n":92,"text":"async function avcs(","author":"init","version":0},{"n":93,"text":"\tcwd: string,","author":"init","version":0},{"n":94,"text":"\targv: string[],","author":"init","version":0},{"n":95,"text":"\tenv: Record<string, string> = ENV(),","author":"init","version":0},{"n":96,"text":"): Promise<{ exit: number; out: string }> {","author":"init","version":0},{"n":97,"text":"\tconst r = await main([...argv, \"--json\"], { cwd, env, write: () => {} });","author":"init","version":0},{"n":98,"text":"\treturn { exit: r.exit, out: r.stdout + r.stderr };","author":"init","version":0},{"n":99,"text":"}","author":"init","version":0},{"n":100,"text":"","author":"init","version":0},{"n":101,"text":"let projects = 0;","author":"init","version":0},{"n":102,"text":"async function folder(agent: string): Promise<string> {","author":"init","version":0},{"n":103,"text":"\tconst dir = mkdtempSync(join(tmpdir(), \"avcs-issues-\"));","author":"init","version":0},{"n":104,"text":"\tdirs.push(dir);","author":"init","version":0},{"n":105,"text":"\tconst r = await avcs(dir, [\"init\", \"--server\", fake.url, \"--project\", `issues${++projects}`, \"--agent\", agent]);","author":"init","version":0},{"n":106,"text":"\tassert.equal(r.exit, 0, r.out);","author":"init","version":0},{"n":107,"text":"\treturn dir;","author":"init","version":0},{"n":108,"text":"}","author":"init","version":0},{"n":109,"text":"","author":"init","version":0},{"n":110,"text":"describe(\"issues commands, the client's part (#54)\", () => {","author":"init","version":0},{"n":111,"text":"\tit(\"sends the token only to an Issues Worker it trusts\", async () => {","author":"init","version":0},{"n":112,"text":"\t\tconst dave = await folder(\"dave\");","author":"init","version":0},{"n":113,"text":"\t\tconst before = seen.length;","author":"init","version":0},{"n":114,"text":"\t\tconst r = await avcs(dave, [\"issues\"], { ...ENV(), AVCS_ISSUES_SERVER: \"https://issues.example.com\" });","author":"init","version":0},{"n":115,"text":"\t\tassert.equal(r.exit, 1, r.out);","author":"init","version":0},{"n":116,"text":"\t\tassert.match(r.out, /sends your token only to its own servers and this machine/);","author":"init","version":0},{"n":117,"text":"\t\tassert.equal(seen.length, before);","author":"init","version":0},{"n":118,"text":"\t\t// A server with no Issues Worker beside it, and none named.","author":"init","version":0},{"n":119,"text":"\t\tconst { AVCS_ISSUES_SERVER: _, ...without } = ENV();","author":"init","version":0},{"n":120,"text":"\t\tconst none = await avcs(dave, [\"waiting\"], without);","author":"init","version":0},{"n":121,"text":"\t\tassert.notEqual(none.exit, 0);","author":"init","version":0},{"n":122,"text":"\t\tassert.match(","author":"init","version":0},{"n":123,"text":"\t\t\tnone.out,","author":"init","version":0},{"n":124,"text":"\t\t\t/has no Issues Worker beside it that abso knows; ~\\/\\.abso\\/servers\\.json or ABSO_ISSUES_SERVER names one/,","author":"review","version":27},{"n":125,"text":"\t\t);","author":"init","version":0},{"n":126,"text":"\t});","author":"init","version":0},{"n":127,"text":"","author":"init","version":0},{"n":128,"text":"\tit(\"finds a server's Issues Worker in this machine's servers.json, and may send it the token\", async () => {","author":"init","version":0},{"n":129,"text":"\t\tconst dir = mkdtempSync(join(tmpdir(), \"abso-servers-\"));","author":"init","version":0},{"n":130,"text":"\t\tdirs.push(dir);","author":"init","version":0},{"n":131,"text":"\t\tconst file = join(dir, \"servers.json\");","author":"init","version":0},{"n":132,"text":"\t\twriteFileSync(file, JSON.stringify({ servers: { [fake.url]: { issues: issuesUrl } } }));","author":"init","version":0},{"n":133,"text":"\t\tconst erin = await folder(\"erin\");","author":"init","version":0},{"n":134,"text":"\t\tconst before = seen.length;","author":"init","version":0},{"n":135,"text":"\t\tconst { AVCS_ISSUES_SERVER: _, ...without } = ENV();","author":"init","version":0},{"n":136,"text":"\t\tawait avcs(erin, [\"waiting\"], { ...without, AVCS_SERVERS_FILE: file });","author":"init","version":0},{"n":137,"text":"\t\tassert.ok(seen.length > before, \"the call went to the Issues Worker servers.json names\");","author":"init","version":0},{"n":138,"text":"\t\tconst machine = readMachineServers({ AVCS_SERVERS_FILE: file });","author":"init","version":0},{"n":139,"text":"\t\tassert.equal(issuesServerFor(fake.url, machine), issuesUrl);","author":"init","version":0},{"n":140,"text":"\t\tassert.equal(issuesServerFor(\"https://abso.example\", machine), undefined);","author":"init","version":0},{"n":141,"text":"\t\t// abso's own server and its Issues Worker are built in.","author":"init","version":0},{"n":142,"text":"\t\tassert.ok(tokenGoesTo(\"https://api.abso.dev\"));","author":"init","version":0},{"n":143,"text":"\t\tassert.ok(tokenGoesTo(\"https://issues.abso.dev\"));","author":"init","version":0},{"n":144,"text":"\t\tassert.equal(issuesServerFor(\"https://api.abso.dev/\"), \"https://issues.abso.dev\");","author":"init","version":0},{"n":145,"text":"\t});","author":"init","version":0},{"n":146,"text":"","author":"init","version":0},{"n":147,"text":"\tit(\"are MCP tools\", () => {","author":"init","version":0},{"n":148,"text":"\t\tconst names = mcpTools().map((t) => t.name);","author":"init","version":0},{"n":149,"text":"\t\tfor (const n of [\"issues\", \"issue\", \"search\", \"ask\", \"waiting\", \"answer\"]) assert.ok(names.includes(n), n);","author":"devops","version":20},{"n":150,"text":"\t\tassert.deepEqual(argvFor(\"ask\", { args: [\"alice\", \"Which login?\"], issue: \"3\", review: true }), [","author":"init","version":0},{"n":151,"text":"\t\t\t\"ask\",","author":"init","version":0},{"n":152,"text":"\t\t\t\"--issue=3\",","author":"init","version":0},{"n":153,"text":"\t\t\t\"--review\",","author":"init","version":0},{"n":154,"text":"\t\t\t\"--\",","author":"init","version":0},{"n":155,"text":"\t\t\t\"alice\",","author":"init","version":0},{"n":156,"text":"\t\t\t\"Which login?\",","author":"init","version":0},{"n":157,"text":"\t\t]);","author":"init","version":0},{"n":158,"text":"\t});","author":"init","version":0},{"n":159,"text":"","author":"init","version":0},{"n":160,"text":"\tit(\"refuses usage mistakes before any call\", async () => {","author":"init","version":0},{"n":161,"text":"\t\tconst erin = await folder(\"erin\");","author":"init","version":0},{"n":162,"text":"\t\tconst before = seen.length;","author":"init","version":0},{"n":163,"text":"\t\tfor (const argv of [","author":"init","version":0},{"n":164,"text":"\t\t\t[\"issue\"],","author":"init","version":0},{"n":165,"text":"\t\t\t[\"issue\", \"x\"],","author":"init","version":0},{"n":166,"text":"\t\t\t[\"ask\", \"alice\"],","author":"init","version":0},{"n":167,"text":"\t\t\t[\"ask\", \"a\", \"q\", \"--review\", \"--task\"],","author":"init","version":0},{"n":168,"text":"\t\t\t[\"answer\", \"3\"],","author":"init","version":0},{"n":169,"text":"\t\t\t[\"issue\", \"1\", \"--comment\", \"a\", \"--drop\"],","author":"init","version":0},{"n":170,"text":"\t\t\t[\"issues\", \"extra\"],","author":"init","version":0},{"n":171,"text":"\t\t\t[\"ask\", \"--withdraw\", \"x\"],","author":"infra-split","version":14},{"n":172,"text":"\t\t\t[\"ask\", \"--withdraw\", \"3\", \"alice\", \"q\"],","author":"infra-split","version":14},{"n":173,"text":"\t\t\t[\"ask\", \"--withdraw\", \"3\", \"--issue\", \"2\"],","author":"infra-split","version":14},{"n":174,"text":"\t\t\t[\"ask\", \"--withdraw\", \"3\", \"--task\"],","author":"infra-split","version":14},{"n":175,"text":"\t\t\t[\"ask\", \"alice\", \"q\", \"--note\", \"a note without --withdraw\"],","author":"infra-split","version":14},{"n":176,"text":"\t\t\t[\"search\"],","author":"devops","version":20},{"n":177,"text":"\t\t\t[\"search\", \"words\", \"--limit\", \"0\"],","author":"devops","version":20},{"n":178,"text":"\t\t\t[\"search\", \"words\", \"--limit\", \"51\"],","author":"devops","version":20},{"n":179,"text":"\t\t]) {","author":"init","version":0},{"n":180,"text":"\t\t\tconst r = await avcs(erin, argv);","author":"init","version":0},{"n":181,"text":"\t\t\tassert.equal(r.exit, 1, `${argv.join(\" \")}: ${r.out}`);","author":"init","version":0},{"n":182,"text":"\t\t}","author":"init","version":0},{"n":183,"text":"\t\tassert.equal(seen.length, before);","author":"init","version":0},{"n":184,"text":"\t});","author":"infra-split","version":14},{"n":185,"text":"","author":"infra-split","version":14},{"n":186,"text":"\tit(\"shows a search hit as the issue, then where it matched, without the match markers\", () => {","author":"devops","version":20},{"n":187,"text":"\t\tconst issue = { id: 12, title: \"Sync is slow\", status: \"open\" as const, updated: 0, labels: [] };","author":"devops","version":20},{"n":188,"text":"\t\tassert.deepEqual(","author":"devops","version":20},{"n":189,"text":"\t\t\tsearchLines({ issue, where: \"comment\", comment: 40, snippet: \"the \\u0001network\\u0002 drops mid-sync\" }),","author":"devops","version":20},{"n":190,"text":"\t\t\t['   12  open         \"Sync is slow\"', '       in comment 40: \"the network drops mid-sync\"'],","author":"devops","version":20},{"n":191,"text":"\t\t);","author":"devops","version":20},{"n":192,"text":"\t\tassert.deepEqual(searchLines({ issue, where: \"description\", snippet: \"Pages load late.\", meaning: true }), [","author":"devops","version":20},{"n":193,"text":"\t\t\t'   12  open         \"Sync is slow\"',","author":"devops","version":20},{"n":194,"text":"\t\t\t'       by meaning: \"Pages load late.\"',","author":"devops","version":20},{"n":195,"text":"\t\t]);","author":"devops","version":20},{"n":196,"text":"\t\tassert.deepEqual(searchLines({ issue, where: \"title\", snippet: \"Sync is slow\" })[1], \"       in the title\");","author":"devops","version":20},{"n":197,"text":"\t});","author":"devops","version":20},{"n":198,"text":"","author":"devops","version":20},{"n":199,"text":"\tit(\"withdraw is one POST to the asker's own withdraw/<ask> route\", async () => {","author":"infra-split","version":14},{"n":200,"text":"\t\tconst erin = await folder(\"erin\");","author":"infra-split","version":14},{"n":201,"text":"\t\tconst before = seen.length;","author":"infra-split","version":14},{"n":202,"text":"\t\tawait avcs(erin, [\"ask\", \"--withdraw\", \"#3\", \"--note\", \"overtaken by later decisions\"]);","author":"infra-split","version":14},{"n":203,"text":"\t\tconst posts = seen.slice(before).filter((s) => s.startsWith(\"POST\"));","author":"infra-split","version":14},{"n":204,"text":"\t\tassert.equal(posts.length, 1, posts.join(\"\\n\"));","author":"infra-split","version":14},{"n":205,"text":"\t\tassert.match(posts[0]!, /^POST \\/p\\/issues\\d+\\/a\\/erin\\/withdraw\\/3$/);","author":"infra-split","version":14},{"n":206,"text":"\t});","author":"pinch","version":53},{"n":207,"text":"","author":"pinch","version":53},{"n":208,"text":"\tit(\"ack is one POST to the one asked's ack/<ask> route, and says the ask stays open\", async () => {","author":"pinch","version":53},{"n":209,"text":"\t\tconst fay = await folder(\"fay\");","author":"pinch","version":53},{"n":210,"text":"\t\tconst before = seen.length;","author":"pinch","version":53},{"n":211,"text":"\t\tconst r = await main([\"ack\", \"7\", \"on it after the deploy\"], { cwd: fay, env: ENV(), write: () => {} });","author":"pinch","version":53},{"n":212,"text":"\t\tassert.equal(r.exit, 0, r.stdout + r.stderr);","author":"pinch","version":53},{"n":213,"text":"\t\tassert.equal(r.stdout, 'Acknowledged ask 7. desk hears it; the ask stays open until abso answer 7 \"...\".\\n');","author":"pinch","version":53},{"n":214,"text":"\t\tconst posts = seen.slice(before).filter((s) => s.startsWith(\"POST\"));","author":"pinch","version":53},{"n":215,"text":"\t\tassert.deepEqual(posts.length, 1, posts.join(\"\\n\"));","author":"pinch","version":53},{"n":216,"text":"\t\tassert.match(posts[0]!, /^POST \\/p\\/issues\\d+\\/a\\/fay\\/ack\\/7$/);","author":"pinch","version":53},{"n":217,"text":"\t\tassert.equal((await main([\"ack\"], { cwd: fay, env: ENV(), write: () => {} })).exit, 1);","author":"pinch","version":53},{"n":218,"text":"\t});","author":"pinch","version":53},{"n":219,"text":"","author":"pinch","version":53},{"n":220,"text":"\tit(\"an acknowledged ask reads as acknowledged, not answered, with the note under it\", () => {","author":"pinch","version":53},{"n":221,"text":"\t\tconst ask = {","author":"pinch","version":53},{"n":222,"text":"\t\t\tid: 7,","author":"pinch","version":53},{"n":223,"text":"\t\t\tissue: 3,","author":"pinch","version":53},{"n":224,"text":"\t\t\tby: \"desk\",","author":"pinch","version":53},{"n":225,"text":"\t\t\tof: \"fay\",","author":"pinch","version":53},{"n":226,"text":"\t\t\tkind: \"question\",","author":"pinch","version":53},{"n":227,"text":"\t\t\tquestion: \"Which way?\",","author":"pinch","version":53},{"n":228,"text":"\t\t\treview: false,","author":"pinch","version":53},{"n":229,"text":"\t\t\tdue: null,","author":"pinch","version":53},{"n":230,"text":"\t\t\trecommendation: null,","author":"pinch","version":53},{"n":231,"text":"\t\t\toptions: [],","author":"pinch","version":53},{"n":232,"text":"\t\t\tblocks: [],","author":"pinch","version":53},{"n":233,"text":"\t\t\tat: 0,","author":"pinch","version":53},{"n":234,"text":"\t\t\tanswer: null,","author":"pinch","version":53},{"n":235,"text":"\t\t\tseen: 0,","author":"pinch","version":53},{"n":236,"text":"\t\t\tack: { at: 0, note: \"on it after the deploy\" },","author":"pinch","version":53},{"n":237,"text":"\t\t};","author":"pinch","version":53},{"n":238,"text":"\t\tconst page = {","author":"pinch","version":53},{"n":239,"text":"\t\t\tissue: {","author":"pinch","version":53},{"n":240,"text":"\t\t\t\tid: 3,","author":"pinch","version":53},{"n":241,"text":"\t\t\t\ttitle: \"t\",","author":"pinch","version":53},{"n":242,"text":"\t\t\t\tstatus: \"blocked\",","author":"pinch","version":53},{"n":243,"text":"\t\t\t\tparent: null,","author":"pinch","version":53},{"n":244,"text":"\t\t\t\topened: { by: \"desk\", at: 0 },","author":"pinch","version":53},{"n":245,"text":"\t\t\t\tagent: null,","author":"pinch","version":53},{"n":246,"text":"\t\t\t\tagents: [],","author":"pinch","version":53},{"n":247,"text":"\t\t\t\tblockedBy: [],","author":"pinch","version":53},{"n":248,"text":"\t\t\t\tlabels: [],","author":"pinch","version":53},{"n":249,"text":"\t\t\t\tversions: [],","author":"pinch","version":53},{"n":250,"text":"\t\t\t\twaitingOn: [\"fay\"],","author":"pinch","version":53},{"n":251,"text":"\t\t\t\tclosed: null,","author":"pinch","version":53},{"n":252,"text":"\t\t\t\tdescription: \"\",","author":"pinch","version":53},{"n":253,"text":"\t\t\t\tlines: null,","author":"pinch","version":53},{"n":254,"text":"\t\t\t\twatchers: [],","author":"pinch","version":53},{"n":255,"text":"\t\t\t},","author":"pinch","version":53},{"n":256,"text":"\t\t\tcomments: [],","author":"pinch","version":53},{"n":257,"text":"\t\t\tedits: [],","author":"pinch","version":53},{"n":258,"text":"\t\t\tasks: [ask],","author":"pinch","version":53},{"n":259,"text":"\t\t\tclaims: [],","author":"pinch","version":53},{"n":260,"text":"\t\t\tchildren: [],","author":"pinch","version":53},{"n":261,"text":"\t\t} as unknown as IssuePage;","author":"pinch","version":53},{"n":262,"text":"\t\tconst text = issuePage(page).join(\"\\n\");","author":"pinch","version":53},{"n":263,"text":"\t\tassert.match(","author":"pinch","version":53},{"n":264,"text":"\t\t\ttext,","author":"pinch","version":53},{"n":265,"text":"\t\t\t/\\n {2}ask 7: desk, [^\\n]*asks fay a question on issue 3 \\(acknowledged [^;)]+, not answered yet\\): \"Which way\\?\"\\n {4}fay acknowledged: \"on it after the deploy\"/,","author":"pinch","version":53},{"n":266,"text":"\t\t);","author":"pinch","version":53},{"n":267,"text":"\t\tassert.doesNotMatch(text, /answer:/);","author":"pinch","version":53},{"n":268,"text":"\t\tconst answered = { ...ask, answer: { by: \"fay\", words: \"This way\", at: 0 } };","author":"pinch","version":53},{"n":269,"text":"\t\tconst later = issuePage({ ...page, asks: [answered] } as unknown as IssuePage).join(\"\\n\");","author":"pinch","version":53},{"n":270,"text":"\t\tassert.doesNotMatch(later, /acknowledged/, \"an answer replaces the ack\");","author":"pinch","version":53},{"n":271,"text":"\t});","author":"pinch","version":23},{"n":272,"text":"});","author":"pinch","version":23},{"n":273,"text":"","author":"pinch","version":23},{"n":274,"text":"describe(\"abso issue <N> --copy-to <project>\", () => {","author":"pinch","version":23},{"n":275,"text":"\tconst text = async (cwd: string, argv: string[]) => {","author":"pinch","version":23},{"n":276,"text":"\t\tconst r = await main(argv, { cwd, env: ENV(), write: () => {} });","author":"pinch","version":23},{"n":277,"text":"\t\treturn { exit: r.exit, out: r.stdout + r.stderr };","author":"pinch","version":23},{"n":278,"text":"\t};","author":"pinch","version":23},{"n":279,"text":"","author":"pinch","version":23},{"n":280,"text":"\tit(\"a dry run asks the other project's copy route for the plan, and says nothing was written\", async () => {","author":"pinch","version":23},{"n":281,"text":"\t\tconst gil = await folder(\"gil\");","author":"pinch","version":23},{"n":282,"text":"\t\tconst before = seen.length;","author":"pinch","version":23},{"n":283,"text":"\t\tconst r = await text(gil, [\"issue\", \"12\", \"--copy-to\", \"core\", \"--dry-run\"]);","author":"pinch","version":23},{"n":284,"text":"\t\tassert.equal(r.exit, 0, r.out);","author":"pinch","version":23},{"n":285,"text":"\t\tassert.deepEqual(seen.slice(before), [\"POST /p/core/a/gil/copy\"]);","author":"pinch","version":23},{"n":286,"text":"\t\tconst from = (copies.at(-1) as { from: string }).from;","author":"pinch","version":23},{"n":287,"text":"\t\tassert.match(from, /^issues\\d+$/);","author":"pinch","version":23},{"n":288,"text":"\t\tassert.deepEqual(copies.at(-1), { from, issue: 12, dryRun: true });","author":"pinch","version":23},{"n":289,"text":"\t\tassert.equal(","author":"pinch","version":23},{"n":290,"text":"\t\t\tr.out.trimEnd(),","author":"pinch","version":23},{"n":291,"text":"\t\t\t[","author":"pinch","version":23},{"n":292,"text":"\t\t\t\t`A dry run: nothing was written. Copying ${from} issue 12 into core would make:`,","author":"pinch","version":23},{"n":293,"text":"\t\t\t\t`  \"Sync is slow\", done (description edited when copied)`,","author":"pinch","version":23},{"n":294,"text":"\t\t\t\t\"  2 comments (1 edited), 1 answered ask, labelled client\",","author":"pinch","version":23},{"n":295,"text":"\t\t\t\t\"  not copied: comments 4; asks 2 (open asks, and what --clean left out)\",","author":"pinch","version":23},{"n":296,"text":"\t\t\t\t\"Run it again without --dry-run to copy it.\",","author":"pinch","version":23},{"n":297,"text":"\t\t\t].join(\"\\n\"),","author":"pinch","version":23},{"n":298,"text":"\t\t);","author":"pinch","version":23},{"n":299,"text":"\t});","author":"pinch","version":23},{"n":300,"text":"","author":"pinch","version":23},{"n":301,"text":"\tit(\"copies with the cleaned texts --clean gives, by source id\", async () => {","author":"pinch","version":23},{"n":302,"text":"\t\tconst gil = await folder(\"gil\");","author":"pinch","version":23},{"n":303,"text":"\t\twriteFileSync(","author":"pinch","version":23},{"n":304,"text":"\t\t\tjoin(gil, \"clean.json\"),","author":"pinch","version":23},{"n":305,"text":"\t\t\tJSON.stringify({ description: \"Cleaned.\", comments: [{ id: 1 }, { id: 3, text: \"Cleaned too.\" }] }),","author":"pinch","version":23},{"n":306,"text":"\t\t);","author":"pinch","version":23},{"n":307,"text":"\t\tconst r = await text(gil, [\"issue\", \"12\", \"--copy-to\", \"core\", \"--clean\", \"clean.json\"]);","author":"pinch","version":23},{"n":308,"text":"\t\tassert.equal(r.exit, 0, r.out);","author":"pinch","version":23},{"n":309,"text":"\t\tconst from = (copies.at(-1) as { from: string }).from;","author":"pinch","version":23},{"n":310,"text":"\t\tassert.deepEqual(copies.at(-1), {","author":"pinch","version":23},{"n":311,"text":"\t\t\tdescription: \"Cleaned.\",","author":"pinch","version":23},{"n":312,"text":"\t\t\tcomments: [{ id: 1 }, { id: 3, text: \"Cleaned too.\" }],","author":"pinch","version":23},{"n":313,"text":"\t\t\tfrom,","author":"pinch","version":23},{"n":314,"text":"\t\t\tissue: 12,","author":"pinch","version":23},{"n":315,"text":"\t\t});","author":"pinch","version":23},{"n":316,"text":"\t\tassert.match(","author":"pinch","version":23},{"n":317,"text":"\t\t\tr.out,","author":"pinch","version":23},{"n":318,"text":"\t\t\tnew RegExp(`^Copied ${from} issue 12 to core issue 31\\\\. Its comments and asks keep their authors`),","author":"pinch","version":23},{"n":319,"text":"\t\t);","author":"pinch","version":23},{"n":320,"text":"\t});","author":"pinch","version":23},{"n":321,"text":"","author":"pinch","version":23},{"n":322,"text":"\tit(\"says a dry run still works when the server refuses the copy\", async () => {","author":"pinch","version":23},{"n":323,"text":"\t\tconst gil = await folder(\"gil\");","author":"pinch","version":23},{"n":324,"text":"\t\tconst r = await text(gil, [\"issue\", \"403\", \"--copy-to\", \"core\"]);","author":"pinch","version":23},{"n":325,"text":"\t\tassert.equal(r.exit, 1, r.out);","author":"pinch","version":23},{"n":326,"text":"\t\tassert.match(r.out, /takes an owner of that project\\. --dry-run still shows what would go\\./);","author":"pinch","version":23},{"n":327,"text":"\t});","author":"pinch","version":23},{"n":328,"text":"","author":"pinch","version":23},{"n":329,"text":"\tit(\"refuses mistakes before any call\", async () => {","author":"pinch","version":23},{"n":330,"text":"\t\tconst gil = await folder(\"gil\");","author":"pinch","version":23},{"n":331,"text":"\t\twriteFileSync(join(gil, \"bad.json\"), JSON.stringify({ from: \"elsewhere\" }));","author":"pinch","version":23},{"n":332,"text":"\t\tconst before = seen.length;","author":"pinch","version":23},{"n":333,"text":"\t\tfor (const [argv, why] of [","author":"pinch","version":23},{"n":334,"text":"\t\t\t[[\"issue\", \"12\", \"--copy-to\", \"core\", \"--comment\", \"x\"], /--copy-to goes alone .* not with --comment/],","author":"pinch","version":23},{"n":335,"text":"\t\t\t[[\"issue\", \"12\", \"--dry-run\"], /--clean and --dry-run go with --copy-to <project>/],","author":"pinch","version":23},{"n":336,"text":"\t\t\t[[\"issue\", \"12\", \"--copy-to\", \"core\", \"--clean\", \"nope.json\"], /--clean nope\\.json: no such file/],","author":"pinch","version":23},{"n":337,"text":"\t\t\t[","author":"pinch","version":23},{"n":338,"text":"\t\t\t\t[\"issue\", \"12\", \"--copy-to\", \"core\", \"--clean\", \"bad.json\"],","author":"pinch","version":23},{"n":339,"text":"\t\t\t\t/from isn't one of title, description, comments, asks/,","author":"pinch","version":23},{"n":340,"text":"\t\t\t],","author":"pinch","version":23},{"n":341,"text":"\t\t] as const) {","author":"pinch","version":23},{"n":342,"text":"\t\t\tconst r = await text(gil, [...argv]);","author":"pinch","version":23},{"n":343,"text":"\t\t\tassert.notEqual(r.exit, 0, argv.join(\" \"));","author":"pinch","version":23},{"n":344,"text":"\t\t\tassert.match(r.out, why);","author":"pinch","version":23},{"n":345,"text":"\t\t}","author":"pinch","version":23},{"n":346,"text":"\t\tconst { project } = readConfig(gil);","author":"pinch","version":23},{"n":347,"text":"\t\tassert.match(","author":"pinch","version":23},{"n":348,"text":"\t\t\t(await text(gil, [\"issue\", \"12\", \"--copy-to\", project])).out,","author":"pinch","version":23},{"n":349,"text":"\t\t\t/issue 12 is already in issues\\d+; --copy-to names another project/,","author":"pinch","version":23},{"n":350,"text":"\t\t);","author":"pinch","version":23},{"n":351,"text":"\t\tassert.equal(seen.length, before, \"nothing reached the Issues server\");","author":"pinch","version":23},{"n":352,"text":"\t});","author":"init","version":0},{"n":353,"text":"});","author":"init","version":0}],"authors":[{"agent":"pinch","lines":188},{"agent":"init","lines":133},{"agent":"devops","lines":17},{"agent":"infra-split","lines":14},{"agent":"review","lines":1}],"older":null,"followed":null,"life":{"versions":0,"last":null,"made":null,"removed":null,"next":null},"since":null,"paths":[".absoignore",".gitignore","LICENSE","README.md","abso.json","biome.json","client/.claude-plugin/plugin.json","client/README.md","client/abso.ts","client/avcs.ts","client/hooks/hooks.json","client/hooks/register.test.ts","client/hooks/register.ts","client/hooks/stamp.ts","client/install-mod.ts","client/install-view.ts","client/launch.mjs","client/scripts/import-git.ts","client/skills/abso/SKILL.md","client/src/announce.ts","client/src/api-answers.ts","client/src/api-error.ts","client/src/api.ts","client/src/args.ts","client/src/at.ts","client/src/blobs.ts","client/src/body-files.ts","client/src/box-commands.ts","client/src/box-run.ts","client/src/box.ts","client/src/changes.ts","client/src/check-ignore.ts","client/src/ci-answers.ts","client/src/ci.ts","client/src/clean-files.ts","client/src/client-version.ts","client/src/collision-text.ts","client/src/command-env.ts","client/src/commands.ts","client/src/config.ts","client/src/core.ts","client/src/diff.ts","client/src/drafts.ts","client/src/env-names.ts","client/src/export.ts","client/src/fetch.ts","client/src/folder.ts","client/src/history-answers.ts","client/src/history.ts","client/src/hook.ts","client/src/install.ts","client/src/issues-wire.ts","client/src/issues.ts","client/src/join-commands.ts","client/src/key-admin.ts","client/src/lock.ts","client/src/main.ts","client/src/mcp.ts","client/src/modes.ts","client/src/orgs.ts","client/src/pipeline-commands.ts","client/src/project-file.ts","client/src/publish-commands.ts","client/src/queue.ts","client/src/review.ts","client/src/safety.ts","client/src/serve-commands.ts","client/src/settle.ts","client/src/skill.ts","client/src/state-dir.ts","client/src/status-commands.ts","client/src/tar.ts","client/src/times.ts","client/src/versions.ts","client/src/visibility-commands.ts","client/test-mods.ts","client/test/attach.test.ts","client/test/body-files.test.ts","client/test/box.test.ts","client/test/client.test.ts","client/test/diff.test.ts","client/test/env-names.test.ts","client/test/error-sentence.test.ts","client/test/fake-server.ts","client/test/ignore.test.ts","client/test/imported-history.test.ts","client/test/install.test.ts","client/test/issues.test.ts","client/test/key-admin.test.ts","client/test/key.test.ts","client/test/launch.test.ts","client/test/new-folder-dir.test.ts","client/test/orgs.test.ts","client/test/pipeline-commands.test.ts","client/test/queue-waiting.test.ts","client/test/setup.ts","client/test/skill.test.ts","client/test/times.test.ts","client/view/.claude-plugin/plugin.json","client/view/hooks/hooks.json","client/view/hooks/register.test.ts","client/view/hooks/register.tsx","client/view/hooks/stamp.ts","client/view/types/index.d.ts","package-lock.json","package.json","src/engine/build.ts","src/engine/conflicts.ts","src/engine/graph.ts","src/engine/index.ts","src/engine/keys.ts","src/engine/labels.ts","src/engine/sets.ts","src/engine/test/build.test.ts","src/engine/test/concurrent.test.ts","src/engine/test/conflicts.test.ts","src/engine/test/gen.ts","src/engine/test/graph.test.ts","src/engine/test/helpers.ts","src/engine/test/moves.test.ts","src/engine/test/properties.test.ts","src/engine/test/scenarios.test.ts","src/engine/test/sets.test.ts","src/engine/test/text.test.ts","src/engine/test/view.test.ts","src/engine/text.ts","src/engine/types.ts","src/engine/view.ts","src/gitview/errors.ts","src/gitview/index.ts","src/gitview/ingest.ts","src/gitview/plain.ts","src/gitview/test/helpers.ts","src/gitview/test/ingest.test.ts","src/gitview/test/random.test.ts","src/gitview/test/view.test.ts","src/gitview/trailers.ts","src/gitview/tree.ts","src/gitview/view.ts","src/pipeline/pipeline.ts","src/pipeline/plan.ts","src/pipeline/test/pipeline.test.ts","src/pipeline/test/plan.test.ts","tsconfig.json","worker/project/add-draft.ts","worker/project/amend.ts","worker/project/announce.ts","worker/project/apply-entry.ts","worker/project/blame.ts","worker/project/change-records.ts","worker/project/changes-since.ts","worker/project/check-clash.ts","worker/project/collisions.ts","worker/project/definition-rule.ts","worker/project/definitions.ts","worker/project/draft-collisions.ts","worker/project/draft-diff.ts","worker/project/draft-state.ts","worker/project/drop.ts","worker/project/edit.ts","worker/project/express-moves.ts","worker/project/feed.ts","worker/project/globs.ts","worker/project/history.ts","worker/project/http.ts","worker/project/ingest.ts","worker/project/init.ts","worker/project/label.ts","worker/project/land.ts","worker/project/markers.ts","worker/project/memory-store.ts","worker/project/merge-identical.ts","worker/project/move.ts","worker/project/names.ts","worker/project/news.ts","worker/project/notes.ts","worker/project/overlaps.ts","worker/project/path-rules.ts","worker/project/pathindex.ts","worker/project/pathkey.ts","worker/project/pluck.ts","worker/project/project-api.ts","worker/project/project-error.ts","worker/project/project-helpers.ts","worker/project/project-status.ts","worker/project/project-types.ts","worker/project/project.ts","worker/project/publish-of.ts","worker/project/publish.ts","worker/project/queue-driver.ts","worker/project/queue.ts","worker/project/record-file.ts","worker/project/record.ts","worker/project/refuse.ts","worker/project/restore.ts","worker/project/spaces.ts","worker/project/spelling.ts","worker/project/start.ts","worker/project/switch-to.ts","worker/project/sync.ts","worker/project/test/announce-person.test.ts","worker/project/test/appends.test.ts","worker/project/test/attributes.test.ts","worker/project/test/bench.ts","worker/project/test/blobs.test.ts","worker/project/test/changed-definition.test.ts","worker/project/test/changes.test.ts","worker/project/test/definitions.test.ts","worker/project/test/draft-files-kept.test.ts","worker/project/test/drop.test.ts","worker/project/test/files-reads.test.ts","worker/project/test/history.test.ts","worker/project/test/ingest.test.ts","worker/project/test/issues.test.ts","worker/project/test/labels.test.ts","worker/project/test/markers.test.ts","worker/project/test/merge.test.ts","worker/project/test/moves.test.ts","worker/project/test/named-drafts.test.ts","worker/project/test/news-times.test.ts","worker/project/test/notes.test.ts","worker/project/test/order.test.ts","worker/project/test/paths.test.ts","worker/project/test/pluck.test.ts","worker/project/test/project-file.test.ts","worker/project/test/project.test.ts","worker/project/test/queue-driver.test.ts","worker/project/test/queue.test.ts","worker/project/test/queued-moves.test.ts","worker/project/test/review-fixes.test.ts","worker/project/test/reviewers.test.ts","worker/project/test/same-line.test.ts","worker/project/test/spelling-clash.test.ts","worker/project/test/spelling.test.ts","worker/project/test/starting.test.ts","worker/project/test/tells.test.ts","worker/project/test/whole.test.ts","worker/project/tree.ts","worker/project/version-log.ts","worker/project/version-meta.ts","worker/project/view-changes.ts","worker/project/views.ts","worker/project/where.ts","worker/project/whole-files.ts"],"working":{"version":318,"agents":[]},"agentChanges":[],"overlaps":null}