uttrflow / uttrflow/uttrflow-swift
Test that RecordingStore.begin abandons a recording that is still open
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`Sources/UttrflowAudio/RecordingStore.swift:40-43`: when `begin` is called while a previous `RecordingWriter` is still open (a new dictation started before the last one was finished or discarded), the store calls `previous.abandon()` and waits for `previous.drained()` before opening the next file. The branch has never run.
Measured on origin/main `26d7bc1` with `swift test --enable-code-coverage` (5,384 tests, all passing) and `xcrun llvm-cov export` over the test binary. The regions named below have an execution count of 0: no test runs them, so a change that breaks them passes `make verify`.
## Why it matters
Recordings are the user's audio on disk (`Docs/recordings.md`). If this branch is lost, a quick second dictation leaves the first file open and never finished. That's a stray WAV with a header claiming zero frames, which a later launch may offer for retry or never clean up.
## How to reproduce
Run `swift test --enable-code-coverage`, then `xcrun llvm-cov show -instr-profile .build/debug/codecov/default.profdata .build/debug/UttrflowPackageTests.xctest/Contents/MacOS/UttrflowPackageTests Sources/UttrflowAudio/RecordingStore.swift` and look for the `0` counts on the lines named above.
## Acceptance criteria
- A test calls `begin()`, appends a block, then calls `begin()` again without `finish`. It expects the first writer's file to be gone (or handled exactly as `abandon` documents), and the second writer to be the open one.
- `current()` after the second `finish` answers with the second recording.
- Each new test fails when the branch it covers is broken. Check this by hand before opening the PR: temporarily change the branch (flip the condition or return the other value), see the test fail, then restore it.
## Where to start
- `Tests/UttrflowAudioTests/RecordingStoreTests.swift`, suite `RecordingStore`. It already makes a store in a temporary directory.
- `Tests/UttrflowAudioTests/RecordingWriterTests.swift` shows what `abandon` does to the file.
Read `CONTRIBUTING.md` first. Iterate with `swift test --filter `, then run `make verify` before pushing. Only tests change; no product code needs to.
**Size:** S.
Contributor guide
Research direction
Read CONTRIBUTING.md, then open Tests/UttrflowAudioTests/RecordingStoreTests.swift and its RecordingStore suite. Compare RecordingWriterTests.swift for abandon behavior, add the begin-twice coverage, run swift test --filter , verify the test fails when the branch is broken, and finish with make verify.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100