uttrflow / uttrflow/uttrflow-swift
A terminal command paused for eight seconds is not learned when Return is pressed
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## Problem
`CommitDetector` marks an idle value committed before `CaptureSession` checks whether that ending is allowed. Under the shipping `whereReturnSends` policy, the idle commit is refused, but an unchanged Return is then discarded as a duplicate. A valid finished terminal command is never recorded.
## Evidence
Reviewed `main` at `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`. Reproduced against the unchanged production source in an isolated Swift package on macOS, with fake transport or temporary stores as appropriate. These checks assert the observed defect; they are not a claim that the full app test suite passed.
With consent allowed for `com.apple.Terminal`, a real in-memory `PredictStore`, and a `CaptureSession(policy: .whereReturnSends)`:
```swift
handle(.keystroke("git status", at: t), in: terminal)
handle(.tick(at: t.addingTimeInterval(9)), in: terminal)
handle(.returnPressed(at: t.addingTimeInterval(10)), in: terminal)
```
Observed: Return produces `.nothing`; the store contains zero entries. Control: type `git log` and press Return one second later; the store gains one entry. `SuggestionTicking.window` is 12 seconds, so the live timer runs long enough to deliver the failing idle tick.
## Relevant code
- [Sources/UttrflowPredictCapture/CommitDetector.swift:113](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredictCapture/CommitDetector.swift#L113)
- [Sources/UttrflowPredictCapture/CaptureSession.swift:112](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredictCapture/CaptureSession.swift#L112)
- [Sources/UttrflowPredictCapture/CommitPolicy.swift:24](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredictCapture/CommitPolicy.swift#L24)
- [Sources/Uttrflow/Suggestion/SuggestionTicking.swift:13](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/Uttrflow/Suggestion/SuggestionTicking.swift#L13)
## Fix and acceptance criteria
Apply the commit policy before consuming the pending value, or acknowledge a commit only after it is admitted. Add a regression test covering pause then Return in terminal and messaging policies, repeated idle ticks, and the ordinary idle-learning policy.
Contributor guide
Research direction
Start by reading CommitDetector.swift:113, CaptureSession.swift:112, and CommitPolicy.swift:24, then trace the pause-and-Return flow under whereReturnSends. Use the described isolated Swift package reproduction as the first check; done means regression coverage for terminal and messaging pause-then-Return, repeated idle ticks, and ordinary idle learning, with the valid command stored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100