uttrflow / uttrflow/uttrflow-swift
Test AI suggestion candidates merged across folders when only one side has evidence, and fuzzy matches over budget
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 286
Description
## What happens
`Sources/UttrflowPredictStore/PredictStore.swift`:
- lines 130-131: `combine(_:_:)` when a text is known in two surfaces but only one of the candidates carries `evidence`;
- line 212: `fuzzyCandidates` dropping a candidate that passes the character-mask pre-filter but whose real edit distance is over budget;
- line 210: the mask pre-filter rejecting a candidate;
- line 73: `recent(in:limit:)` for a surface with sibling folders but no row of its own.
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
`combine` decides how often a line seems to have been used, and that decides its rank. If the one-sided case drops the evidence, a line typed many times in one project folder ranks as never used when suggested in a sibling folder. The over-budget guard stops the fuzzy fallback suggesting lines that only look similar.
## 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/UttrflowPredictStore/PredictStore.swift` and look for the `0` counts on the lines named above.
## Acceptance criteria
- A test records a line in folder A only, and records the same text as a superseded or evidence-less candidate reachable from folder B. `candidates` from B has one candidate whose count equals A's.
- A test records `deploy staging` and types a query whose letters pass the mask but are more than the budget of edits away (for example, the same letters transposed several times). The fuzzy result is empty.
- `recent(in:limit:)` for a new document in a folder with history returns that folder's lines.
- 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/UttrflowPredictStoreTests/PredictStoreTests.swift`, suites "Matching what was nearly typed" and "What usually follows what". `FuzzyMatch.budget(forQueryOfLength:)` tells you the budget.
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 to M.
Contributor guide
Research direction
Read CONTRIBUTING.md, then open Tests/UttrflowPredictStoreTests/PredictStoreTests.swift and the suites “Matching what was nearly typed” and “What usually follows what.” Use FuzzyMatch.budget(forQueryOfLength:) and run the focused suites with swift test --filter. Done means tests cover the three named branches, fail when each branch is temporarily broken, and pass with make verify.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100