fix(prs): gitea_pr_conflict_resolve says "Conflict Resolution Applied" without confirm when there are no conflicts #24

Closed
opened 2026-10-24 00:58:40 +00:00 by dsh · 1 comment
Owner

Symptom

gitea_pr_conflict_resolve with no confirm reports Conflict Resolution Applied: No conflicts to resolve. Nothing was applied and no confirmation was given, yet the output claims success. That is misleading for an operator and obscures the dry-run gate.

Repro

gitea_pr_conflict_resolve {owner:"dsh-plugins", repo:"dsh-gitea", pr_number:18}
→ Conflict Resolution Applied: No conflicts to resolve.

No confirm: true was passed; the tool definition says it is dry-run by default and applies only with confirm: true.

Observed vs expected

  • Observed: "Applied" wording on a no-confirm call.
  • Expected: a clean-preview response, e.g. Conflict Resolution (dry-run): no conflicts to resolve; nothing to apply. "Applied" only after confirm: true and a real commit.

Root cause

lib/conflict-assistant.js early-returns before the confirmation branch:

if (analysis.clean || !analysis.files || analysis.files.length === 0) {
  return { ok: true, data: { clean: true, summary: 'No conflicts to resolve.' } }
}

lib/handlers/formatters.js only distinguishes data.dryRun; without it, the non-dry-run branch prints Conflict Resolution Applied: ....

Proposed fix

Return dryRun: args.confirm !== true / applied: false in the clean early return, and make the formatter use explicit data.applied (or a clean branch) rather than assuming applied. Tests: no-confirm + clean → dry-run wording; confirm + clean → no-op wording without claiming a commit.

Acceptance: "Applied" never appears unless confirm: true and a resolution commit was created.

Duplicate check

Searched issues for conflict (state all) — only #11/#8 matched the word incidentally; none covers this gate.

Layer

dsh-gitea plugin/tool.

## Symptom `gitea_pr_conflict_resolve` with no `confirm` reports `Conflict Resolution Applied: No conflicts to resolve.` Nothing was applied and no confirmation was given, yet the output claims success. That is misleading for an operator and obscures the dry-run gate. ## Repro ``` gitea_pr_conflict_resolve {owner:"dsh-plugins", repo:"dsh-gitea", pr_number:18} → Conflict Resolution Applied: No conflicts to resolve. ``` No `confirm: true` was passed; the tool definition says it is dry-run by default and applies only with `confirm: true`. ## Observed vs expected - Observed: "Applied" wording on a no-confirm call. - Expected: a clean-preview response, e.g. `Conflict Resolution (dry-run): no conflicts to resolve; nothing to apply.` "Applied" only after `confirm: true` and a real commit. ## Root cause `lib/conflict-assistant.js` early-returns before the confirmation branch: ```js if (analysis.clean || !analysis.files || analysis.files.length === 0) { return { ok: true, data: { clean: true, summary: 'No conflicts to resolve.' } } } ``` `lib/handlers/formatters.js` only distinguishes `data.dryRun`; without it, the non-dry-run branch prints `Conflict Resolution Applied: ...`. ## Proposed fix Return `dryRun: args.confirm !== true` / `applied: false` in the clean early return, and make the formatter use explicit `data.applied` (or a `clean` branch) rather than assuming applied. Tests: no-confirm + clean → dry-run wording; confirm + clean → no-op wording without claiming a commit. Acceptance: "Applied" never appears unless `confirm: true` and a resolution commit was created. ## Duplicate check Searched issues for `conflict` (state all) — only #11/#8 matched the word incidentally; none covers this gate. ## Layer dsh-gitea plugin/tool.
Author
Owner

Fixed in 234cbd4 (PR #39).

The clean early-return in resolveMergeConflicts now carries {clean:true, applied:false, dryRun: !confirm}, and the formatter handles that shape before the applied branch. Live, gitea_pr_conflict_resolve with master/master and no confirm → Conflict Resolution (dry-run): no conflicts to resolve; nothing to apply. “Applied” is reachable only after confirm: true and a real resolution commit.

Tests: test/pr-semantics.test.mjs.

Fixed in `234cbd4` (PR #39). The clean early-return in `resolveMergeConflicts` now carries `{clean:true, applied:false, dryRun: !confirm}`, and the formatter handles that shape before the applied branch. Live, `gitea_pr_conflict_resolve` with `master`/`master` and no `confirm` → `Conflict Resolution (dry-run): no conflicts to resolve; nothing to apply.` “Applied” is reachable only after `confirm: true` and a real resolution commit. Tests: `test/pr-semantics.test.mjs`.
dsh closed this issue 2026-10-24 01:11:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
dsh-plugins/dsh-gitea#24
No description provided.