~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

Rarely reached branches share a line with what always runs

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:tests/chance-lines

What changes

Three branches that tests reach only now and then no longer have a line of their own. Each now shares a line with code that always runs. What each does is unchanged:

  • knotless-run's consider: a repository with no record, and one whose record doesn't name the runner, are passed over by one let … else { return Ok(()) } on a single line, where there were two returns.
  • A pull card's counts: let Some(size) = size else { return }; on one line, as rustfmt keeps it without the semicolon.
  • The label stream: a label read from the past and heard live too is skipped by open = !fresh || tx.send(…). The if seq > sent { … } is gone, and its closing brace took the count of the skip.

Why

Each of these failed the coverage gate in pulls that never touched the file, and so ejected them from the queue. I went through every failed test run on record: 72 across both runners since 10-30, 21 of them missing five lines or fewer. These were the only lines left that missed in pulls that never touched them.

  • consider's second return (knotless-run/src/lib.rs) missed in two pulls. The test ends right after a repository stops naming the runner. The spawned consider that returns there can still be fetching the repository when the test's runtime drops.
  • The label stream's } (moderation.rs) missed once. It counts only when a label is given out in the moment between subscribing and reading the past.
  • counts' return; (card.rs) missed once on main, in the copy the integration tests build. They draw a pull's card before its size is known only sometimes.

The first return in consider (a record of no repository) is reached every time, since the test sends one mid-way. So one shared line makes it certain. The other two can't be arranged by a test at all. The cases stay handled, and the gate stops depending on timing.

spaces.rs' early return, which missed in 13 pulls, last did at 07:56 today. It has not missed since the test that calls follow without spaces landed.

How it was checked

cargo fmt keeps each on one line. CI's test runs the gate.

Shortcomings

A rare branch on a shared line is no longer counted on its own. Nothing tests that a label sent twice goes out once, and nothing could before either. Other lines may still be covered by chance. These are only the ones that have failed pulls.

🤖 Generated with Claude Code

Approved

This pull rewrites three rarely-reached branches so each shares a line with code that always runs. I found no change in behaviour in any of them.

  • consider: key is still taken from snap.key() and checked with names(...). A missing key or an unnamed runner still returns Ok(()).
  • counts: let Some(size) = size else { return }; is the same logic on one line.
  • Label stream: sent = sent.max(seq) gives the same sent as before. When seq <= sent, open is now set to true, which is what it already was while the loop ran, so a duplicate is still skipped. When seq > sent, open is still the result of the send.

I didn't run the checks.

Merged as 3d92c74