A transcription response can arrive after the user cancels, starts another recording, or changes applications. Treat the result as data from its original session, not permission to perform the next action.
Cancellation must remain effective even when work completes successfully elsewhere. A late final result should not revive a session or become the text for a newer request.
Make eligibility explicit at each side effect
Record session identity and a state transition that invalidates normal delivery. Check it before preview updates, cleanup, clipboard writes, insertion, and any retained-history action governed by the cancellation policy.
Remote or native execution cancellation may be best effort under its actual contract. Preventing unwanted delivery remains a separate application responsibility even when the provider cannot stop work immediately.
Race a fictional pair of recordings
Start session A with harmless text, cancel it, and start session B. Delay A's final recognition response until B is listening or displaying a preview. Verify A cannot enter B's transcript, trigger a paste, or replace B's status.
Repeat with cancellation during capture, finalisation, optional cleanup, preview, and insertion preparation. Test duplicate provider events, timeout followed by success, app teardown, and permission change.
Inspect target text, clipboard, stored recovery data, diagnostics, and resource state. A clean editor result alone does not prove the old transcript was excluded from every unintended side effect.
Keep completion semantics provider-specific
For streaming recognition, understand the actual interim, final-segment, and session-end signals. The current Deepgram completion guide is one primary reference; other services may differ.
Do not equate a provider's final segment with current user approval to insert. The application owns the session and destination policy. Likewise, a failed cancellation request does not mean the user silently agreed to receive the result.
The tradeoff is simple callbacks versus explicit lifecycle state. Session checks add structure but make races reproducible and reviewable. A global latest-transcript variable can appear convenient while allowing old work to corrupt new intent.
Use deterministic delay fixtures before device or service tests so the critical ordering is exercised reliably. No cancellation latency or successful race test is claimed in this proposed plan.
The Mac dictation guide covers cancellation boundaries. StackSpeech's portfolio entry documents safe cancellation as product intent, without a universal reliability benchmark.
Questions about late transcription results
Does a successful final response override cancellation?
No. Provider completion and application eligibility are different facts. Preserve the cancelled session's boundary.
Can old output be reused for a new session automatically?
Only through an explicit supported recovery choice, not by assigning whichever response arrived last to current state.
What should be tested first?
Delay cancelled session A until session B is active and inspect all side effects. Bring contamination to a dictation concurrency review.