A snippet is skipped whenever its expansion appears inside any word of the dictation: "Ops" is switched off by "stopsign"
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Under an hour
- Newbie friendliness
- 92/100
Research direction
Start in Sources/UttrflowAI/SnippetExpander.swift:20-56, comparing the quoting check with Surroundings.repeats in Sources/UttrflowContext/Surroundings.swift. Add the regression to Tests/UttrflowAITests/SnippetExpanderTests.swift and run make verify after setting DEVELOPER_DIR. Done means expansions inside larger words no longer suppress snippets, while existing quoting tests still pass.
Written by the indexing model from the issue text.
Description
What happens
SnippetExpander.expand skips a snippet when the dictation already "quotes" its expansion (Sources/UttrflowAI/SnippetExpander.swift:26-27):
let spoken = TextTidy.collapseWhitespace(transcript).lowercased()
let eligible = candidates.filter { !spoken.contains($0.quoted) }
contains is a plain substring test, so an expansion found inside any other word switches the snippet off for that whole dictation. The trigger matching next to it is careful about word boundaries (fits, :66-92); this check is not.
Measured with a throwaway test in UttrflowAITests:
| Snippet | Dictation | Expected | Actual |
|---|---|---|---|
my team → Ops |
Ask my team about the rollout. |
Ask Ops about the rollout. |
Ask Ops about the rollout. |
my team → Ops |
Ask my team about the stopsign rollout. |
Ask Ops about the stopsign rollout. |
unchanged (stopsign contains ops) |
sig → Best |
That is the bestseller, sig |
That is the bestseller, Best |
unchanged (bestseller contains best) |
Why it matters
Short expansions (a team handle, initials, a short code) are common, and they are the ones most likely to sit inside an ordinary word. The snippet then fails without any sign, in some dictations and not others, which is hard for anyone to work out.
How to reproduce
Add to Tests/UttrflowAITests/SnippetExpanderTests.swift:
let expander = SnippetExpander(snippets: [makeSnippet(trigger: "my team", expansion: "Ops")])
#expect(expander.expand("Ask my team about the stopsign rollout.").text
== "Ask Ops about the stopsign rollout.")
Acceptance criteria
- The quoting check matches the expansion only on word boundaries (letters or digits must not continue it on either side), so it still holds back
My address is <expansion>, as you know.and the case- and spacing-insensitive cases inquotingIsRecognisedLoosely. - The two rows above expand; the existing quoting tests still pass.
Where to start
Sources/UttrflowAI/SnippetExpander.swift:20-56;Surroundings.repeatsinSources/UttrflowContext/Surroundings.swiftalready has a whole-word substring check that shows the shape.- Tests:
Tests/UttrflowAITests/SnippetExpanderTests.swift(the "Never expanding what the user is quoting" section). - Run
make verify(exportDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developerfirst) and read CONTRIBUTING.md.
Size: S, about an hour.
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 18h 15m
- Merged PRs (30d)
- 442
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uttrflow/uttrflow-swift
-
Docs/performance.md says the clipboard panel waits for catchUp; toggleQuickPanel no longer waits Openarea:docs documentation good first issue P2
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
uttrflow/uttrflow-swift#1032 ·
-
area:docs documentation good first issue P2
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
uttrflow/uttrflow-swift#1023 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
uttrflow/uttrflow-swift#827 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
uttrflow/uttrflow-swift#802 ·
-
area:general enhancement good first issue P2
Difficulty 2/5 Under an hour Newbie friendliness 92/100
uttrflow/uttrflow-swift#755 ·
All issues in uttrflow/uttrflow-swift
Similar issues
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ionic-team/capacitor#8616 ·