fix: scope conflict confirmation to agent changes

This commit is contained in:
lezi-fun committed 2026-08-14 12:26:33 +08:00
1 parent 54fc6ee494
commit eb67012e82
2 files changed
+29 -1

No files matched your search

+15
View File
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
import test from "node:test";
import {
buildConflictPushArgs,
buildConflictReviewDiffArgs,
canAutoResolveConflicts,
describeConflictResolutionFailure,
diffSnapshotInventories
@@ -33,6 +34,20 @@ test("only a passing conflicted writable current head is eligible", () => {
assert.equal(canAutoResolveConflicts({ ...eligible, enabled: false }), false);
});
test("conflict final review scopes the diff to agent-changed files", () => {
assert.deepEqual(buildConflictReviewDiffArgs(["server.js", "public/js/app.js"]), [
"diff",
"--cached",
"--no-ext-diff",
"--unified=80",
"--",
"server.js",
"public/js/app.js"
]);
assert.throws(() => buildConflictReviewDiffArgs([]), /at least one agent-changed file/);
assert.throws(() => buildConflictReviewDiffArgs([".env"]), /protected path/);
});
test("conflict failures are actionable without exposing raw command output", () => {
assert.match(
describeConflictResolutionFailure(new Error("fatal: refusing to merge unrelated histories")),