Skip to content

feat: purge selected trash transactions - #80

Merged
cjber merged 5 commits into
mainfrom
cb/purge-transaction
Nov 16, 2026
Merged

cjber merged 5 commits into
mainfrom
cb/purge-transaction

Conversation

@cjber

@cjber cjber commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

keeper purge TX... permanently removes only named trash transactions, allowing a reviewed cache cleanup without deleting other recent recoverable work. The full selection is validated before deletion; hooks, mount checks, locking, audit logging and the default age-based purge remain in the existing path. Mixing IDs with --older-days is rejected.

Closes #78

Validation: the P1 same-repository two-transaction regression failed against the prior implementation and passes at current head 1389df1. The targeted purge preserves the other worktree registration and undo restores it. Focused tests, Biome, TypeScript, and diff checks pass. No real recent trash was purged.

Validate the entire named selection before removing trash, preserving the
existing purge hooks, mount checks, lock and audit trail.

Closes #78
@cjber

cjber commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

P1: repository-wide worktree pruning can break undo for an unselected trash transaction. Verified at exact head e6bb65433882756816e27b06c724419c0ed9be1b.

src/ops.ts runs git worktree prune for a selected purged transaction. Trash application moves a worktree without updating its Git administration registration. If a different, unselected trashed worktree in that repository has an expired registration, the repository-wide prune removes it too. Its files and trash manifest remain, but a later undo moves back a worktree whose .git pointer refers to the deleted registration.

A private real-Git regression with two separate trash transactions and an expired administrative registration reproduced the failure both on this PR and combined with PR #82. Existing focused tests passed and did not cover this case. Scope registration cleanup to the selected transaction, or preserve registrations while other recoverable transactions depend on them. Add a regression that purges one transaction, undoes the other, and verifies the restored worktree works with Git.

No actual user cleanup, purge or undo was performed. This is a reproduced data-recovery defect, not an inference from CI metadata.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Deploying keeper with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ac1e9c
Status: ✅  Deploy successful!
Preview URL: https://62ded1bf.keeper-9oy.pages.dev
Branch Preview URL: https://cb-purge-transaction.keeper-9oy.pages.dev

View logs

@cjber

cjber commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Fixed review P1 in 1389df1. Purge now defers repository-wide worktree prune while another recoverable transaction references the same Git directory, preventing one targeted purge from deleting another transaction’s undo registration. Added a real two-transaction same-repository regression proving targeted purge preserves the second registration and undo restores it. Focused tests, Biome, TypeScript, and diff check pass. The original review comment is on the superseded e6bb654 context, so GitHub does not accept a thread reply; this comment records the fix on current head 1389df1.

@cjber

cjber commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Follow-up on the P1 regression at current head 2ac1e9c: the test now ages the trashed worktree's administrative gitdir file after both transactions are applied, matching the expired-registration failure state. It verifies both registration preservation and that undo restores a functioning checkout with git rev-parse. Running the same test with only the defer guard removed fails because the selected purge deletes the second registration; restoring the guard passes. Focused tests pass 2/2, Biome and TypeScript pass. No real user cleanup or purge was performed.

@cjber
cjber merged commit 2d4228f into main Nov 16, 2026
7 checks passed
@cjber
cjber deleted the cb/purge-transaction branch November 16, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: purge one reviewed trash transaction without deleting other recent work

1 participant