~ 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

Code indexing is set up before serve spawns it, so its coverage is steady

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:serve/code-follow

What changes

code::follow is now a plain function that sets up code indexing and gives back the future serve spawns. It returns nothing when serve has no code index. It does what it did before: asks for each public repository with no shards, then indexes each one asked for. Each ask is handled by indexed, and the asks are read as a stream that never ends while serve runs.

Why

The test check of Maintainers dismiss reviews, which does not touch code search, failed coverage on code.rs 364 and 383, at main 360dae80. Line 364 was follow's return for a serve without code indexing, run only once the spawned task was polled. Line 383 was the end of its loop, reached only when the channel closed. The index holds the channel's sender, so it closes only as serve goes away. Whether either line ran depended on timing, so any pull whose run includes the serve binaries could fail on them. Now the early return is a ? in code run before the spawn, and no line runs only once the loop ends.

How it was checked

clippy for knotless-serve passes here. The coverage gate is left to the test check.

Changeset: none

🤖 Generated with Claude Code

Approved

This makes code::follow a plain function. It does the setup (the ? early returns, the initial asks for repositories with no shards) before the spawn, and returns a future that handles each ask in order through the new indexed function. lib.rs spawns that future only when there is one. Behaviour is unchanged: asks are still handled one at a time, in order, and the telemetry is the same. The two lines that coverage flagged as timing-dependent are gone. futures is already a dependency of knotless-serve. I found nothing that needs changing. The test and check workflows were still running when I looked, so I couldn't see the coverage result.

Approved

The new commit changes only tests/web.rs. searching_code now calls the new code::follow, which returns an Option, and spawns the future with .expect("a code index"). The test site has a code index, so that holds, and the call compiles against the new signature. The code.rs and lib.rs changes are as I reviewed them before. follow does its setup, with ? early returns and the initial asks, before the spawn. lib.rs spawns the future only when there is one. I found nothing that needs changing. The test and e2e checks hadn't finished when I looked, so I couldn't see the coverage result.

Merged as 842ca76