Repository navigation
Redact text shortcut expansions only as whole words - #302
Merged
alexkroman merged 1 commit intoNov 5, 2026
Merged
Conversation
redactingExpansions puts pasted expansions in the text before the cursor back to their triggers before it rides stt_prompt. It used a plain replacingOccurrences, so a short expansion also matched inside other words: with "thumbs" -> "ok", "I booked a token for the joker" went out as "I bothumbsed a tthumbsen for the jthumbser". The pasted text was never affected, only the context meant to prime the transcript. Redaction now follows the whole-word rule expand already uses: an expansion that starts or ends with a letter or digit never matches inside a longer word, so "Rupok's" and "(me@example.com)." are still caught. The clipped-expansion check at the start of the text only counts a clip that ends a word, so "Rupok Ghosh" no longer turns "k Ghoshal" into "my nameal". The trigger is inserted as a literal template. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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 changed
stt_prompt), it now only matches whole words, the same ruleexpandalready usesWhy
redaction used a plain find and replace, so a short expansion matched inside other words. with "thumbs" -> "ok", "I booked a token for the joker" was sent as "I bothumbsed a tthumbsen for the jthumbser". the pasted text was never affected, but the context meant to help the transcript was garbled.
one trade-off: "Rupoks" (no apostrophe) is now left as is, so it is not redacted. this matches how
expandtreats word boundaries.Fixes #301
How it was tested
TextShortcutTestsfor the cases above. two of them fail on main and pass with this changeswift testpasses (1218 tests) andswift format lint --strictis clean on both filesscripts/mutate.sh --files Sources/BlurtEngine/Pipeline/TextShortcuts.swiftkills 10 of 10 mutantsstt_promptagainst the live dictation api with a small harness, before and afterscripts/check.shlocally, so CI is the source of truth for the rest