uttrflow / uttrflow/uttrflow-swift

Test that BackedSpeechEngine refuses silent audio, and audio whose speech is too short once silence is trimmed, with nothingHeard

Open Beginner friendly
#727 0 comments 0 reactions 0 assignees View on GitHub
area:dictation enhancement good first issue P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

`Sources/UttrflowPipeline/PieceJoiner.swift` joins the pieces of a long dictation. These early returns have never run:

- line 72: a piece that is empty or only whitespace is skipped;
- line 76: when only one non-empty piece remains, its text is returned without any list or paragraph layout;
- line 109: a restatement check at the very first word;
- lines 158 and 161: `itemise` finding no body after the sequence word;
- line 176: `sequence` when a piece ends on the prefix ("number" or "point") with nothing after it;
- line 205: `opensTopic` for a word no longer present.

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

Long dictations are cut into pieces at pauses, and a pause can produce an empty piece. If the empty-piece skip or the single-piece early return is broken, the joined text can gain a stray bullet, a blank paragraph, or lose a word at a seam. All of that lands in the user's document.

## 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/UttrflowPipeline/PieceJoiner.swift` and look for the `0` counts on the lines named above.

## Acceptance criteria

- `laidOut(["", "first buy milk", " "], under: )` returns the one piece's text unchanged, with no bullet.
- `laidOut(["first fix the build", "number"], ...)` does not crash, and keeps "number" as a word.
- Two pieces where the second is only a sequence word ("first buy milk", "second") do not make an empty list item.
- 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/UttrflowPipelineTests/PieceJoinerTests.swift`. It already builds `DestinationFormatter` values with and without `.lists` and `.paragraphs`.

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

Open the contributing guide

Research direction

Read CONTRIBUTING.md, then open Tests/UttrflowPipelineTests/PieceJoinerTests.swift and the named branches in Sources/UttrflowPipeline/PieceJoiner.swift. Add tests for empty pieces, single-piece layout, restatement, empty itemise bodies, sequence prefixes, and missing-topic words; run the filtered suite and confirm each test fails when its branch is temporarily broken, then run make verify.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.