FluidVoice icon indicating copy to clipboard operation
FluidVoice copied to clipboard

fix: exclude temporary paste writes from clipboard manager history

Open postoso opened this issue 4 months ago • 1 comments

Description

The clipboard-paste insertion path writes the transcription to NSPasteboard.general to drive a synthetic Cmd+V, then restores the previous clipboard right after. Clipboard managers can still observe that short-lived pasteboard write, so dictations inserted through Reliable Paste or paste fallbacks can end up in clipboard history even though FluidVoice restores the clipboard immediately.

This tags the temporary pasteboard item with the nspasteboard.org marker types org.nspasteboard.TransientType and org.nspasteboard.AutoGeneratedType, using zero-length marker data. Clipboard managers that follow that convention skip the temporary entry, while Cmd+V still receives the plain string and the existing restore path stays unchanged.

The code change is limited to the shared withTemporaryPasteboardString path. That keeps the behavioral surface small: paste still works the same way, the previous clipboard is still restored, and only the metadata on FluidVoice's temporary pasteboard item changes.

Type of Change

  • [x] 🐞 Bug fix (non-breaking change which fixes an issue)
  • [ ] ✨ New feature (non-breaking change which adds functionality)
  • [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] 📝 Documentation update

Related Issue or Discussion

Related to #479 and #494. This does not close either issue: those cover terminal insertion failures. This PR removes clipboard-manager history pollution from the paste-based route, which is complementary to the terminal reliability work.

Testing

  • [ ] Tested on Intel Mac
  • [x] Tested on Apple Silicon Mac
  • [x] Tested on macOS 15.7.7
  • [x] Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources Tests/FluidDictationIntegrationTests/LLMClientRequestBodyTests.swift Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swift
  • [ ] Ran formatter locally: swiftformat --config .swiftformat Sources
  • [x] Built locally: xcodebuild build-for-testing -project Fluid.xcodeproj -scheme Fluid -destination 'platform=macOS,arch=arm64' CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

Added dedicated TypingServiceTransientPasteboardTests coverage for the extracted helper:

  • the item still carries the plain .string value needed for paste
  • the item is tagged Transient and AutoGenerated with zero-length marker payloads
  • the item is not tagged Concealed

Manual Raycast check from the original validation:

  • wrote one normal control pasteboard entry and three marked entries using the same RAYCAST-TEST-4b7c text (Concealed, Transient, AutoGenerated)
  • Raycast Clipboard History recorded only RAYCAST-TEST-4b7c NORMAL; the marked entries did not appear

Notes

org.nspasteboard.ConcealedType is intentionally not used by this PR. It signals sensitive/password content, which is not the right meaning for a dictation transcript. The code uses only the Transient and AutoGenerated markers.

Full hosted test execution was not run locally because the installed FluidVoice app was open; the hosted test runner can hang in that state. build-for-testing compiled the app and test target, and CI should run the full hosted suite after the branch update.

Screenshots / Video

  • [x] No UI/visual changes; screenshots/video are not applicable.

postoso avatar Jul 05 '26 02:07 postoso

The PR Policy check is blocking this PR because required template information is missing.

Please update the PR description with:

  • Description
  • Type of Change
  • Related Issue or Discussion
  • Testing
  • Screenshots / Video

Screenshots or video are required for UI, UX, settings, onboarding, overlay, menu bar, or visual behavior changes. If this PR has no visual changes, check the no-visual-change box in the template.

If this remains incomplete for 48 hours after opening, the PR may be closed.

github-actions[bot] avatar Jul 05 '26 02:07 github-actions[bot]

this seems like a good one! wanna fix all of the issues and perhaps add a clip for me to verify ? I can happily merge this ;) might be useful for me as well.

altic-dev avatar Jul 12 '26 09:07 altic-dev