-
-
Notifications
You must be signed in to change notification settings - Fork 3
coverage
github-actions[bot] edited this page Oct 3, 2026
·
5 revisions
Status: shipped.
Unit-test coverage gate for Rust and TypeScript.
- The
coveragejob in.github/workflows/ci.ymlruns on ubuntu-24.04 only. - Rust lines (stable toolchain):
cargo llvm-cov --workspace --all-targets --summary-only --fail-under-lines <N>. The gate is on the run itself, becausecargo llvm-cov reporthas no--workspaceand would gate the root crate only. Every file of both crates counts. There are no exclusions. - Rust branches (pinned nightly, named in
scripts/nightly-toolchain.txt): the same tests with--branch --json. cargo-llvm-cov has no--fail-under-branches, sojqprintstotals.branches.percentand fails below the floor. - TypeScript:
npm run test:coveragefirst runsscripts/check-tested.sh, the traceability check. Then it runs the Node built-in test runner with coverage thresholds. It adds no npm package. - Traceability: every numbered requirement under "Requirements" in Browser UI, and every IPC contract section the UI depends on, must be named by at least one test title. The script fails when a requirement has no test.
- Tag a test title with
[browser-ui N]for requirement N on the Browser UI page. - Tag it with
[ipc-contract <anchor>]for an IPC contract section:navigation-active-tab,window-layout,window,history-1(History under Commands),events,keyboard-shortcuts. The list isIPC_SECTIONSin the script. - A test file no longer has to sit beside each module. That rule locked in the code layout.
- Tag a test title with
- The job is not a required check yet. The owner adds it to the ruleset after it passes on main.
- Rust lines: 93. The stable run on ubuntu-24.04 measured 93.96% after #29.
- Rust branches: 82. The nightly run on ubuntu-24.04 measured 82.23% after #29.
- Each floor is the measured value of its own run, rounded down. Raise it when coverage rises. Never lower it.
- TypeScript: lines 80, branches 70, functions 80. #49 removed the tests that lock in the implementation. Coverage is below the floor until the requirement tests land in that PR.
- Rust:
cargo install cargo-llvm-cov --locked,rustup component add llvm-tools-preview, then insrc-tauri:- lines:
cargo llvm-cov --workspace --all-targets --summary-only - branches:
rustup toolchain install "$(cat scripts/nightly-toolchain.txt)" --component llvm-tools-preview, thencargo "+$(cat scripts/nightly-toolchain.txt)" llvm-cov --workspace --all-targets --branch --summary-only - Run
npm run buildfirst. CI measures on Linux; macOS and Windows compile other platform code, so their numbers differ.
- lines:
- TypeScript:
npm run testandnpm run test:coverage. Node 22.18 or later is needed.
- A test checks a requirement, not the code. The requirement must be written in
docs/wiki/or in an issue. ADR 0001 and the IPC contract land indocs/wiki/with the browser shell PR (#29). - A test uses the public interface: an exported function whose output the requirement defines, an IPC command, an event or the UI.
- A test does not copy a constant from the code, check private state, snapshot today's output, repeat the algorithm, or exist only for coverage. Such tests are removed.
- The person who writes a requirement test does not read the code under test.
- The architecture test (lands with #29) and the leak test (lands with #41) enforce ADR 0001. They stay.
- The Rust gate checks lines and branches, not functions or regions.
- Branch coverage needs a nightly compiler, so the branch number comes from one dated nightly. A nightly bump can move it a little.
- The job builds and runs the instrumented tests twice: on stable for lines, on the nightly for branches. The line gate stays on the toolchain that ships the app. The cost is a few minutes of CI.
- Test files are excluded from the TypeScript report only.
- Node counts only the files that a test loads. A module that no requirement test reaches does not count against the floor. Such a module is dead code: inline it or delete it.
Generated from docs/wiki in the repository. Edit there, not here.