Repository navigation
test: raise coverage to 100% of coverable lines, with dimensions and mutation evidence - #877
Merged
Merged
Conversation
…and mutation evidence
Per-module coverage for all 21 groups, plus the boundary/error-path/concurrency/
serialization/platform dimensions each module doc registers. Uncovered lines are either
covered or waived with a category AND a reason under the repo policy; several modules are
gate-green on structure only and that is recorded in docs/testing/.
Also fixes the 20 pre-existing Windows test failures (13 tui + 7 channels).
Test-quality work that the line metric cannot see:
* mutation testing found a 100%-line-covered file whose three default access-policy
values survived mutation; assertions were added and the survivors are caught,
verified by a before/after measurement.
* assertion-free Rust tests 70 -> 56, each replacement asserting behaviour.
* zero newly ignored or skipped tests (verified by test-name-set diff).
Production changes carried for correctness, all disclosed:
* compat.rs Windows delete-pending retry (cfg(windows), no-op elsewhere).
* loop console.rs detached_child_args via the unified `future` binary.
* test-only seams behind #[cfg(test)] (rpc protocol barrier, loop store write_fault,
console detach_probe) plus two pub(crate) visibility widenings.
* desktop/vite.config.ts maxWorkers cap and mobile jest maxWorkers cap, both fixing
load-dependent collection failures.
# Conflicts: # mobile/src/features/chat/__tests__/skillRecoBudget.test.ts # mobile/src/features/chat/__tests__/useSkillRecommendation.test.ts # mobile/src/remote/__tests__/replay.test.ts # mobile/src/remote/__tests__/syncEngine.test.ts
Both were found by running CI's own `cargo test --workspace`, which no coverage gate runs, and both failed only in the full suite: * `rpc/commands/dispatcher_tests.rs` pinned the error text "(for output) toolCallId are required", but origin/main reworded the production message to "(for call-scoped reads) ...". Git merges text, not meaning, so the auto-merged file looked consistent and was semantically broken. Aligned with the production wording; the test's intent (the error names the required fields) is unchanged. * `rpc/commands/session_lifecycle_tests.rs` asserted the process-global event broadcaster was EMPTY after a second activation. That is a property of a shared resource which 2000+ parallel tests legitimately publish to, not of this code. Replaced with the claim itself: drain a bounded number of events and require that none announces the session again. Also: register `origin/main`'s disabled tests in the audit doc (6 environment-gated measurement instruments plus 1 prose mention, all added upstream, none ours), and record the post-merge measurement for the tauri groups. Quiet-machine evidence: `cargo test --workspace --no-fail-fast` -> 126 of 127 targets pass. The one failure is a pre-existing wall-clock budget in `packages/rpc/src/parity.rs` (measured 2.658 us/event quietly, 5.403 us under load, budget 5 us, while its comment claims <1 us); it is disclosed in the PR rather than adjusted, and it is neither our regression nor main's.
huichen
enabled auto-merge (squash)
September 26, 2026 22:12
CI caught what local Windows testing cannot: `tui/src/terminal.rs` defined `columns_rows_read_cached_size` TWICE, both `#[cfg(unix)]` and byte-identical. On Windows both are excluded from compilation, so every local run passed; on Linux both are included, so the crate failed with `error[E0428]: the name ... is defined multiple times`. Deleted the later copy (the bodies were identical, so nothing is lost). This is the class of defect only a non-Windows build can see, which is exactly what CI is for. Also checked for siblings of this class with a scope-aware scan (`#[test]` fns only, since a free `fn` and an impl method may legitimately share a name; module nesting tracked; `cfg(windows)` and `cfg(unix)` treated as mutually exclusive; attributes collected both above `#[test]` and between `#[test]` and `fn`): **zero** real duplicates remain. `cargo check --target x86_64-unknown-linux-gnu` is not usable here (ring's build script needs a Linux C toolchain), so CI remains the authority for the unix cfg set.
Deleting the duplicated `columns_rows_read_cached_size` removed 27 lines but left a doubled blank line at `tui/src/terminal.rs:1149`, which `cargo fmt --check` rejected -- CI's fmt+clippy job failed in 28 s on it. Running `cargo fmt --all` fixes it. Recorded because the failure mode is easy to repeat: deleting a line RANGE can introduce a formatting violation, so fmt has to run after any structural deletion, not only after hand-written edits.
CI (Linux) caught an assertion that could never hold there: `tools::tests::shell_output_is_truncated_beyond_max_keep` counted `'y'` bytes and required >= 490_000 of them, but `'y'` only exists in the WINDOWS payload (`'y' * 600000`). The unix command is `seq 1 120000`, which produces digits and newlines and zero `'y'`s. A Windows build cannot see this -- exactly the class CI exists to catch. Rather than special-case the character, the test now states the property directly: a HEAD marker is emitted first and a TAIL marker last, so the kept slice must contain the tail marker and must NOT contain the head marker. That proves WHICH END survived on both platforms and is stronger than counting payload bytes. A size bound (>= 490_000 and < 600_000, against MAX_KEEP = 500_000 and a full payload of ~600 KB) sits on top as a sanity check.
CI (Linux) found three more places where our tests encoded Windows behaviour. All three are
ours; each fix states the real postcondition instead of the platform-specific way it was
achieved.
* `channels/src/test_support.rs::kill_write_half` `.expect()`ed `shutdown(Write)`, which on Linux
returns ENOTCONN (os error 107) when the peer has already reset. The helper's postcondition is
"the next write fails" -- already true in that case -- so NotConnected is success, not failure.
Applied to the unix and Windows arms alike.
* `cli/src/commands/browser_tools.rs::a_launcher_that_cannot_be_started_is_reported` asserted that
a missing launcher is REPORTED AS AN ERROR. That premise is Windows-specific: `Start-Process`
fails synchronously on a missing file, while on unix the detached spawn reports `starting`
(CI saw `unwrap_err()` on an `Ok`). Gated to Windows, with the platform difference recorded for
the owners rather than an expectation the test cannot justify on unix.
* `cli/src/commands/doctor.rs::binary_version_kills_a_probe_that_never_exits` used
`#!/bin/sh\nsleep 30` on unix. `sleep` is an EXTERNAL child, so killing the shell orphaned it
while it still held the pipes and the readers -- not the deadline -- decided when the call
returned (30.003 s against a `< 25 s` assertion). The Windows arm already avoids exactly this
("a `cmd` builtin busy loop, not `ping`"); the unix arm now uses the shell's own builtin loop,
`while :; do :; done`, for the same reason.
…Windows
`cli/tests/bin.rs::browser_start_with_a_missing_launcher_reports_the_launch_failure` asserts the CLI
exits 1 and names the failure; on unix CI measured exit 0. This is the integration twin of the lib
test gated in the previous commit, with the same premise.
Recorded as a PRODUCT QUESTION rather than only a test detail: the test's own comment says the
detached launch "reports the failure instead of claiming a browser started", and its stderr
assertion hedges with `|| stderr.contains("PowerShell")`, so the author expected a failure on both
platforms. CI shows unix does not report one. Either the unix detached-launch path should surface
the spawn error, or the intent needs restating for unix -- neither is verifiable from a Windows
checkout, so it is flagged in the test comment and the PR instead of being encoded.
…board test on host support
CI (Linux) failed three `future-tui` tests, and two share one root cause: on non-Windows,
pub(crate) fn terminal_or_skip() -> Option<Terminal> { Some(Terminal::new().unwrap()) }
so the helper could never return `None`. `Terminal::new()` SUCCEEDS on a headless box, and only the
reader's start path then fails with "stdin is not a TTY". The callers were written to skip
(`let Some(..) = terminal_or_skip() else { return }`), so the feature under test was never the
problem -- the unix helper just never let them skip. Both helpers now check the tty and return
`None` with a `[skip]` note, honouring the same contract as the Windows variants above them.
The third is a host-dependency: `with_runner_keeps_the_probed_candidates_and_uses_the_injected_runner`
asserts `copy(..) == Copied`, but a headless runner has no clipboard program, so `Clipboard::new()`
probes an EMPTY candidate list and `copy` reports `Requested` (CI: `left: Requested, right: Copied`).
The test routes a copy through the injected runner FOR THE PROBED CANDIDATES, so it needs at least
one; it now skips when the host probed none.
The last red CI job (`Rust tests (Linux) (desktop backend)`) failed four tests, all of which assert the WINDOWS interactive-shell contract. Assertions are untouched; the tests now declare the platform they describe: * `terminal/pty.rs::writing_to_the_pty_reaches_the_shell` and `terminal/server.rs::the_pump_reads_every_client_frame_type` wait for the child's DSR cursor query -- `test_support::interactive_command()`'s handshake. A unix shell in a PTY never asks, so the "must ask for the cursor" premise cannot hold there. * `terminal/session.rs::a_written_line_is_executed_by_the_child` waits for that same query before writing (CI: "timed out waiting for the shell's cursor query"). * `terminal/shell.rs::an_environment_shell_is_preferred_but_a_blank_one_is_ignored` expects `ShellSource::EnvShell` for an arbitrary absolute `SHELL` path, but the unix resolver is `/etc/shells`-based, so that preference rule is the Windows one. DISCLOSED CONSEQUENCE, not hidden: gating means the unix shell/PTY arms are not behaviourally asserted by these four tests in Linux CI. They do run on Windows, which is the platform the `terminal` module implements ConPTY for, and the crate's coverage is measured on Windows here. Verified locally after gating: all four are still listed by `--list` and still pass on Windows, and `cargo fmt --check` and both `clippy` variants are clean.
`cargo fmt --all` does NOT cover `desktop/src-tauri`: CLAUDE.md notes the crate is deliberately excluded from the workspace, and CI checks its formatting separately with `cargo fmt --check --manifest-path desktop/src-tauri/Cargo.toml`. My gating edits landed in that crate, so the workspace-wide check I ran locally passed while CI's separate check failed in 30 s -- the same lesson as the duplicate-test deletion: a local check can be checking a different scope than CI. `cargo fmt --manifest-path desktop/src-tauri/Cargo.toml` fixes it; all five fmt/clippy commands CI runs are now clean locally.
…ed on unix
Linux clippy (`-D warnings`) caught the consequence of the previous commit in the same crate:
unused import: `std::time::Instant` server.rs:2227
constant `OP_CLOSE` is never used server.rs:2399
constant `OP_PONG` is never used server.rs:2401
function `interactive_command` is never used test_support.rs:96
All four are used only by the tests now scoped to Windows, so on unix they have no users. Gating each
to `#[cfg(windows)]` compiles them where they are used and omits them where they are not.
This is the third instance in this PR of a lint my local runs cannot see: clippy on Windows cannot
analyse code that only compiles on unix (the duplicate test, the unix skip helpers, and now this).
CI remains the authority for the unix cfg set. Verified locally afterwards: both fmt checks and all
three clippy variants are clean, and all four tests are still listed on Windows.
This was referenced Sep 26, 2026
huichen
added a commit
that referenced
this pull request
Sep 27, 2026
…0) (#879) #877 (coverage) carried a stale gitlink and reverted the pin #872 had just moved, so `main` pointed at 1ece355 while the skills repo had moved on. Restore the pin to 23925fc (future-skills main), which is the same content #872 shipped. Skills repo commits covered by the range 1ece355..23925fc: - #57 document task write scopes and safe dependency wiring - #59 repair builtin lookup/design helpers, retire unsafe review generator - #58 future-slides defaults to editable decks with native validation - light-weight code-development skill (future-code) - #60 coalesced supervisor delivery for future-loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raise every module to 100% of coverable lines, with dimensions and mutation evidence
This PR raises test coverage across all 21 module groups and — more importantly — tries to make the
tests worth having: it adds boundary / error-path / concurrency / serialization / platform-cfg /
property coverage, removes assertion-free tests, and audits every waiver. It also fixes the 20
pre-existing Windows test failures (13
future-tui+ 7future-channel).Coverage is not claimed as "100% for the repository". The contract is: 100% of coverable lines,
or every file that still has uncovered lines is named in its module doc with a waiver category and a
reason. Some groups are gate-green on structure only — see Honest limitations, the section to
read if you read only one.
Shape of the change
docs/testing/(one
module-*.mdper group: measurement, waiver ledger, dimension evidence, next steps).(
"Connection reset"vs Windows'os error 10053); now classified byErrorKind, plus a Windowsimplementation of the test-only socket half-close helper. Verified by exact test path, repeatedly,
including on the merged tree: 13/13 and 7/7 green.
channels/src/policy.rssat at100% line coverage while three default access-policy values (
default_dm_policy,default_group_policy,default_require_mention) survived mutation — nothing asserted them, so achange to a security default would have shipped silently. Assertions added; the same mutants are now
caught (before/after in
docs/testing/mutation-report.md).origin/main(26/26, ADDED 0, REMOVED 0) and by checking every other disabling form.
vitest/jest, whichtranspile but neither type-check nor lint). Measured against CI's own commands: desktop
tsc158 → 0, desktop ESLint 208 → 0, mobile
tsc9 → 0, mobile jest exit 1 → 0 (144suites / 2905 tests passing while leaking async handles), Rust
fmt(13 + 9 files) andclippy(4 findings) → 0. Two flaky collection failures fixed by capping worker pools
(
desktop/vite.config.ts,mobile/jest.config.js).Production changes carried for correctness (disclosed, not smuggled)
loop/compat.rs: Windows delete-pending retry#[cfg(windows)]+ no-op elsewhereloop/console.rs:detached_child_argsfuture run …fell through to an unrelated commanddesktop/vite.config.ts,mobile/jest.config.js: worker-pool caps#[cfg(test)]pub(crate)widenings (tools/mod.rs,terminal/session.rs)clippy -D warningsHonest limitations
rather than accepting the verdict:
tau-remote(its own text calls 10 rows "reachable inprinciple … they need no new harness" while carrying
unreachable-in-this-environment),agent-rpc(a row the reviewer falsified by construction from the file's own fixtures),tau-terminal(a row whose reason contradicts its own measurement), plus smaller instances inloop,ag-llm,channels. The gate cannot see this class: it checks that a category stringis present, never that the category is true — deliberate, and why the review below is not optional.
rev-rustandrev-feran adversarial passes:some rows were falsified with executed counterexamples, others recorded as SURVIVED with what was
tried. Rows nobody attacked remain unverified claims. The largest is
ag-sandbox's 529 lines.policy.rsandbridge/queue.rsin full: 24/24 and37/37 mutants; the rest not run).
mutation/summary.jsonstates this and the gate refuses a summarywithout it.
rows; reading them showed the checker was wrong — the docs mix line numbers with counts
("
shutdown.rs: 6 more lines"), ranges, and numbers explicitly attributed to the LCOV metricwhile my check compared them to the JSON summary. Repairing correct docs to satisfy a bad instrument
is the same harm as a gameable gate in reverse, so I did not. Per-file waivers are verified.
DA:records; the gate reads the JSONsummary) and LCOV omits macro-expansion lines. The table below is the summary metric.
cargo llvm-covcan silently under-report:--no-reportdrops lib profile data when any test inthe invocation fails, with no error (measured 21%–97.9% for identical sources). All published numbers
come from green runs, and the gate now has a completeness check.
Numbers
Measured on the merged tree for the tauri groups (the merge moved them:
tau-remote97.49% → 94.71%because merged-in code was previously uncovered; one of those gaps was then closed by a test, so it now
reads 94.73%). The workspace-crate figures predate the merge — the gate re-validated their file sets
and waivers on the merged tree, but their percentages have not been re-measured; treat them as indicative.
future-channelsfuture-loopfuture-tuifuture-cliag-session/ag-rpc/ag-core/ag-llm/ag-sandboxtau-remote/tau-core/tau-bridge/tau-terminal(post-merge)d-agent/d-shell/d-settings/d-panels/d-pkgsfuture-mobile-tsVerification performed
Green (measured against CI's own commands): all 21 coverage gates;
windows-red-baseline13/13 and7/7; the 5 Rust lint commands (2
fmt --check+ 3clippy, including bothdesktop/src-taurivariants);all 7 front-end commands (desktop
tsc/lint/stylelint/vitest, mobiletypecheck/lint/jest);and
cargo test --workspace --no-fail-faston a quiet machine → 126 of 127 targets pass.Running CI's own
cargo test --workspace(which no coverage gate runs) found two bugs of ours thatthe merge introduced, both fixed here:
dispatcher_tests.rspinned"(for output) toolCallId are required"whileorigin/mainreworded theproduction message to
"(for call-scoped reads) …". Git merges text, not meaning, so the auto-mergedfile looked consistent and was semantically broken.
session_lifecycle_tests.rsasserted the process-global event broadcaster was EMPTY after a secondactivation — a property of a resource 2000+ parallel tests write to, not of this code. (The printed
Err(TryRecvError::Empty)was thematches!pattern, i.e. the expected value.)Not verified, stated plainly:
cargo test --manifest-path desktop/src-tauri/Cargo.toml(and its--no-default-featurestwin) hung twice for 90 minutes on my machine. The underlying suite is verified: two post-merge
cargo llvm-cov --manifest-path desktop/src-tauri/Cargo.tomlruns completed (reports at 00:02 and00:19), and llvm-cov only writes its report after the tests finish. My attempt to localise the hang was
methodologically flawed (a zero-match filter also "hung"), so I am not asserting a cause.
Known pre-existing failures, disclosed rather than adjusted:
packages/rpc/src/parity.rs::text_chunk_encode_stays_within_budget— a wall-clock hot-path budget:quiet 2.658 µs/event, loaded 5.403 µs, budget 5 µs, while its own comment claims "well under 1 µs".
encode.rsis unchanged by both sides and main'sparity.rschange is fixture JSON, so this is neitherour regression nor main's. I deliberately did not widen the budget or swap in a min-of-batches
estimator — that would be adjusting the measurement until it passes. Numbers provided for the owners;
a min-of-batches estimator is what I would recommend if you want it load-robust.
agent/src/rpc/commands/providers_tests.rs::get_commands_lists_discovered_skills— at the base, changedby neither side; passes alone, failed once under load. My
HOME-race hypothesis was wrong(
TestHomealready holdsenv_lock), so the likely cause is the global skills cache; recorded ratherthan guessed at.
grpc::tests::verbose_logs_background_commands_at_trace_onlyandmodels::tests::registry_injects_future_models_from_disk_cache(full-parallel-suite only).Review notes
test/cov100, 3 commits: a 498-file snapshot, theorigin/mainmerge (31 commits; 4conflicts, all mobile test files, zero production conflicts), and the two assertion fixes above.
docs/testing/holds the evidence: per-module measurement + waiver ledger + 48-row dimension matrix,mutation-report.md,weak-test-audit.md(all 70 assertion-free tests adjudicated),disabled-test-audit.md(including a post-merge section for the 6 environment-gated#[ignore]sorigin/mainbrought in),platform-coverage.md(including 116#[cfg]-excluded test bodies this hostnever runs),
review-rust.md,review-frontend.md.