chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
The tests run under a 100% line and function coverage gate
MergedThis pull adds a 100% line-and-function coverage gate: just cov runs in just check, and the test.yml step runs cargo-llvm-cov, pinned in uses.lock. It also brings the tests that reach 100%, two real fixes, and production code rewritten so no path is dead. AGENTS.md, docs/internals.md and docs/tools.md are updated with it. The test, check, web and docs runs pass at this head. e2e and e2e-spaces were still running when I looked.
What I checked in the production rewrites, which is where a coverage-driven refactor could change behaviour:
ui/document.rs: the new.expect()s run on untrusted markdown, so they need to be unreachable.- The task marker always arrives with its item on top of the stack.
close_details()runs before every block end pops the stack.close_detailonly ever pops aDetails.- The new
pushinto aList's blocks only ever receives items. - Footnote matching through
UniCaseis what pulldown-cmark does, andfinishstill usesfilter_map.
identity::handle_did:try_join!short-circuits on a DNS DID and otherwise waits for both answers, the same result as the oldselect!.oauth/:- Every caller of
Auth::saveeither holds a live session's lock after checkingended(snapshot→refresh_locked,refresh_grant) or saves a session that is new. loopbackviahost_str()matches what the oldHostcomparisons matched.SignIn::Failednow carries the page, and a request taken in the meantime still reads asExpired.
- Every caller of
canvas/space.rs: removingmove_outrelies on an occupiedkeptentry implying the owner's choice isSpace. That holds: both places that setChoice::File(decide, andfailedafter three failures) callto_filesunder the same lock.writes.rs: the empty-template refusal comes before anything is sent, andresults.first()replaces theresults[0]panic.- Smaller ones:
needin hud-server'sxrpc.rsis safe because input is checked against the lexicon first.- The
view.rsaction and tab checks are safe becauseTy::check_literalalready requires objects. ui/embed.rsexternalandfeeds::fallback_namekeep their old results for every input that can occur.
Nothing I read needs to change.
Not read in full: the diffs of crates/hud-core/src/tools.rs (about 1,200 lines) and crates/hud-core/src/oauth/tests.rs (about 1,450 lines) were too large for my tool to return. tools.rs has no new .expect() outside its tests, and the passing test run covers both files. I read every other file in the diff.
Since I approved at 9cc069c, the only new commit is 94f319f, a merge of main. It brings main's scope work (scope::asked, scope_refused, the removal of HUD_OAUTH_SCOPE) under the coverage gate. It also adds tests for what main brought in untested, and one test-only helper, Auth::signed_in_offline_asking.
The merge. The changes from 9cc069c to the head were too long for my tool to return whole, so I read the pull's own diff of the files where main's scope work and this pull meet: oauth/mod.rs, oauth/store.rs, writes.rs, hud-server's xrpc.rs and hud/src/main.rs.
signed_in_offline_askingonly exists undercfg(any(test, feature = "testing")), andsigned_in_offline_atnow calls it with the configured scope, so it behaves as before.- In
apply_writes, the empty-template refusal still comes beforeasks_to_writeand before anything is sent. - The new scope checks sit beside it and are untouched by the merge.
- The production rewrites I checked last round read the same at this head.
Checks. Every check passes at this head: test (under the gate), check, web, docs, and now e2e and e2e-spaces too, which were still running last round. lexicons was skipped because nothing it watches changed.
My last review asked for nothing, and nothing here needs to change.
HUD's tests now run under the same gate as knotless's:
just cov, injust checkand the test workflow, fails under 100% of lines or functions. The tests that reach 100% come with it, and found two bugs, fixed here:apply_writespanicked on a template that makes no records, and footnotes matched only by Unicode case drew no note.Claude Opus 5.5
What changes
The gate.
just covruns every crate's tests under cargo-llvm-cov and fails under 100% of lines or functions, naming each line no test runs.just checkruns it in place ofcargo test, andtest.ymlruns the same throughchadtmiller.com/steps/cargo-llvm-cov@1(0.9.1, pinned inuses.lock), keepingHUD_ANSWERSforharness/answers.mjs. It leaves out the tests themselves (tests/,tests.rs), the harness, examples and the standard library. AGENTS.md says how to close a missed line, anddocs/internals.mdnames the gate. HUD needs nothing like knotless'scov.mjs: its tests run against fake PDSes, so one run covers everything.The tests. Lines went from 87.97% to 100%, functions from 87.34% to 100%. Most are tests of refusals, error paths and edge inputs, each asserting what a caller sees.
crates/hud/tests/cli.rsruns thehudbinary itself:hud servewith sign-in off and on, stopped by SIGTERM and SIGINT, every configuration refusal, andhud resolve.Two fixes.
apply_writesrefuses a template that makes no records ("Nothing to write: no write's when holds") before anything is sent; it sent an emptyapplyWritesand indexedresults[0]. Markdown footnote labels are matched as pulldown-cmark matches them, by Unicode case folding (unicase, a direct dependency now), sox[^É]with[^é]: Adraws note A.Code written so no path is dead. Where no test could reach a line, the code was written so the path does not exist, keeping behaviour for every input that can occur. The larger ones:
catalog.rs's prop helpers (p,req,lit,bound) are macros: asconst fns they ran only at compile time, so no test could count them.Openedkind; its ends share one arm, and main's<details>sits in it asOpened::Details.handle_didasks DNS and the well-known DID withtry_join!, a DNS DID ending it at once, in place of aselect!whose arms depended on which answered first; the result is the same in every order.sign_inanswersExpiredin place ofFailed(no route exists then to show it).Auth::resource_metadata(no caller) andAuth::save'sendedcheck (every caller holds a live session's lock or saves a new one) are gone.Net::new's resolver and client builds, and a few others whose error no input reaches, useexpect.tracingcalls bind their fields first, so each is one line: without a subscriber their field lines never run.Tests pause time where they need to (
tokio'stest-util, a dev-dependency of hud-core and hud-server).Why
So a change can't land code no test runs, as on knotless. A missed line is usually a case nobody checked; the two fixes above were found that way.
How it was checked
just checkpasses: rustfmt, clippy, the tests underjust cov(100% of 34,890 lines and 4,204 functions, main merged in), svelte-check,just lintandjust lex(287 answers as their lexicons say). The gate runs in about a minute here once built.just e2eandjust e2e-spaceswere not run: nothing they drive changed but the two fixes above. The runner's first run of the newtest.ymlstep is left to CI.Shortcomings
hud serveneed its profile written, so they stop it by signal; a test killing it would lose its lines.cargo llvm-cov report --jsonnames it.Review
The production changes, not the tests: start at
catalog.rs,ui/document.rs,identity.rs'shandle_did,oauth/andcanvas/space.rs'swrite.