Lines 824–869 at 318 (were 824–829 at 116)
827+ it("shows and exports a version without earlier ones, refuses one a kept version builds on, and leaves shared alone", async () => { 828+ const { name, folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob"); 829+ const [alice, bob] = [folders.alice!, folders.bob!]; 830+ write(alice, { "a.txt": "a, changed\n" }); 831+ assert.equal((await avcs(alice, "push", "-m", "change a")).exit, 0); 832+ write(alice, { "b.txt": "b, changed\n" }); 833+ assert.equal((await avcs(alice, "push", "-m", "change b")).exit, 0); 834+ write(alice, { "a.txt": "a, changed again\n" }); 835+ assert.equal((await avcs(alice, "push", "-m", "change a again")).exit, 0); 836+ const before = shared(name); 838+ const shown = await text(bob, "show", "2", "--without", "1"); 839+ assert.equal(shown.exit, 0, shown.stderr); 842+ /^Version 2 of shared without version 1:\n {2}version 1 by alice: change a\nCompared with version 2: 1 file, 1 line added, 1 removed\.\nThe files hash to [0-9a-f]{64}; the same ask gives the same hash\. Shared doesn't change\./, 844+ assert.match(shown.stdout, /-a, changed\n\+a\n/); 845+ assert.equal((await text(bob, "show", "2:a.txt", "--without", "1")).stdout, "a\n"); 846+ assert.equal((await text(bob, "show", "2:b.txt", "--without", "1")).stdout, "b, changed\n"); 848+ const refused = await text(bob, "show", "3", "--without", "1"); 849+ assert.equal(refused.exit, 2); 852+ "Version 3 of shared can't leave out version 1: versions it keeps build on it.\n version 3 by alice: change a again\n builds on version 1 (a.txt)\nLeaving those out too works: abso show 3 --without 1,3\n", 854+ const out = join(temp(), "without"); 855+ const blocked = await avcs(bob, "export", out, "--version", "3", "--without", "1"); 856+ assert.equal(blocked.exit, 2); 857+ assert.deepEqual(blocked.json.suggestion, [1, 3]); 858+ const exported = await avcs(bob, "export", out, "--version", "3", "--without", "1,3"); 859+ assert.equal(exported.exit, 0, exported.out); 860+ assert.deepEqual(exported.json.without, [1, 3]); 861+ assert.equal(readFileSync(join(out, "a.txt"), "utf8"), "a\n"); 862+ assert.equal(readFileSync(join(out, "b.txt"), "utf8"), "b, changed\n"); 863+ assert.deepEqual(shared(name), before, "shared doesn't change"); 864+ assert.equal((await text(bob, "show", "3", "--without", "x")).exit, 1); 827867 it("refuses a push that builds on lines a drop took out, plainly, with exit 2", async () => { 828868 const { folders } = await project({ "a.txt": "one\ntwo\n" }, "alice", "bob"); 829869 const [alice, bob] = [folders.alice!, folders.bob!]; Lines 1596–1602 at 318 (were 1556–1562 at 116)
15561596 assert.equal(tokenGoesTo("https://sneaky.example", trusted), false); 15571597 assert.equal(tokenGoesTo("https://evil.example", trusted), false); 15581598 assert.equal(issuesServerFor("https://abso.example", machine), "https://issues.abso.example"); 1559− assert.equal(issuesServerFor("https://staging.abso.example", machine), undefined);
1599+ assert.equal(issuesServerFor("https://staging.abso.example", machine), "https://staging.abso.example/issues"); 15601600 assert.deepEqual(machineServers("{not json"), { trusted: [], issues: {} }); 15611601 assert.deepEqual(machineServers(undefined), { trusted: [], issues: {} }); 15621602 assert.equal(trustedList("https://a.example", machine).split(",")[0], "https://a.example"); Lines 2886–2897 at 318 (were 2846–2854 at 116)
28462886 it("abso login, box and logout outside a folder act on https://api.abso.dev", () => { 28472887 const outside = mkdtempSync(join(tmpdir(), "abso-login-")); 2849− assert.equal(boxServer(parseArgs("login", [], { server: "string" }), { cwd: outside }), "https://api.abso.dev");
2890+ boxServer(parseArgs("login", [], { server: "string" }), { cwd: outside, env: {} }), 2891+ "https://api.abso.dev", 28502893 const given = parseArgs("login", ["--server", "https://example.test"], { server: "string" }); 2851− assert.equal(boxServer(given, { cwd: outside }), "https://example.test");
2894+ assert.equal(boxServer(given, { cwd: outside, env: {} }), "https://example.test"); 28532896 rmSync(outside, { recursive: true, force: true }); Lines 3236–3242 at 318 (were 3193–3199 at 116)
31933236 "Not checked yet. Version 4 is being checked (35 s so far).", 31953238 assert.deepEqual(ciText({ ...base, checked: { version: 2, result: "none" }, running: null }, 3, now), [ 3196− "CI couldn't check version 2 (the box failed twice, or abso.json has nothing to run). Versions after 2 aren't checked yet.",
3239+ "CI couldn't check version 2 (the box failed twice, or the pipeline file has nothing to run). Versions after 2 aren't checked yet.", 31983241 assert.deepEqual( 31993242 ciText({ ...base, running: null, red: { version: 1, agent: null, message: null, lastGood: null } }, 1, now), Lines 3748–3776 at 318 (were 3705–3710 at 116)
37053748 assert.equal((await avcs(dir, "push", "-m", "rep writes")).exit, 0); 3751+ it("a reader talks: it announces, notes lines and closes notes, but still can't start or push (abso 682)", async () => { 3752+ const { name, folders } = await project({ "a.txt": "a\n" }, "alice"); 3753+ const dir = temp(); 3754+ const joined = await main(["join", name, "--agent", "rep", "--server", fake.url, "--reader"], { 3759+ assert.equal(joined.exit, 0, joined.stdout + joined.stderr); 3760+ // Talking: news to the other agents, and notes on lines, made and closed. 3761+ const said = await avcs(dir, "announce", "reader here"); 3762+ assert.equal(said.exit, 0, said.out); 3763+ assert.deepEqual(said.json.to, ["alice"]); 3764+ const noted = await avcs(dir, "note", "a.txt:1", "why this line?"); 3765+ assert.equal(noted.exit, 0, noted.out); 3766+ assert.equal((await avcs(dir, "note", "--close", String(noted.json.id), "--withdrawn")).exit, 0); 3767+ // Code: still refused. 3768+ const started = await main(["start", "reader work"], { cwd: dir, env: ENV, write: () => {} }); 3769+ assert.match(started.stdout + started.stderr, /agent rep is a reader: it records nothing/); 3770+ assert.equal((await main(["push", "-m", "x"], { cwd: dir, env: ENV, write: () => {} })).exit, 1); 3771+ assert.equal((await avcs(folders.alice!, "news")).json.news.length > 0, true, "alice heard the reader"); 37083774 it("reader on is refused while the agent has unpushed work, and changes nothing here", async () => { 37093775 const { folders } = await project({ "a.txt": "a\n" }, "alice"); 37103776 write(folders.alice!, { "a.txt": "a, unpushed\n" }); Lines 4799–4805 at 318 (were 4733–4739 at 116)
47334799 credential: "abso_bx_secret", 47354801 expiresAt: Date.now() + 1e6, 4736− grant: { projects: [{ project: "p", role: "writer" }], max_agents: 1 },
4802+ grant: { projects: [{ project: "p", role: "writer" }] }, 47384804 mkdirSync(join(home, ".avcs", "boxes"), { recursive: true }); 47394805 writeBox(record as never, home);