beads/cmd
Steve Yegge 144876baab feat(conflicts): bd conflicts list|show|resolve — issue-oriented merge conflicts (wy-jpd3.5)
Federation ask #3. Resolving a halted merge meant dropping into the raw dolt
CLI inside .beads/dolt/<db> — dolt conflicts cat issues, dolt conflicts resolve
--ours|--theirs issues, dolt add -A && dolt commit — dolt arcana whose flag
surface differs from git's just enough to bite. This wraps it in bd, presented
per issue FIELD rather than as raw conflict rows.

  bd conflicts list                     tables + conflicted issue IDs
  bd conflicts show [<id>]              base/ours/theirs per diverged field
  bd conflicts resolve <id> --ours      one issue, leaving the rest conflicted
  bd conflicts resolve --all --theirs   whole tables (dolt's own resolution)

Storage: storage.ConflictInspector is a new optional interface (GetConflictRows
/ ResolveConflictRows) implemented by both Dolt-backed stores over
versioncontrolops/conflicts.go, which folds dolt_conflicts_<table>'s
base_/our_/their_ columns into one row per conflict — generically, from the
result-set column names, so it does not rot on the next migration.

Per-row resolution follows dolt's manual-resolution protocol, the one
resolveIssuesLWWConflicts already proves: --ours deletes the conflict row (the
working set already holds our values), --theirs writes their values first and
then deletes it. It is restricted to modify/modify rows — when one side deleted
the row, "ours"/"theirs" do not describe what the operator wants, so it is
refused by name instead of guessed at.

Safety rails, several from the adversarial review of this diff:
- The CLI reaches the store through storage.UnwrapStore: store is always
  decorated (telemetry + hooks), and a decorator embedding the DoltStorage
  interface promotes only that interface's methods, so asserting on the wrapper
  would silently report "No merge conflicts" over a wedged merge.
- The merge is committed only when this invocation actually resolved something
  AND no conflict remains, via CommitMergeResolution (plain Commit excludes
  config, GH#2455/GH#2474). A partial resolution leaves the merge open.
- Server-mode resolution pins a connection and resets
  @@dolt_allow_commit_conflicts/@@dolt_force_transaction_commit before
  returning it to the pool, discarding the connection if the reset fails.
- A --theirs UPDATE that matches no row (concurrent delete on a shared server)
  aborts instead of clearing the conflict and dropping their side.
- Interpolated identifiers — table AND column — are validated; values are bound.

Follow-ups filed as wy-36ilm: a dolt-backed integration test (every test here
is a pure unit test, which is why the review's blocker was invisible to the
suite), a first-class way to conclude an already-resolved merge, and
schema-conflict/constraint-violation visibility in the commit gate.
2026-07-24 19:47:16 -07:00
..
bd feat(conflicts): bd conflicts list|show|resolve — issue-oriented merge conflicts (wy-jpd3.5) 2026-07-24 19:47:16 -07:00