Skip to content

reconcile: a confirmed bulk [W] writes back ForeignCollision items that --auto-writeback refuses #255

Description

@spxrogers

What

reconcile --auto-writeback refuses to write back a ForeignCollision item (a never-applied, pre-existing native file): writing it back would overwrite the curated canonical source with foreign content, which resolveAuto calls "the worst data-loss path", so it prints skipped (foreign-collision, would overwrite source): … — resolve interactively and counts the item as unresolved.

A confirmed bulk [W] at the interactive prompt does not get that refusal. In walk, the confirmed bulk choice is taken before the --auto-* dispatch:

action := s.bulk
if action == actionNone {
    action = s.resolveAuto(it)   // the only place the ForeignCollision refusal lives
}

so once the user answers y to apply 'w' to all N remaining items? [y/N], every remaining actionable item — foreign collisions included — goes to applyActionattemptWriteBackwriteBackItem. Downstream, writeBackItem refuses only plugin-owned items; a foreign collision is written into the canonical source.

Why it matters

The confirmation names a count, not what is in it. Two keystrokes (W, y) on a queue that happens to contain a foreign collision do exactly what the non-interactive mode was taught to refuse, with no per-item warning. A per-item [w] on a foreign collision is a deliberate choice and is fine; the bulk path is the gap.

Where

Options

  1. Apply the same refusal to a bulk write-back: in walk, when s.bulk == actionWriteBack and the item is a ForeignCollision (or plugin-owned), print the existing skipped (foreign-collision, would overwrite source) line, count it in autoSkipped, and continue — the bulk choice then means "write back everything that is safe to write back non-interactively", the same meaning --auto-writeback has.
  2. Alternatively, make the confirmation honest: apply 'w' to all N remaining items (M are foreign collisions and would overwrite source)? [y/N].

Option 1 is the smaller change and keeps the two "sweep" modes consistent. Either way, a test: a queue with a drift item and a foreign collision, stdin Wy, assert the canonical file the foreign collision maps to is unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions