Repository navigation
Never replay dictations into fields whose security is unknown - #358
Merged
Merged
Conversation
A dictation is kept out of Recent (and so out of later stt_prompt lines) only when the press-time read flagged a password field. Two cases left security unknown and fell through to "record it": - No focused element reachable (untrusted, or an Electron app answering the focus query with nothing): FocusCapture returned `.empty`, whose isSecure is false. It now returns `.unreachable`, flagged secure. - The read still in flight at release: capturedContext is nil, which read as "not secure". PressContext now tracks whether the read has landed, and the remember decision reads `mayRemember`, which requires it to have landed and not be secure. Delivery is unchanged; only remembering is withheld. Tests cover the hung read and the unreachable field, and the press-known test now lets each read land before release so its history is still seeded. Fixes #335 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DS5B1W14FsLoKZzXYpRu2z
alexkroman
enabled auto-merge
November 24, 2026 22:49
The previous commit dropped a dictation from the ring whenever the press couldn't tell whether the target was a password field. The ring also feeds the Recent list and saved history, so every dictation into an app Accessibility can't see (many Electron apps), while untrusted, or released before the read landed silently vanished from history too -- and the UI-test build, which runs untrusted, would land nothing in Recent. Split the verdict three ways (`PressContext.TargetSecurity`): - ordinary: remembered and replayed, as before; - secure (a known password field): not remembered, as before; - unknown (read not landed, or no focused element reached): remembered with `replayable: false`, so it stays in Recent and saved history but `spokenOldestFirst` never sends it in `stt_prompt`. `.unreachable` now sets a separate `securityUnknown` flag (carried as `TranscriptionContext.targetSecurityUnknown`) instead of `isSecure`. The developer-mode log withholds an unknown target's transcript too, closing the case where a read still in flight left it written in plain text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DS5B1W14FsLoKZzXYpRu2z
CI's swiftlint (--strict) failed on file_length: the two new tests took DictationSessionContextTests.swift to 452 lines, past the 400 default. They now live in DictationSessionUnknownSecurityTests.swift, which is also where they belong topically; no test logic changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DS5B1W14FsLoKZzXYpRu2z
Collaborator
Author
|
CI note on Generated by Claude Code |
github-merge-queue
Bot
removed this pull request from the merge queue due to invalid changes in the merge commit
Nov 25, 2026
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 & why
Fixes #335. A dictation was kept out of
recentDictations(and so out of laterstt_promptlines) only when the press-time read positively flagged a password field. Two common cases left security unknown and failed open:FocusCapturereturned.empty, whoseisSecureis false.capturedContextwas nil, which read as "not secure".The verdict is now three-way (
PressContext.TargetSecurity):stt_prompt.ordinary(read landed, normal field).secure(known password field).unknown(read not landed, or no focused element)Unknown dictations stay in Recent and saved history (which stay on the device) but are never sent, so Electron-app dictations don't vanish from history.
Changes:
FocusedFieldContext.unreachable(newsecurityUnknownflag, carried asTranscriptionContext.targetSecurityUnknown), returned byFocusCapture.captureFieldContextwhen no focused element can be read..emptykeeps meaning "a readable, empty, ordinary field".PressContexttracks whether the read has landed (settled) and exposestargetSecurity.RecentDictations.Entry.replayable;spokenOldestFirst(what is sent) skips unreplayable entries.DictationLog.unverifiedTranscript), closing the case where an in-flight read left it in plain text.How it was tested
New:
hungReadIsNotReplayed(read never lands → listed in Recent, not sent, withheld from the log),unreachableFieldIsNotReplayed, andRecentDictationsTests.unreplayableEntriesStayLocal.timedOutReadStillSendsPressKnownContextnow lets each read land before release so its history is still replayable.scripts/check.sh --portablepasses locally (Linux sandbox); Swift build/tests run on CI.Concurrency reviewed (
swift6-concurrency-reviewer): no stale-pressContextrace, tests deterministic, no Sendable issues.scripts/check.shpasses (or CI will, if I'm not on a Mac)I read AGENTS.md and this doesn't reintroduce anything deliberately removed
Docs updated if behavior changed
🤖 Generated with Claude Code
https://claude.ai/code/session_01DS5B1W14FsLoKZzXYpRu2z