Repository navigation
fix(library): renaming a snippet to a rejected name no longer deletes it (for #1) - #3
Merged
lukisch merged 1 commit intoNov 11, 2026
Conversation
edit_library_item deleted the old entry first and ignored the result of save_snippet. With the stricter name check, renaming to a rejected name (e.g. 'Regex: Gruppen', 'Kap. 1.') silently lost the snippet. LibraryManager.rename_snippet now saves first and removes the old entry only on success, skips the delete when both names resolve to the same file, and the dialog reports a failed save. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THB2F13CQQqFzZB38FkYF7
|
Welcome! 👋 Thanks for your first pull request in this repository. A maintainer will review it soon. Please make sure:
Thanks for contributing! |
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.
Follow-up to #1, found in the second review. This PR targets the branch of #1 so that #1 picks up the fix.
Problem
edit_library_itemdeletes the old entry first, then callssave_snippetand ignores the result. #1 makessave_snippetreject names containing:or ending in.. Renaming a snippet toRegex: GruppenorKap. 1.therefore deletes it without any message. On master those renames succeed (the same loss already existed there for names containing/).Change
LibraryManager.rename_snippet: saves under the new name first and removes the old entry only if that succeeded. If old and new name resolve to the same file (case-only rename on a case-insensitive file system), the delete is skipped.edit_library_itemuses it and shows a warning when saving fails, also for a plain edit without rename.Verification
pytest -q(Linux, Python 3.11, PySide6 offscreen): 131 passed (126 before, 5 new).rename_snippetand reports failures.ruff check: 368 findings versus 369 on the base, none new. The repository does not lint clean today.Not covered
os.path.samefile.Generated by Claude Code