fix: keep task completion, cancel, pause, and undo honest
Pending earlier-revision jobs no longer skip completion repair; late cancels preserve real exits; begin clears pause; partial undo keeps snapshots; permissions and worktree failure paths are hardened. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -93,6 +93,21 @@ static void test_undo(void) {
|
||||
EXPECT(cst_undo_snapshot(g_ws, sid, "t4", "../evil") != 0, "reject ..");
|
||||
EXPECT(cst_undo_snapshot(g_ws, sid, "t4", "/etc/passwd") != 0,
|
||||
"reject absolute");
|
||||
|
||||
/* Partial restore must keep the snapshot so a retry is possible. */
|
||||
EXPECT(cst_undo_snapshot(g_ws, sid, "t5", "keep.txt") == 0, "snap keep");
|
||||
wfile("keep.txt", "after\n");
|
||||
{
|
||||
char target[512];
|
||||
snprintf(target, sizeof(target), "%s/keep.txt", g_ws);
|
||||
unlink(target);
|
||||
EXPECT(symlink("elsewhere", target) == 0, "make symlink");
|
||||
EXPECT(cst_undo_restore_last(g_ws, sid, rep, sizeof(rep)) != 0,
|
||||
"partial undo fails");
|
||||
EXPECT(strstr(rep, "symlink") != NULL, "report names symlink skip");
|
||||
EXPECT(cst_undo_count(g_ws, sid) == 1, "snapshot kept after partial fail");
|
||||
unlink(target);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_perms(void) {
|
||||
|
||||
Reference in New Issue
Block a user