fix(cli): an interactive restore that ticks nothing restores nothing - #813
Merged
Conversation
`RestoreAllUseCase` forwarded an empty checkbox answer as `files: []`, which the restore
reads as "no selection made", the same as a non-interactive run, and every drifted file was
restored. An empty selection now ends the run with nothing restored; a run where nothing
drifted, so no checkbox was shown, still restores the plugin files the picker never offers.
Red first: the new test failed with `expected '{ "respectGitignore": false, …' to be
'EDITED OUTSIDE THE CLI'`.
Closes #805
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb
AIDD-Session-Id: 4acc9a1c-19bc-4468-b8b6-e86644bcba60
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb AIDD-Session-Id: 4acc9a1c-19bc-4468-b8b6-e86644bcba60
Two tests from #804 pinned the behaviour #805 fixes: an empty selection forwarded as `files: []`. They now assert that the run never delegates when nothing was ticked, and that a run with no drifted entry delegates with no selection at all. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb AIDD-Session-Id: 4acc9a1c-19bc-4468-b8b6-e86644bcba60
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.
🎯 What & why
An interactive
aidd syncthat finds drifted files asks which to restore. Ticking nothing came back asfiles: [], which the restore reads as "no selection made", the same as a non-interactive run, and every drifted file was restored. Deselect-all meant restore-all. Found by the mutation pass of #798 (#804), where no test asserted either reading.🛠️ How it works
RestoreAllUseCase.promptForFilesreturns the checkbox answer as given; an empty answer ends the run with nothing restored and an empty result.undefined, so the restore still runs and still repairs the plugin files the picker never offers. That path is unchanged and covered by the existing materialization tests.it: an interactive run with a modified tracked file and an empty selection leaves the file as edited and reports zero restored.🧪 How to verify
cd cli && pnpm vitest run tests/contexts/framework/application/restore-all-use-case.unit.test.tsexpected '{ "respectGitignore": false, …' to be 'EDITED OUTSIDE THE CLI'.next: typecheck, lint, arch (126), knip, unit+integration, e2e (297), build, smoke (FAIL 0), type honesty.None.
🔗 Linked issue
Closes #805
✅ I certify
🤖 Generated with Claude Code
https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb