Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(reopen): --conflict takes each file name exactly [B3,D1]
Corey Olson49e8d8d76345
diff --git a/docs/api.md b/docs/api.mdindex f923d480..a585f72d 100644--- a/docs/api.md+++ b/docs/api.md@@ -283,7 +283,7 @@ The coordinator maintains the roadmap with `milestone add <name> [--note ...] [-| `stream` | `version:number`, `event:object` |<!-- api-http-shapes:end -->-A move body is `{verb, item, args, agent}`. `item` is the positive integer id when the move needs one. `args` names its CLI positional arguments and flags; text values stay literal, including leading dashes. Omit `agent` to act as the coordinator, or name a registered agent to run in its worktree. Coordinator verification takes `args.as: "coordinator"`, matching the CLI's explicit identity check. The local session secret may act as any agent on that board. `result` is the CLI's JSON result. `next` claims work atomically; when a claim is already held it renews it and returns the renewal event. With no work available it returns the CLI's `NOTHING_FREE` refusal. Waiting remains a CLI option. `reopen` is coordinator-only: `args.note` is required, and it returns a submitted item to open without adding a verdict or replacing its last submitted commit. `args.conflict` names the files of an accepted item that conflicts with the trunk instead; it needs no note, records the trunk commit, and the item reads `needs main merge` until its next verdict.+A move body is `{verb, item, args, agent}`. `item` is the positive integer id when the move needs one. `args` names its CLI positional arguments and flags; text values stay literal, including leading dashes. Omit `agent` to act as the coordinator, or name a registered agent to run in its worktree. Coordinator verification takes `args.as: "coordinator"`, matching the CLI's explicit identity check. The local session secret may act as any agent on that board. `result` is the CLI's JSON result. `next` claims work atomically; when a claim is already held it renews it and returns the renewal event. With no work available it returns the CLI's `NOTHING_FREE` refusal. Waiting remains a CLI option. `reopen` is coordinator-only: `args.note` is required, and it returns a submitted item to open without adding a verdict or replacing its last submitted commit. `args.conflict` names the files of an accepted item that conflicts with the trunk instead, as one exact path or an array of exact paths, each passed as its own `--conflict` flag and compared byte for byte with Git's conflict list; it needs no note, records the trunk commit, and the item reads `needs main merge` until its next verdict.Decision moves keep the CLI's routing: `shout` with `args.decision: true` may omit `args.to`; agents ask their coordinator, and the coordinator asks the person. `pass` takes the decision's id as `item` and `args.note`. Answering a decision addressed to the person requires `answer` with `args.as: "person"` from the coordinator's main checkout. Other callers receive the CLI's refusal.diff --git a/docs/formats.md b/docs/formats.mdindex 9c3dd6d9..936a3012 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -117,7 +117,7 @@ Engine 19 makes a corrected bar record why the old one was wrong. Once an item hEngine 20 lets a decision name the items it changes. An `appendFact`, `answerDecision` or `verify` move may carry `implies`, a list of existing item ids, and an `answerDecision` move may carry `supersedes`, the shout id of an earlier answer. Either makes the move an engine-20 move: an older engine refuses it with `RELAY_MOVE` before changing its board or cursor, and a board replaying an older engine refuses `implies` with `ENGINE_VERSION`. Engine 20 also tells implied items when a decision is superseded: by a fact's `supersedes`, by an answer's `supersedes`, or by the next verdict on the same item. Moves recorded under engines 19 and earlier replay without these notices. Engine numbers 13 to 18 are allocated to other changes; whichever lands later renumbers, keeping every earlier engine's replay unchanged.-Engine 28 reopens an accepted item that conflicts with the trunk for a main merge. A `reopen` move may carry `conflict: {files, trunk}`: the files that conflict, and the full trunk commit they conflict with. The CLI fills `trunk` from Git and refuses `NOT_CONFLICTING` when the accepted commit merges cleanly, or `CONFLICT_FILES` when a named file is not one Git reports as conflicting. The board refuses `NOT_ACCEPTED` unless the item is verified with an accept at its commit, and `BAD_CONFLICT` for a malformed conflict. A conflict needs no note and no landing failure; the event records `supersedes`, the accept it sets aside, `conflict`, and `cause: "refusal:MERGE_CONFLICT"`, never `landingFailure`, so rigor counts it as a merge conflict and never as a failing test. The item reads `needs main merge` until its next verdict, and the re-review checks the frozen check at the new head. A `reopen` move carrying `conflict` requires engine 28, and older engines refuse it with `RELAY_MOVE` before changing their board or cursor; a board replaying an older engine refuses it with `ENGINE_VERSION`. Moves recorded under engines 27 and earlier replay unchanged. Engine numbers 21 to 27 are allocated to other changes; a gap is fine, a reused number is not.+Engine 28 reopens an accepted item that conflicts with the trunk for a main merge. A `reopen` move may carry `conflict: {files, trunk}`: the files that conflict, and the full trunk commit they conflict with. The CLI takes one exact path per `--conflict <file>` flag and splits or trims nothing inside it, so a path with spaces or commas is named as Git reports it in `git merge-tree --write-tree --name-only -z`; `files` holds those exact paths, nonempty and without NUL. The CLI fills `trunk` from Git and refuses `NOT_CONFLICTING` when the accepted commit merges cleanly, or `CONFLICT_FILES` when a named file is not one Git reports as conflicting. The board refuses `NOT_ACCEPTED` unless the item is verified with an accept at its commit, and `BAD_CONFLICT` for a malformed conflict. A conflict needs no note and no landing failure; the event records `supersedes`, the accept it sets aside, `conflict`, and `cause: "refusal:MERGE_CONFLICT"`, never `landingFailure`, so rigor counts it as a merge conflict and never as a failing test. The item reads `needs main merge` until its next verdict, and the re-review checks the frozen check at the new head. A `reopen` move carrying `conflict` requires engine 28, and older engines refuse it with `RELAY_MOVE` before changing their board or cursor; a board replaying an older engine refuses it with `ENGINE_VERSION`. Moves recorded under engines 27 and earlier replay unchanged. Engine numbers 21 to 27 are allocated to other changes; a gap is fine, a reused number is not.The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 3 after issuing any agent token, includingdiff --git a/docs/lifecycle.md b/docs/lifecycle.mdindex 05022a0a..598cf85d 100644--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@ -145,13 +145,13 @@ Each move checks its guards in this order and refuses with the first one that do| REVIEW_COOLDOWN | the reviewer has not released this submission within the past hour, engine 5 or newer, only for the same reviewer and current submission | let another reviewer take it, or wait an hour or for a new submission || NOTE_REQUIRED | the move carries a note: what failed, what was tried, or why | --note "..." or --note-file <file> || ALREADY_MERGED | the item has no recorded merge receipt | a merged item cannot be reopened |-| LANDING_FAILURE_REQUIRED | a verified item note names the failing test and landing merge commit, unless the reopen names a trunk conflict | cite the recorded batch, or name the test and merge commit in a manual note; work that only conflicts with the trunk reopens with --conflict "<files>" |+| LANDING_FAILURE_REQUIRED | a verified item note names the failing test and landing merge commit, unless the reopen names a trunk conflict | cite the recorded batch, or name the test and merge commit in a manual note; work that only conflicts with the trunk reopens with --conflict <file> for each conflicting file || NOT_CONFLICTING | the accepted commit no longer merges onto the trunk, and every named file is one that conflicts, only for reopen --conflict by the coordinator on accepted, unmerged work | merge it, or reopen after a red landing with --note "<test file>: <test name>; merge commit <sha>" || CONFLICT_FILES | the accepted commit no longer merges onto the trunk, and every named file is one that conflicts, only for reopen --conflict by the coordinator on accepted, unmerged work | name only files Git reports as conflicting with the trunk || NO_TRUNK | the accepted commit no longer merges onto the trunk, and every named file is one that conflicts, only for reopen --conflict by the coordinator on accepted, unmerged work | check out the trunk branch in the main checkout once and run pullboard inbox || MERGE_CHECK_FAILED | the accepted commit no longer merges onto the trunk, and every named file is one that conflicts, only for reopen --conflict by the coordinator on accepted, unmerged work | use Git 2.38 or newer, restore its objects and retry || NOT_ACCEPTED | a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 28 or later, only for reopen --conflict | reopen a submission with --note "why" |-| BAD_CONFLICT | a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 28 or later, only for reopen --conflict | run pullboard reopen <id> --conflict "<files>" from the main checkout |+| BAD_CONFLICT | a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 28 or later, only for reopen --conflict | run pullboard reopen <id> --conflict <file> from the main checkout || ENGINE_VERSION | a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 28 or later, only for reopen --conflict | upgrade Pullboard on every linked device before using --conflict || LAND_HEADER | a displayed merge command fits the commit-header limit (accept result) | shorten the item title or cited rows so the merge header fits || ENGINE_VERSION | a verdict that implies items replays only under engine 20 or later (accept result) | upgrade Pullboard on every linked device before using --implies |diff --git a/src/api-moves.js b/src/api-moves.jsindex c916f4e0..97adf559 100644--- a/src/api-moves.js+++ b/src/api-moves.js@@ -17,7 +17,7 @@ const MOVES = {merged: { item: true, positions: ['commit'] },withdraw: { item: true, positions: ['reason'] },refreeze: { item: true },- reopen: { item: true, flags: ['note', 'conflict'] },+ reopen: { item: true, flags: ['note'], lists: ['conflict'] },escalate: { item: true, flags: ['note'] },hold: { positions: ['lane'], flags: ['reason'], booleans: ['off'] },shout: { positions: ['to', 'text'], optional: ['to'], booleans: ['decision'], flags: ['evidence', 'outcome', 'item', 'commit'] },@@ -32,7 +32,7 @@ export function moveArgs({ verb, item, args = {} }) {const form = Object.hasOwn(MOVES, verb) ? MOVES[verb] : null;if (!form) throw new Refused('BAD_REQUEST', `no API move ${String(verb)}; use a board move such as add, claim, submit, verify, shout or answer`);if (!args || typeof args !== 'object' || Array.isArray(args)) throw new Refused('BAD_REQUEST', 'args needs a JSON object containing this move\'s arguments');- const allowed = [...(form.positions ?? []), ...(form.flags ?? []), ...(form.booleans ?? [])];+ const allowed = [...(form.positions ?? []), ...(form.flags ?? []), ...(form.lists ?? []), ...(form.booleans ?? [])];for (const key of Object.keys(args)) if (!allowed.includes(key)) throw new Refused('BAD_REQUEST', `${verb} does not take args.${key}; use only this CLI move's arguments`);const argv = form.prefix ? [...form.prefix] : [verb];if (form.item) {@@ -50,6 +50,12 @@ export function moveArgs({ verb, item, args = {} }) {if (typeof args[key] !== 'string') throw new Refused('BAD_REQUEST', `args.${key} needs text; supply the CLI flag's value`);argv.push(`--${key}=${args[key]}`);}+ // A list flag repeats once per value, so each value reaches the CLI exactly, never split or joined.+ for (const key of form.lists ?? []) if (args[key] !== undefined) {+ const values = [args[key]].flat();+ if (!values.length || values.some((value) => typeof value !== 'string')) throw new Refused('BAD_REQUEST', `args.${key} needs text or an array of text; supply one value per CLI flag`);+ for (const value of values) argv.push(`--${key}=${value}`);+ }for (const key of form.booleans ?? []) if (args[key] !== undefined) {if (typeof args[key] !== 'boolean') throw new Refused('BAD_REQUEST', `args.${key} needs true or false`);if (args[key]) argv.push(`--${key}`);diff --git a/src/cli.js b/src/cli.jsindex 57f353e1..8ca0280b 100644--- a/src/cli.js+++ b/src/cli.js@@ -36,7 +36,7 @@ import { askedLaneNotes, detectGate, initRepo, proposeLanes, starterLane, starteimport { lifecycleMarkdown } from './machine.js';import { HELP, VERSION } from './help.js';import { barCorrectionLine, barCorrections, barStatsLines } from './bar-corrections.js';-import { MAIN_MERGE_LABEL, mainMergeFor, mainMergeLines, reopenConflict } from './trunk-conflict.js';+import { MAIN_MERGE_LABEL, mainMergeFor, mainMergeLines, reopenConflict, shownPath } from './trunk-conflict.js';import { checkImplies, decisionsImplying, parseImplies, takeDecisionNotices, whyLine } from './implies.js';import { defaultViewPort } from './view-port.js';export { HELP, VERSION };@@ -305,7 +305,7 @@ const OPTIONS = {commit: { type: 'string' },ref: { type: 'string' },supersedes: { type: 'string' },- conflict: { type: 'string' },+ conflict: { type: 'string', multiple: true },implies: { type: 'string' },owns: { type: 'string' },help: { type: 'boolean', short: 'h' },@@ -3182,11 +3182,11 @@ function workCommands(io, args) {return 0;}),reopen: () => act(async (ctx, board, me) => {- const conflict = values.conflict === undefined ? undefined : reopenConflict({ item: store.getItem(board, idArg(first)), coordinator: me.id === COORDINATOR, text: values.conflict, trunkMerge: (commit) => trunkMerge(ctx.info.root, commit) });+ const conflict = values.conflict === undefined ? undefined : reopenConflict({ item: store.getItem(board, idArg(first)), coordinator: me.id === COORDINATOR, values: values.conflict, trunkMerge: (commit) => trunkMerge(ctx.info.root, commit) });const result = await ordered(ctx, board, 'reopen', [idArg(first), { agentId: me.id, note: textArg(io, values, 'note') ?? '', ...(conflict ? { conflict } : {}) }]);io.result?.(result);io.say(result.conflict- ? `reopened #${first} for a main merge: conflicts with the trunk at ${result.conflict.trunk.slice(0, 12)} in ${result.conflict.files.join(', ')}; the accept at ${result.commit.slice(0, 12)} stays recorded`+ ? `reopened #${first} for a main merge: conflicts with the trunk at ${result.conflict.trunk.slice(0, 12)} in ${result.conflict.files.map(shownPath).join(', ')}; the accept at ${result.commit.slice(0, 12)} stays recorded`: result.landingFailure? `reopened #${first} after landing failure; previous accept remains recorded at ${result.commit.slice(0, 12)}`: `reopened #${first} without a verdict; previous commit ${result.commit.slice(0, 12)} remains recorded`);diff --git a/src/help.js b/src/help.jsindex 181ee598..46acf2a3 100644--- a/src/help.js+++ b/src/help.js@@ -122,7 +122,8 @@ Coordinatorpullboard withdraw <id> <reason> drop an item nobody should buildpullboard refreeze <id> adopt a corrected criterion or changed spec rowspullboard reopen <id> --note "why" return a submission for criterion correction without a verdict- pullboard reopen <id> --conflict "<files>" return accepted work that conflicts with the trunk for a main merge+ pullboard reopen <id> --conflict <file> [--conflict <file>]+ return accepted work that conflicts with the trunk for a main mergepullboard hold <lane> --reason "..." pause a lane: next there claims nothing and names the reasonpullboard hold <id> "reason" hold one item so next skips itpullboard hold <lane|id> --off lift a lane or item hold@@ -274,7 +275,7 @@ const HELP_FLAG_EXPLANATIONS = {'--blueprint': 'start from a bundled blueprint or a JSON file','--brief': 'what a cold agent needs','--check': 'the command that proves it',- '--conflict': 'the files that conflict with the trunk; the accept stays recorded',+ '--conflict': 'one conflicting file, exactly as Git names it; repeat it for each file','--family': 'records the family name','--model': 'identifies the agent model; required unless PULLBOARD_MODEL is set','--implies': 'each named item gets a fact citing this decision',diff --git a/src/machine.js b/src/machine.jsindex beb187dd..1e33cfd7 100644--- a/src/machine.js+++ b/src/machine.js@@ -140,9 +140,9 @@ export const GUARDS = [{ id: 'reviewCooldownElapsed', refuse: 'REVIEW_COOLDOWN', rule: 'the reviewer has not released this submission within the past hour', next: 'let another reviewer take it, or wait an hour or for a new submission', source: 'board', when: 'engine 5 or newer, only for the same reviewer and current submission' },{ id: 'noteGiven', refuse: 'NOTE_REQUIRED', rule: 'the move carries a note: what failed, what was tried, or why', next: '--note "..." or --note-file <file>', source: 'board' },{ id: 'notMerged', refuse: 'ALREADY_MERGED', rule: 'the item has no recorded merge receipt', next: 'a merged item cannot be reopened', source: 'board' },- { id: 'landingFailureRecorded', refuse: 'LANDING_FAILURE_REQUIRED', rule: 'a verified item note names the failing test and landing merge commit', next: 'cite the recorded batch, or name the test and merge commit in a manual note; work that only conflicts with the trunk reopens with --conflict "<files>"', source: 'board', when: 'unless the reopen names a trunk conflict' },+ { id: 'landingFailureRecorded', refuse: 'LANDING_FAILURE_REQUIRED', rule: 'a verified item note names the failing test and landing merge commit', next: 'cite the recorded batch, or name the test and merge commit in a manual note; work that only conflicts with the trunk reopens with --conflict <file> for each conflicting file', source: 'board', when: 'unless the reopen names a trunk conflict' },{ id: 'trunkConflicts', refuse: 'NOT_CONFLICTING', alsoRefuses: [{ code: 'CONFLICT_FILES', next: 'name only files Git reports as conflicting with the trunk' }, { code: 'NO_TRUNK', next: 'check out the trunk branch in the main checkout once and run pullboard inbox' }, { code: 'MERGE_CHECK_FAILED', next: 'use Git 2.38 or newer, restore its objects and retry' }], rule: 'the accepted commit no longer merges onto the trunk, and every named file is one that conflicts', next: 'merge it, or reopen after a red landing with --note "<test file>: <test name>; merge commit <sha>"', source: 'cli', when: 'only for reopen --conflict by the coordinator on accepted, unmerged work' },- { id: 'conflictAccepted', refuse: 'NOT_ACCEPTED', alsoRefuses: [{ code: 'BAD_CONFLICT', next: 'run pullboard reopen <id> --conflict "<files>" from the main checkout' }, { code: 'ENGINE_VERSION', next: 'upgrade Pullboard on every linked device before using --conflict' }], rule: 'a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 28 or later', next: 'reopen a submission with --note "why"', source: 'board', when: 'only for reopen --conflict' },+ { id: 'conflictAccepted', refuse: 'NOT_ACCEPTED', alsoRefuses: [{ code: 'BAD_CONFLICT', next: 'run pullboard reopen <id> --conflict <file> from the main checkout' }, { code: 'ENGINE_VERSION', next: 'upgrade Pullboard on every linked device before using --conflict' }], rule: 'a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 28 or later', next: 'reopen a submission with --note "why"', source: 'board', when: 'only for reopen --conflict' },];/** @type {Move[]} */@@ -183,7 +183,7 @@ export const MOVES = [verb: 'reopen', from: ['submitted', 'verified'], to: 'open', by: ['coordinator'], refuse: 'NOT_SUBMITTED',guards: ['joined', 'itemExists', IN_STATE, 'coordinatorOnly', 'noteGiven', 'notMerged', 'landingFailureRecorded', 'trunkConflicts', 'conflictAccepted'],sets: ['item_verdict', 'item_verified_by', 'item_owner', 'item_lease_until', 'item_review_by', 'item_review_until'],- command: 'pullboard reopen <id> --note "why" | --conflict "<files>"',+ command: 'pullboard reopen <id> --note "why" | --conflict <file> [--conflict <file>]',},{verb: 'escalate', from: ['open', 'claimed'], to: 'open', by: ['agent', 'coordinator'], refuse: 'CLOSED',diff --git a/src/next-steps.js b/src/next-steps.jsindex cfc40587..72118cb7 100644--- a/src/next-steps.js+++ b/src/next-steps.js@@ -141,11 +141,11 @@ export const NEXT_STEPS = Object.freeze({ITEM_HELD: 'take another item with pullboard next while the coordinator holds this one',ITEM_NOT_AVAILABLE: 'read the item from this API\'s board state',ITEM_NOT_OPEN: 'hold only open or claimed items; see pullboard list',- LANDING_FAILURE_REQUIRED: 'reopen with --note "<test file>: <test name>; merge commit <sha>", or with --conflict "<files>" when it only conflicts with the trunk',+ LANDING_FAILURE_REQUIRED: 'reopen with --note "<test file>: <test name>; merge commit <sha>", or with --conflict <file> for each conflicting file when it only conflicts with the trunk',NOT_CONFLICTING: 'merge it; reopen only after a red landing, with --note "<test file>: <test name>; merge commit <sha>"',- CONFLICT_FILES: 'name only the files Git reports as conflicting with the trunk: pullboard reopen <id> --conflict "<files>"',+ CONFLICT_FILES: 'name only the files Git reports as conflicting with the trunk: pullboard reopen <id> --conflict <file> [--conflict <file>]',NOT_ACCEPTED: 'reopen a submission with --note "why"; --conflict is for accepted work',- BAD_CONFLICT: 'run pullboard reopen <id> --conflict "<files>" from the main checkout',+ BAD_CONFLICT: 'run pullboard reopen <id> --conflict <file> [--conflict <file>] from the main checkout',LANE_TAKEN: 'choose a different lane name with pullboard lane add',LAND_ADOPT: 'read pullboard resume, then run pullboard land --adopt, or pullboard land when nothing is unfinished',LAND_BATCH: 'adopt the recorded batch: pullboard land --adopt',diff --git a/src/trunk-conflict.js b/src/trunk-conflict.jsindex 037f737f..f8443f70 100644--- a/src/trunk-conflict.js+++ b/src/trunk-conflict.js@@ -3,7 +3,7 @@** When two accepted items touch the same lines, the second no longer merges onto the trunk. That* is not a failed test and not a reject: the work was accepted and only needs main merged into- * it. `pullboard reopen <id> --conflict "<files>"` records exactly that, naming the conflicting+ * it. `pullboard reopen <id> --conflict <file>` (once per file) records exactly that, naming the conflicting* files and the trunk commit they conflict with, and keeps the original accept on record. The* builder claims it with its bar unchanged, merges main and resubmits; the re-review checks the* frozen check at the new head and nothing else.@@ -29,15 +29,31 @@ export function carriesConflict(operation, args) {}/**- * The file paths named by a `--conflict` value, split on commas and white space, without repeats.+ * The file paths `--conflict` names: one exact path per flag, in order, without repeats. Nothing is+ * split or trimmed inside a value, because a Git path may hold spaces, commas or any byte but NUL,+ * and it must match the path `git merge-tree -z` reports byte for byte.*- * @param {string} text+ * @param {string | string[] | undefined} values - one value per --conflict flag* @returns {string[]}*/-export function conflictFiles(text) {- return [...new Set(String(text ?? '').split(/[\s,]+/u).filter(Boolean))];+export function conflictFiles(values) {+ return [...new Set([values ?? []].flat())];}+/**+ * A path as a reader sees it in a message or line: plain when it holds only ordinary path+ * characters, otherwise JSON-quoted, so a space or comma inside a name never reads as two names.+ *+ * @param {string} path+ * @returns {string}+ */+export function shownPath(path) {+ return /^[\w./@+-]+$/u.test(path) ? path : JSON.stringify(path);+}++/** Paths for a message or line, each shown unambiguously, separated by commas. */+const shownPaths = (paths) => paths.map(shownPath).join(', ');+/*** Check the trunk for the conflict the coordinator names, so --conflict cannot stand in for a* landing failure note on work that merges cleanly. Every named file must be one Git reports as@@ -49,12 +65,12 @@ export function conflictFiles(text) {* @returns {{ files: string[], trunk: string }}*/export function requireTrunkConflict(trunkMerge, commit, files) {- if (!files.length) throw new Refused('CONFLICT_FILES', 'name the files that conflict: pullboard reopen <id> --conflict "<file>, <file>"');+ if (!files.length || files.some((file) => !file || file.includes('\0'))) throw new Refused('CONFLICT_FILES', 'name each file that conflicts with its own flag: pullboard reopen <id> --conflict <file> [--conflict <file>]');const merge = trunkMerge(commit);const branch = merge.ref.replace(/^refs\/heads\//u, '');if (!merge.files) throw new Refused('NOT_CONFLICTING', `${commit.slice(0, 12)} merges cleanly onto ${branch} at ${merge.commit.slice(0, 12)}; merge it, or reopen with --note "<test file>: <test name>; merge commit <sha>" after a red landing`);const unknown = files.filter((file) => !merge.files.includes(file));- if (unknown.length) throw new Refused('CONFLICT_FILES', `${unknown.join(', ')} ${unknown.length === 1 ? 'does' : 'do'} not conflict with ${branch} at ${merge.commit.slice(0, 12)}; the conflicting files are ${merge.files.join(', ') || 'unnamed'}`);+ if (unknown.length) throw new Refused('CONFLICT_FILES', `${shownPaths(unknown)} ${unknown.length === 1 ? 'does' : 'do'} not conflict with ${branch} at ${merge.commit.slice(0, 12)}; the conflicting files are ${shownPaths(merge.files) || 'unnamed'}; name each with its own --conflict <file>`);return { files, trunk: merge.commit };}@@ -63,11 +79,11 @@ export function requireTrunkConflict(trunkMerge, commit, files) {* or an item that is not accepted and unmerged, gets the files alone, so the board's own guards* refuse it in their declared order (COORDINATOR_ONLY, NOT_SUBMITTED, ALREADY_MERGED, NOT_ACCEPTED).*- * @param {{ item: any, coordinator: boolean, text: string, trunkMerge: (commit: string) => { ref: string, commit: string, files: string[] | null } }} request+ * @param {{ item: any, coordinator: boolean, values: string | string[] | undefined, trunkMerge: (commit: string) => { ref: string, commit: string, files: string[] | null } }} request* @returns {{ files: string[], trunk: string | null }}*/-export function reopenConflict({ item, coordinator, text, trunkMerge }) {- const files = conflictFiles(text);+export function reopenConflict({ item, coordinator, values, trunkMerge }) {+ const files = conflictFiles(values);if (!coordinator || item.item_status !== 'verified' || item.item_merged_commit || !item.item_commit) return { files, trunk: null };return requireTrunkConflict(trunkMerge, item.item_commit, files);}@@ -88,9 +104,9 @@ export function conflictProblem(board, item, conflict, found) {if (item.item_status !== 'verified') return new Refused('NOT_ACCEPTED', `item #${item.item_id} is ${item.item_status}; --conflict reopens accepted work for a main merge, and a submission reopens with --note "why"`);const shape = /** @type {any} */ (conflict);const files = Array.isArray(shape?.files) ? shape.files : [];- if (!files.length || files.some((file) => typeof file !== 'string' || !file.trim() || /[\r\n]/u.test(file)) || new Set(files).size !== files.length+ if (!files.length || files.some((file) => typeof file !== 'string' || !file || file.includes('\0')) || new Set(files).size !== files.length|| !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(shape?.trunk ?? '')) {- return new Refused('BAD_CONFLICT', 'a trunk conflict names its files and the full trunk commit; run pullboard reopen <id> --conflict "<files>" from the main checkout');+ return new Refused('BAD_CONFLICT', 'a trunk conflict names its files and the full trunk commit; run pullboard reopen <id> --conflict <file> from the main checkout');}const accept = board.db.prepare("SELECT event_id FROM event WHERE item_id = ? AND event_kind = 'accept' AND json_extract(event_detail, '$.commit') = ? ORDER BY event_id DESC LIMIT 1").get(item.item_id, item.item_commit);if (!accept) return new Refused('NOT_ACCEPTED', `item #${item.item_id} has no accept at ${String(item.item_commit).slice(0, 12)}; --conflict reopens accepted work for a main merge`);@@ -117,7 +133,7 @@ export function conflictDetail({ files, trunk }) {/** The note a conflict reopen records when the coordinator gives none. */export function conflictNote({ files, trunk }) {- return `conflicts with the trunk at ${trunk.slice(0, 12)} in ${files.join(', ')}; merge main and resubmit`;+ return `conflicts with the trunk at ${trunk.slice(0, 12)} in ${shownPaths(files)}; merge main and resubmit`;}/**@@ -148,7 +164,7 @@ export function mainMergeFor(board, id) {*/export function mainMergeLines(item, merge, name = (id) => id) {const accepted = merge.accept ? `accepted by ${name(merge.accept.by)} at ${merge.accept.commit.slice(0, 12)}` : 'accepted';- const head = `${MAIN_MERGE_LABEL}: ${accepted}; conflicts with the trunk at ${merge.trunk.slice(0, 12)} in ${merge.files.join(', ')}`;+ const head = `${MAIN_MERGE_LABEL}: ${accepted}; conflicts with the trunk at ${merge.trunk.slice(0, 12)} in ${shownPaths(merge.files)}`;if (item.item_status === 'submitted') return [head, `re-review: main merge only; run the frozen check at ${item.item_commit.slice(0, 12)}; the accept above stands for the rest`];- return [head, `next: pullboard claim ${item.item_id} (the bar is unchanged), merge main, resolve ${merge.files.join(', ')}, commit, pullboard submit ${item.item_id}`];+ return [head, `next: pullboard claim ${item.item_id} (the bar is unchanged), merge main, resolve ${shownPaths(merge.files)}, commit, pullboard submit ${item.item_id}`];}diff --git a/test/reopen-conflict.test.js b/test/reopen-conflict.test.jsindex 40ff63b3..f5df8aaa 100644--- a/test/reopen-conflict.test.js+++ b/test/reopen-conflict.test.js@@ -1,10 +1,11 @@/** Real Git and SQLite coverage for an accepted item that conflicts with the trunk [B3,D1]. */import assert from 'node:assert/strict';-import { mkdtempSync, rmSync } from 'node:fs';+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { after, test } from 'node:test';import * as store from '../src/board.js';+import { moveArgs } from '../src/api-moves.js';import { applyRelayMove, prepareEngineMove } from '../src/engine.js';import { exportBoard, importBoard } from '../src/exchange.js';import { ENGINE_VERSION } from '../src/machine.js';@@ -15,6 +16,10 @@ const e2e = createE2eHelpers();after(e2e.cleanup);const { project, commitFile } = e2e;+/** Real Git paths with a space and a comma; each conflict names them exactly as Git does. */+const ODD_FILES = ['web/my feature.js', 'web/a,b.js'];+const ALL_FILES = ['web/feature.js', ...ODD_FILES];+/** Read an item, its thread and its verdicts through a short-lived board connection. */function readItem(box, id) {const board = store.openBoard(join(box.repo, '.git', 'pullboard', 'board.sqlite'));@@ -34,6 +39,8 @@ function submitItem(box, title, contents) {assert.equal(added.code, 0, added.err);const id = JSON.parse(added.out).item.item_id;assert.equal(box.run(box.web, 'claim', String(id)).code, 0);+ mkdirSync(join(box.web, 'web'), { recursive: true });+ for (const file of ODD_FILES) writeFileSync(join(box.web, file), contents);const committed = commitFile(box, box.web, 'web/feature.js', contents, `feat(web): ${title.toLowerCase()} [G1]`);assert.equal(committed.status, 0, committed.stderr);const submitted = box.run(box.web, 'submit', String(id));@@ -52,6 +59,7 @@ function accept(box, id, commit) {/** Move the trunk under an accepted item: main changes the same line of web/feature.js. */function moveTrunk(box) {+ for (const file of ODD_FILES) { mkdirSync(join(box.repo, 'web'), { recursive: true }); writeFileSync(join(box.repo, file), 'export const status = "TRUNK";\n'); }const committed = commitFile(box, box.repo, 'web/feature.js', 'export const status = "TRUNK";\n', 'feat(web): trunk changes the status [G1]');assert.equal(committed.status, 0, committed.stderr);return box.git(box.repo, 'rev-parse', 'HEAD');@@ -79,16 +87,22 @@ test('a conflicting accepted item reopens for a main merge [B3,D1]', () => {assert.equal(refusal(box.run(box.repo, 'reopen', String(item.id), '--json')), 'NOTE_REQUIRED');assert.equal(refusal(box.run(box.repo, 'reopen', String(item.id), '--note', 'conflicts with main', '--json')), 'LANDING_FAILURE_REQUIRED','a verified item without --conflict or a landing failure note is still refused');- const wrongFile = box.run(box.repo, 'reopen', String(item.id), '--conflict', 'web/feature.js, web/other.js', '--json');+ const wrongFile = box.run(box.repo, 'reopen', String(item.id), '--conflict', 'web/feature.js', '--conflict', 'web/other.js', '--json');assert.equal(refusal(wrongFile), 'CONFLICT_FILES', 'every named file must be one Git reports as conflicting');assert.match(JSON.parse(wrongFile.out).error.message, /web\/other\.js does not conflict/u);- assert.equal(refusal(box.run(box.repo, 'reopen', String(item.id), '--conflict', ' , ', '--json')), 'CONFLICT_FILES');+ assert.equal(refusal(box.run(box.repo, 'reopen', String(item.id), '--conflict', '', '--json')), 'CONFLICT_FILES', 'an empty name names nothing');assert.equal(readItem(box, item.id).item_status, 'verified', 'no refusal changed the item');- const reopened = box.run(box.repo, 'reopen', String(item.id), '--conflict', 'web/feature.js', '--json');+ const joined = box.run(box.repo, 'reopen', String(item.id), '--conflict', 'web/my feature.js, web/a,b.js', '--json');+ assert.equal(refusal(joined), 'CONFLICT_FILES', 'one value is one exact path; nothing inside it is split');+ assert.match(JSON.parse(joined.out).error.message, /^"web\/my feature\.js, web\/a,b\.js" does not conflict/u);+ assert.equal(refusal(box.run(box.repo, 'reopen', String(item.id), '--conflict', ' web/feature.js', '--json')), 'CONFLICT_FILES', 'nothing is trimmed');+ assert.deepEqual(moveArgs({ verb: 'reopen', item: item.id, args: { conflict: ODD_FILES } }),+ ['reopen', String(item.id), '--conflict=web/my feature.js', '--conflict=web/a,b.js', '--json', '--'], 'the API passes each path as its own flag');+ const reopened = box.run(box.repo, 'reopen', String(item.id), ...ALL_FILES.flatMap((file) => ['--conflict', file]), '--json');assert.equal(reopened.code, 0, [reopened.out, reopened.err].join('\n'));const receipt = JSON.parse(reopened.out);- assert.deepEqual(receipt.conflict, { files: ['web/feature.js'], trunk }, 'the receipt names the conflicting files and the trunk commit');+ assert.deepEqual(receipt.conflict, { files: ALL_FILES, trunk }, 'the receipt names the conflicting files exactly and the trunk commit');assert.equal(receipt.landingFailure, undefined, 'a trunk conflict is never a landing test failure');const returned = readItem(box, item.id);assert.equal(returned.item_status, 'open');@@ -96,7 +110,7 @@ test('a conflicting accepted item reopens for a main merge [B3,D1]', () => {const acceptEvent = returned.thread.findLast((entry) => entry.type === 'move' && entry.kind === 'accept');const reopenEvent = returned.thread.findLast((entry) => entry.type === 'move' && entry.kind === 'reopen');assert.equal(reopenEvent.detail.supersedes, acceptEvent.eventId, 'the reopen names the accept it sets aside');- assert.deepEqual(reopenEvent.detail.conflict, { files: ['web/feature.js'], trunk });+ assert.deepEqual(reopenEvent.detail.conflict, { files: ALL_FILES, trunk });assert.equal(reopenEvent.detail.landingFailure, undefined);assert.match(reopenEvent.detail.note, /conflicts with the trunk at [a-f0-9]{12} in web\/feature\.js/u);assert.deepEqual(returned.verdicts.map((verdict) => verdict.verdict_decision), ['ACCEPT'], 'no reject is recorded; the accept stands');@@ -104,7 +118,7 @@ test('a conflicting accepted item reopens for a main merge [B3,D1]', () => {const shown = box.run(box.repo, 'show', String(item.id));assert.match(shown.out, new RegExp(`^#${item.id} open \\(needs main merge\\) web`, 'mu'), 'the item reads as needing a main merge, not rejected');assert.doesNotMatch(shown.out, /\(rejected\)/u);- assert.match(shown.out, new RegExp(`needs main merge: accepted by coordinator \\(unknown\\) at ${item.commit.slice(0, 12)}; conflicts with the trunk at ${trunk.slice(0, 12)} in web/feature\\.js`, 'u'));+ assert.match(shown.out, new RegExp(`needs main merge: accepted by coordinator \\(unknown\\) at ${item.commit.slice(0, 12)}; conflicts with the trunk at ${trunk.slice(0, 12)} in web/feature\\.js, "web/my feature\\.js", "web/a,b\\.js"`, 'u'));assert.match(shown.out, new RegExp(`next: pullboard claim ${item.id} \\(the bar is unchanged\\), merge main`, 'u'));assert.match(box.run(box.repo, 'list', 'web').out, new RegExp(`#${item.id} open \\(needs main merge\\)`, 'u'));const resume = box.run(box.web, 'resume', '--json');