uttrflow / uttrflow/uttrflow-swift

Test AI suggestion field grouping for file:// and percent-encoded document paths, and a history ending in a continued line

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

Description

## What happens

Two parsing branches in `UttrflowPredictCapture` have never run:

- `Sources/UttrflowPredictCapture/FieldReading.swift:115-116`: `directory(of:)` for a document given as a `file://` URL, and for a path with percent-encoded characters (such as `%20`). Tests only use plain paths;
- `Sources/UttrflowPredictCapture/ShellHistory.swift:29`: `commands(in:)` when the file's last command continues with a trailing backslash and there is no newline after it.

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

`directory(of:)` decides which documents share one suggestions corpus. If `file://` or `%20` handling breaks, every document in a folder whose name has a space gets its own empty corpus, and suggestions stop working there. The history case silently drops the last command someone ran when importing a shell history.

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

## Acceptance criteria

- A `FieldReading` whose document is `file:///Users/example/My%20Project/notes.md` groups with one whose document is `/Users/example/My Project/other.md`.
- `ShellHistory.commands(in: "ls\ngit commit \\\n -m done\\")` keeps `ls` and the continued command.
- 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/UttrflowPredictCaptureTests/FieldReadingTests.swift` (suite "Telling one field from another by what it publishes") and `Tests/UttrflowPredictCaptureTests/ShellHistoryTests.swift`.

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, under an hour.

Contributor guide

Open the contributing guide

Research direction

Read CONTRIBUTING.md, then inspect the named suites in Tests/UttrflowPredictCaptureTests/FieldReadingTests.swift and ShellHistoryTests.swift. Run the filtered Swift tests first, adding coverage for file:// and percent-encoded paths plus a continued final shell-history command. 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-qa
Issue type
Feature
Difficulty
2/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.