Skip to content

Commit 6bdb9ff

Browse files
betegonclaude
andcommitted
fix(init): reject unknown patch actions in both dry-run and real patchset paths
Previously, applyPatchsetDryRun recorded every patch as applied regardless of its action, while the real applyPatchset silently skipped unknown actions via default: break. Both paths now return an explicit error on unrecognized patch actions so behavior is consistent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1313877 commit 6bdb9ff

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lib/init/local-ops.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,12 @@ function applyPatchsetDryRun(payload: ApplyPatchsetPayload): LocalOpResult {
486486

487487
for (const patch of params.patches) {
488488
safePath(cwd, patch.path);
489+
if (!["create", "modify", "delete"].includes(patch.action)) {
490+
return {
491+
ok: false,
492+
error: `Unknown patch action: "${patch.action}" for path "${patch.path}"`,
493+
};
494+
}
489495
applied.push({ path: patch.path, action: patch.action });
490496
}
491497

@@ -540,7 +546,10 @@ function applyPatchset(
540546
break;
541547
}
542548
default:
543-
break;
549+
return {
550+
ok: false,
551+
error: `Unknown patch action: "${patch.action}" for path "${patch.path}"`,
552+
};
544553
}
545554
}
546555

0 commit comments

Comments
 (0)