fix(delete): the prompt promised "Nothing is erased" and then erased things - #18
Open
fcreme wants to merge 1 commit into
Open
fix(delete): the prompt promised "Nothing is erased" and then erased things#18fcreme wants to merge 1 commit into
fcreme wants to merge 1 commit into
Conversation
…things Show-StyleDeletePlan itemises what is about to happen and closed with "- Nothing is erased: move the folder back to undo." Confirming it runs Move-StyleDirectoryToTrash, whose first act is a sweep: a recursive Remove-Item over every trashed style past the 7-day window. Measured -- a style trashed weeks earlier and still recoverable was present before the prompt and gone after it, while deleting an unrelated style, on a screen that had just said nothing would be erased. Bounded trash is the point of the feature. The listing never saying so was the defect, and it could not say so: the sweep decided what to remove inline, so the only way to learn what a delete was about to erase was to let it erase them. Get-StyleTrashSweepTarget answers that without acting on it. The folders are named in RED before the question, the closing line is scoped to the style being deleted, and the sweep now reads the same function rather than re-deciding -- so the set shown and the set removed are one list, not two that agree until they do not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHfeNid3QAWZENXUCYzfjv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #16 (now merged) — it reuses
Get-StyleTrashTimestampfrom that PR.The defect
Show-StyleDeletePlanitemises everything about to happen, then asks for confirmation. It closed with:Confirming runs
Move-StyleDirectoryToTrash, whose first act is the sweep — a recursiveRemove-Item -Recurse -Forceover every trashed style past the 7-day window.Measured, while deleting an unrelated style:
precious-20200101-000000— a style the user deleted earlier and could still have recovered by moving the folder back, exactly as the prompt describes — was destroyed by pressingyon a screen that said nothing would be. The only command that can erase it is the one claiming it cannot, and the user was deleting something else at the time.The fix
Bounded trash is the point of the feature. The listing never saying so was the defect — and it couldn't say so, because the sweep decided what to remove inline. The only way to learn what a delete was about to erase was to let it.
Get-StyleTrashSweepTargetanswers that question without acting on it:RED, per the file's existing convention that red is for what does not come back. The closing line is now scoped to the style being deleted — unqualified, it directly contradicted the line above it.
The sweep reads that same function instead of re-deciding, so the set shown and the set removed are one list, not two that agree until they don't. That divergence is the shape of most of the defects in this changelog, including #16 and #17.
Tests
10 new. The two that pin the defect fail on the old code:
Also covered: the prompt stays silent when nothing is expired, planning still writes nothing (including the trash),
Get-StyleTrashSweepTargetreads without erasing since it runs pre-consent, and the anti-drift property — erases exactly what the prompt named, and nothing else, asserting the 2-day-old neighbour survives.One test of mine failed for the wrong reason first:
Should -Not -Match 'ERASE'is case-insensitive, so it matched the word "erased" in the undo line and failed on output that was correct. Tightened to'- ERASE '.Full suite: 1453 passed, 0 failed,
HOMEsandboxed, real~/.zshrcchecksum-identical after.🤖 Generated with Claude Code
https://claude.ai/code/session_01UHfeNid3QAWZENXUCYzfjv