Mirror of the CAD engine harness for the doc crate, minus the shim gymnastics (doc-engine depends only on serde/serde_json, so it instruments directly): an isolated toolchain + cargo + target dir under one mktemp directory, removed by a shell trap on every exit path; nothing enters the host, the workspace target/, or $HOME. Runs the unit tests plus tests/materialize.rs under -C instrument-coverage, enforces a 96% total-lines floor against a 99.00% baseline plus per-file floors (losing one module's tests must not hide in the total), and with KEEP_COVERAGE=1 writes the uncovered-line listing that makes adding branch tests directed rather than guesswork. COVERAGE.md records the baseline, the exclusions, and the arms that are deliberately left uncovered (defensive CRDT merge arms, one unreachable!, and the Compensation::inverse arms unreachable through the public API).
2.5 KiB
doc-engine coverage baseline
Measured by tools/test-doc-engine-coverage.sh, which runs the crate's
unit tests plus tests/materialize.rs under -C instrument-coverage in
a fully isolated, self-deleting environment (own toolchain, own cargo
home, everything under one mktemp directory removed by a shell trap).
Baseline (2026-08-17, toolchain 1.97.1, llvm-cov lines percent):
| File | Lines | Regions | Notes |
|---|---|---|---|
src/controller.rs |
98.68% | 93.45% | remaining lines are defensive: batch-compensation arms that only fire on mid-batch op-application failure |
src/crdt/document.rs |
97.63% | 95.13% | remaining arms are split-replay RGA link guards and CRDT-tolerance skips (ops whose anchors never arrive) |
src/crdt/operations.rs |
100% | 100% | |
src/crdt/version_vector.rs |
100% | 100% | |
src/history.rs |
92.00% | 88.34% | the honest floor: Compensation::inverse arms unreachable through the public controller API (undo/redo expand groups before materializing) plus one unreachable! |
src/projection/text.rs |
100% | 94.19% | |
| TOTAL | 99.00% | 97.54% |
src/lib.rs, src/session.rs, src/crdt/mod.rs and src/projection/mod.rs
carry no executable lines (module roots and re-exports), so the report
never lists them and the floor table deliberately has no entries for
them — a floor on an unmeasured file fails the run loudly, by design.
What is NOT measured, and why
- Widget-level consumers. This crate is UI-free by construction
(serde + serde_json only); the
CrdtDocEditorsurface in nigig-build is exercised by its own 800+-test lib suite, not here. Reading 99% as "the doc feature is 99% tested" would be wrong in exactly the way the CAD baseline warns about: it is the engine that is. - Defensive CRDT arms. A handful of match arms exist so that ops arriving before their anchors (or after duplicate ids) degrade silently instead of corrupting order. Some are constructible only by forging op ids below the controller API; they are reported as uncovered rather than hidden.
Floors
Total 96% lines; per-file floors a couple of points under the table
above, enforced by the script and the coverage job in
.forgejo/workflows/doc-engine.yml. Lowering a floor is a reviewable
edit to the script, not something to do quietly.
Regenerating
./tools/test-doc-engine-coverage.sh # gated run
KEEP_COVERAGE=1 ./tools/test-doc-engine-coverage.sh # keeps the env and writes
# an uncovered-line listing