uttrflow / uttrflow/uttrflow-swift

Test that every clipboard panel row action maps to the same key its shortcut sends

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

Description

## What happens

`Sources/UttrflowUX/PanelPresentation.swift:46-57`: `PanelIntent.key` says, per its doc comment, that "the Insert button and Return are provably one path". Seven of its cases have never run: `.alias`, `.move`, `.delete`, `.makeNote`, `.tickBox`, `.renameCategory` and `.deleteCategory`. Only `.insert`, `.reveal`, `.reindent` and `.scope` are exercised.

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

The row menu's buttons and the keyboard go through this mapping. If a case maps to the wrong `PanelKey` (for example, `.move` to `.delete`), clicking "Move" in the menu deletes the clip. Nothing would catch it, and #630 already notes that the key handling in the view is untested.

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

## Acceptance criteria

- A parameterised test covers every `PanelIntent` case that has a key, and asserts the exact `PanelKey`, for example `.move(id)` gives `.move(id)` and `.tickBox(id, 2)` gives `.tickBox(id, index: 2)`.
- The cases with no key (`.format`, `.copy`, `.pin`, ...) are asserted to give `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/UttrflowUXTests/PanelRowMenuTests.swift` or `Tests/UttrflowUXTests/PanelKeyboardTests.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 PanelIntent.key in Sources/UttrflowUX/PanelPresentation.swift and the tests in Tests/UttrflowUXTests/PanelRowMenuTests.swift or PanelKeyboardTests.swift. Run the relevant suite with swift test --filter . Done means parameterized coverage asserts every keyed PanelIntent maps to its exact PanelKey and keyless cases return nil; finish with make verify.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
desktop, testing
Issue type
Refactor
Difficulty
1/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.