{"draft":null,"from":159,"to":160,"files":[{"path":"client/test/held-push.test.ts","added":36,"removed":1,"diff":"--- a/client/test/held-push.test.ts\n+++ b/client/test/held-push.test.ts\n@@ -1,6 +1,6 @@\n // A held push from end to end, as two agents meet it: alice and bob change\n // the same line, bob's push is held, he pulls, settles and pushes again.\n-// What each step prints has to be true.\n+// What each step prints has to be true, and the record has to keep his reason.\n \n import assert from \"node:assert/strict\";\n import { mkdtempSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\n@@ -68,6 +68,41 @@\n \t\tassert.match(policy(bob), /^<<<<<<< yours \\(unpublished\\)$/m, \"the pull wrote a marker block\");\n \t});\n \n+\tfor (const how of [\"yours\", \"theirs\", \"both\"] as const) {\n+\t\tit(`why names the collision a line was kept from, settled --${how}`, async () => {\n+\t\t\tconst { alice, bob } = await held();\n+\t\t\tassert.equal((await run(bob, \"pull\")).exit, 0);\n+\t\t\tconst settled = await run(bob, \"settle\", \"store-policy.md\", `--${how}`);\n+\t\t\tassert.equal(settled.exit, 0, settled.out);\n+\t\t\tconst pushed = await run(bob, \"push\", \"-m\", `Settle: keep ${how}`);\n+\t\t\tassert.equal(pushed.exit, 0, pushed.out);\n+\t\t\tassert.equal((await run(alice, \"pull\")).exit, 0);\n+\t\t\tconst why = await run(alice, \"why\", \"store-policy.md:3\");\n+\t\t\tassert.equal(why.exit, 0, why.out);\n+\t\t\tassert.match(why.out, /It was kept when bob settled a collision between:\\n {2}alice, version 1 by alice/);\n+\t\t\tassert.match(why.out, new RegExp(`\\\\n {2}bob, a held push: \"${HELD.replace(/\\$/g, \"\\\\$\")}\"`));\n+\t\t});\n+\t}\n+\n+\tit(\"keeps its message: why on the settling line shows it, and so do the change page and the news\", async () => {\n+\t\tconst { alice, bob } = await held();\n+\t\tassert.equal((await run(bob, \"pull\")).exit, 0);\n+\t\twriteFileSync(join(bob, \"store-policy.md\"), POLICY.replace(\"$50\", \"$60\"));\n+\t\tconst pushed = await run(bob, \"push\", \"-m\", \"Settle with alice: meet at $60\");\n+\t\tassert.equal(pushed.exit, 0, pushed.out);\n+\t\tconst why = await run(bob, \"why\", \"store-policy.md:3\");\n+\t\tassert.match(\n+\t\t\twhy.out,\n+\t\t\t/It settled a collision between:\\n {2}alice, version 1 by alice[^\\n]*\\n {2}bob, a held push: \"/,\n+\t\t);\n+\t\tassert.ok(why.out.includes(HELD), why.out);\n+\t\tconst review = await run(alice, \"review\", \"bob\");\n+\t\tassert.match(review.out, /Settled: store-policy\\.md \\(rewrote both sides, against alice's version 1\\)\\./);\n+\t\tassert.ok(review.out.includes(`Refused 1 time on the way: lines (store-policy.md): \"${HELD}\"`), review.out);\n+\t\tconst news = await run(alice, \"news\");\n+\t\tassert.ok(news.out.includes(`Its held push said: \"${HELD}\"`), news.out);\n+\t});\n+\n \tit(\"the change page says what a settle kept in words that read for each choice\", async () => {\n \t\tfor (const [how, said] of [\n \t\t\t[\"yours\", \"kept bob's\"],"}],"unmatched":[]}