Settles say what they kept in plain words: a held push's hint says the pull writes a marker block, the change page reads "kept bob's" or "rewrote both sides" rather than "kept rewrote", and a line rewritten longer no longer counts as lost Version 159 of shared· speed· Oct 13 (2026-10-13 20:05 UTC) · Not checked
Version 158 · Files at version 159
5 files, 119 lines added, 4 removed.
--- a/client/src/publish-commands.ts
+++ b/client/src/publish-commands.ts
@@ -476,7 +476,7 @@
479 − ? `Run abso pull: each of those files comes back holding both sides' lines, with no markers. Edit it to what it should be${twice.length > 0 ? ", keep one definition of each name defined twice" : ""}, then push again.`
479 + ? `Run abso pull: each of those files comes back holding both sides' lines, in a marker block where you both changed the same lines. Settle each as the pull says${twice.length > 0 ? ", keep one definition of each name defined twice" : ""}, then push again.` 480 480 : twice.length > 0 481 481 ? "Keep one definition of each name defined twice (delete yours, or theirs), then push again." 482 482 : "Run abso pull, then push again.", --- a/client/src/review.ts
+++ b/client/src/review.ts
@@ -83,6 +83,13 @@
83 83 return ` ${c.id} ${c.agent}, ${titleLine(c.title)}${c.open ? " (still going)" : ""}: ${versionsText(c)}${files}${open > 0 ? `; ${plural(open, "open objection")}` : ""}`; 86 + /** What a settle kept, read from outside: whose lines, not "yours" or "theirs". */ 87 + function keptText(s: ChangeAnswer["settled"][number], settler: string): string { 88 + if (s.kept === "yours") return `kept ${settler}'s`; 89 + if (s.kept === "theirs") return `kept ${s.theirs.agent}'s`; 90 + return s.kept === "both" ? "kept both" : "rewrote both sides"; 86 93 /** The change page, as text. */ 87 94 export function changePage(c: ChangeAnswer): string[] { @@ -99,7 +106,7 @@
100 107 ...(c.settled.length > 0 102 − `Settled: ${c.settled.map((s) => `${s.file} (kept ${s.kept}, against ${s.theirs.agent}'s version ${s.theirs.version})`).join("; ")}.`,
109 + `Settled: ${c.settled.map((s) => `${s.file} (${keptText(s, c.agent)}, against ${s.theirs.agent}'s version ${s.theirs.version})`).join("; ")}.`, 105 112 ...(c.refusals.length > 0 --- /dev/null
+++ b/client/test/held-push.test.ts
@@ -0,0 +1,85 @@
1 + // A held push from end to end, as two agents meet it: alice and bob change 2 + // the same line, bob's push is held, he pulls, settles and pushes again. 3 + // What each step prints has to be true. 5 + import assert from "node:assert/strict"; 6 + import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; 7 + import { tmpdir } from "node:os"; 8 + import { join } from "node:path"; 9 + import { after, before, describe, it } from "node:test"; 10 + import { main } from "../src/main.ts"; 11 + import { type Fake, startFake } from "./fake-server.ts"; 13 + const TOKEN = "test-token-not-secret"; 14 + const ENV = { AVCS_TOKEN: TOKEN, AVCS_HOOK_FORCE: "1", AVCS_SERVERS_FILE: "no-servers.json" }; 15 + const POLICY = "# Store policy\n\nFree shipping on orders over $50.\nReturns accepted within 30 days.\n"; 16 + const HELD = "Lower free shipping to $35: half of abandoned carts were between $35 and $50"; 19 + const dirs: string[] = []; 21 + fake = await startFake(0, TOKEN); 25 + for (const d of dirs) rmSync(d, { recursive: true, force: true, maxRetries: 5 }); 28 + function temp(): string { 29 + const d = mkdtempSync(join(tmpdir(), "abso-held-")); 34 + async function run(cwd: string, ...argv: string[]): Promise<{ exit: number; out: string }> { 35 + const r = await main(argv, { cwd, env: ENV, write: () => {} }); 36 + return { exit: r.exit, out: r.stdout + r.stderr }; 40 + /** alice pushes $75; bob's $35 push is held. Answers both folders and bob's held push. */ 41 + async function held(): Promise<{ alice: string; bob: string; refused: string }> { 42 + const name = `held${++projects}`; 43 + const alice = temp(); 44 + writeFileSync(join(alice, "store-policy.md"), POLICY); 46 + (await run(alice, "init", "--server", fake.url, "--project", name, "--agent", "alice", "--as-is")).exit, 50 + assert.equal((await run(bob, "join", name, "--agent", "bob", "--server", fake.url)).exit, 0); 51 + writeFileSync(join(alice, "store-policy.md"), POLICY.replace("$50", "$75")); 52 + writeFileSync(join(bob, "store-policy.md"), POLICY.replace("$50", "$35")); 53 + const pushed = await run(alice, "push", "-m", "Raise free shipping to $75: shipping costs rose"); 54 + assert.equal(pushed.exit, 0, pushed.out); 55 + const refused = await run(bob, "push", "-m", HELD); 56 + assert.equal(refused.exit, 2, refused.out); 57 + return { alice, bob, refused: refused.out }; 60 + const policy = (dir: string) => readFileSync(join(dir, "store-policy.md"), "utf8"); 62 + describe("a held push", () => { 63 + it("says what the pull really writes: a marker block where both changed the same lines", async () => { 64 + const { bob, refused } = await held(); 65 + assert.doesNotMatch(refused, /no markers/); 66 + assert.match(refused, /Run abso pull: each of those files comes back holding both sides' lines/); 67 + assert.equal((await run(bob, "pull")).exit, 0); 68 + assert.match(policy(bob), /^<<<<<<< yours \(unpublished\)$/m, "the pull wrote a marker block"); 71 + it("the change page says what a settle kept in words that read for each choice", async () => { 72 + for (const [how, said] of [ 73 + ["yours", "kept bob's"], 74 + ["theirs", "kept alice's"], 75 + ["both", "kept both"], 77 + const { alice, bob } = await held(); 78 + assert.equal((await run(bob, "pull")).exit, 0); 79 + assert.equal((await run(bob, "settle", "store-policy.md", `--${how}`)).exit, 0); 80 + assert.equal((await run(bob, "push", "-m", `Settle: keep ${how}`)).exit, 0); 81 + const review = await run(alice, "review", "bob"); 82 + assert.ok(review.out.includes(`Settled: store-policy.md (${said}, against alice's version 1).`), review.out); --- a/worker/project/markers.ts
+++ b/worker/project/markers.ts
@@ -181,7 +181,11 @@
184 − /** Whether `b` reads as `a` reworded: at least half their words in common. */
185 + * Whether `b` reads as `a` reworded: at least half of `a`'s words are still 186 + * in it. Counted against `a` alone, so a rewording that keeps the line and 187 + * adds to it (a reason, the other side's number) still reads as the line. 185 189 function alike(a: string, b: string): boolean { 186 190 if (a === b) return true; 187 191 const x = words(a); @@ -189,7 +193,7 @@
189 193 if (x.size === 0 || y.size === 0) return false; 191 195 for (const w of x) if (y.has(w)) both++; 192 − return both / (x.size + y.size - both) >= 0.5;
196 + return both / x.size >= 0.5; --- a/worker/project/test/markers.test.ts
+++ b/worker/project/test/markers.test.ts
@@ -244,6 +244,25 @@
244 244 assert.deepEqual(lostLines([" rate. *B5: worth +N coin*"], region), ["- [x] **Gauge shows coin**"]); 247 + test("lostLines: a line rewritten longer, keeping its words and adding a reason, is not a loss", () => { 249 + file: "store-policy.md", 250 + yours: ["Free shipping on orders over $35."], 251 + base: ["Free shipping on orders over $50."], 252 + theirs: ["Free shipping on orders over $75."], 257 + const settled = (line: string) => ["# Store policy", "", line, "Returns accepted within 30 days."]; 259 + lostLines(settled("Free shipping on orders over $50 (alice wants $75, bob wants $35: decided by Friday)."), region), 262 + assert.deepEqual(lostLines(settled("Free shipping on orders over $60."), region), []); 263 + assert.deepEqual(lostLines(settled("Shipping is free."), region), ["Free shipping on orders over $35."]); 247 266 test("markers.ts: blocks round-trip, settle, and say what was kept", () => { 248 267 const who = { agent: "a", version: 3, message: 'Line one\nline two "quoted"' }; 249 268 const block = markerBlock(["y1", "y2"], ["b"], 2, ["t1"], who);