Repository navigation
Fix Clipboard History overwriting snippets created in the same app session - #507
Merged
ggbond268 merged 1 commit intoOct 27, 2026
Merged
Conversation
xcv58
marked this pull request as draft
October 26, 2026 01:57
xcv58
marked this pull request as ready for review
October 26, 2026 02:04
There was a problem hiding this comment.
🟢 Approval recommended
The narrow factory change addresses the shared-ID defect, with focused regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes Clipboard History’s same-session snippet overwrites by generating a fresh UUID for each new draft while preserving existing snippet IDs during editing.
Changes:
- Replaces the shared empty draft with a computed factory.
- Adds regression coverage for independent creation, editing, and persisted contents.
- Adds a user-facing plugin changelog entry.
Tests were not rerun in this review environment because macOS project execution is unavailable. Local verification: make test TEST_FILTER=ClipboardSavedLibraryTests and make validate-changelog.
| File | Description |
|---|---|
| Plugins/ClipboardHistory/Tests/ClipboardSavedLibraryTests.swift | Tests separate snippet creation, edit identity, and persistence. |
| Plugins/ClipboardHistory/Sources/ClipboardSavedLibrary.swift | Generates a fresh UUID for each empty draft. |
| changes/unreleased/clipboard-new-snippets.md | Documents the snippet overwrite fix. |
Review effort: Balanced
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.
Problem and result
Saving snippet B with New Snippet after saving snippet A in the same app session overwrote A instead of adding another entry. Fully quitting and reopening MacTools generates a different draft UUID, allowing the first new snippet after each launch to be added separately; reopening only the Clipboard window does not reset it.
With this change, repeated New Snippet saves create independent entries, and editing an existing snippet preserves its ID.
Changes
ClipboardSnippetDraft.emptya computed property so each new draft gets a fresh UUID instead of reusing one process-wide value.Verification
make test TEST_FILTER=ClipboardSavedLibraryTests: 19 tests passed, including the regression.make validate-changelogandgit diff --checkpassed.bd70b616, with no actionable issues found.Earlier creation tests supplied
id: nildirectly and bypassed the faulty factory. The new regression covers that missing creation path using a fake pasteboard, an in-memory key store, and temporary storage.UI evidence
Not applicable to visual evidence: no views, layouts, styling, localization, accessibility, or interaction handlers changed. The native UI flow was not manually retested; the regression exercises the draft factory used by New Snippet and the controller/persistence path.
Checklist