uttrflow / uttrflow/uttrflow-swift

Test AI suggestion path lookups at the root directory, and that a case-only difference is never corrected

Open Beginner friendly
#746 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

`Sources/UttrflowPredict/Verification.swift` decides what the machine can confirm about a path in a shell line. These have never run:

- line 165: `choices(for:)` when the word is exactly `/` (for example `cd /`);
- lines 231-232: `path(_:directoriesOnly:)` for an absolute path directly under root, such as `/et` (lookup under `/` with prefix `/`);
- line 222: `path` for a word without a slash;
- line 102: `nearestNeighbour(of:among:)` skipping a candidate that differs only in case, which the comment says is never a typo.

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

If the root case is wrong, `cd /` offers entries of the current directory instead of `/`, and `cat /et` never completes to `/etc`. If the case-only guard goes, a directory named `Documents` "corrects" a typed `documents` on a case-insensitive disk.

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

## Acceptance criteria

- `Verification.choices(for: CompletionToken("cd /")!)` has one lookup of `.directories(under: "/")`.
- The lookup for `cat /et` is `Lookup("et", [.entries(under: "/")], prefix: "/")`.
- `nearestNeighbour(of: "readme", among: ["README"])` is `nil`.
- 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/UttrflowPredictTests/VerificationTests.swift` (suite "What the machine can deny in a line the model wrote"). `LineShapeTests.swift` shows how `CompletionToken` values are built.

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/UttrflowPredictTests/VerificationTests.swift and the "What the machine can deny in a line the model wrote" suite; use LineShapeTests.swift for CompletionToken construction. Add the four requested regression tests, verify each fails when its covered branch is temporarily broken, run the filtered suite, and finish with make verify.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli, testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.