requirements.test-coverage.check.threshold
Requirements index · View definition
Requirement
Each first-party Rust file under
MUST have at least 80% execution coverage of its instrumented lines, or current accepted exception evidence explaining why the file falls below that target under
. Counts MUST use the file-and-line union rule of
; a line counts as executed when any eligible test process or its associated child processes has a positive execution count for it.
The check MUST use the combined selection and freshness rules of
and
, restricted to the active build configuration. It MUST compare exact counts rather than rounded displayed percentages, average file percentages, or impose an 80% target within each function. A file whose executable code is not measured MUST require exception evidence rather than pass with a fabricated percentage. A file established to contain no executable coverage obligations MUST be reported as such and MUST NOT require a threshold exception. Absence of recorded instrumented lines alone MUST NOT establish that a file contains no executable coverage obligations.
Rationale
The reviewed tests in src/execution_coverage/check.rs cover each obligation of requirements.test-coverage.check.threshold, and each test carries a {test} reference to it.
80% per-file threshold, with exact counts
mod[tests]/fn[exact_per_file_threshold_and_partial_functions]callsthresholddirectly. 79_999/100_000 fails even though it displays as 80.0%. 80_000/100_000 passes. 0/0 fails.- The same test checks a report at exactly 4/5 (80.0%) and asserts it passes.
- A second file at 0/1 is asserted to fail with
driver.rs: 0/1 (0.0%) — FAIL, so another file’s higher percentage cannot rescue it. - A 7/10 file next to a 100% file fails. The test message says the 85% average cannot rescue
driver.rs. - Together these cover rounded percentages, averaging across files, and per-file evaluation.
No 80% target within each function
a_function_below_eighty_percent_needs_no_exception_when_its_file_passeshaspartlyat 1/3 and the file at 10/12. It asserts the report passes and shows no accepted exceptions.
Union rule, children and filtered runs
children_and_filtered_runs_contribute_to_the_same_unionsplits execution between a parent process and a child process. The union passes.- A later all-zero filtered run does not erase the earlier execution.
Selection, freshness and active build configuration
stale_missing_legacy_and_uncertain_history_cannot_use_older_successcovers these cases:- a record from another configuration is excluded;
- a newer record with a missing profile is reported as missing or unreadable;
- a legacy record without function attribution is reported;
- stale source is reported as stale;
- a corrupt run directory is reported as unable to establish latest-per-test.
- In
accepted_file_and_function_explanations_remain_separate_from_execution, an older record from a different configuration covers the line. The newest configuration,unmeasured-file, still reportscode.rs: not measured, so the older configuration’s counts do not contribute.
Unmeasured file needs an exception, with no fabricated percentage
unmeasured_executable_files_and_parse_failures_do_not_disappearassertscode.rs: not measured — FAILfor an executable file with no recorded lines.- The accepted-exception test asserts
not measured — accepted exceptionand that nocode.rs: 0/percentage appears. - A parse failure is reported as failing.
Files with no executable obligations
- The first scenario of
unmeasured_executable_files_and_parse_failures_do_not_disappearusesstruct S; trait T { fn declaration(); }. It asserts the report passes withno executable obligations — pass. default_trait_bodies_and_cfg_exclusions_are_obligations_but_declarations_are_notchecks that a default trait body and a cfg-excluded function are obligations and that a bare declaration is not. It also checksinventoryfor plain declarations, macro invocations and derive-only structs.
Absence of recorded lines alone does not establish “no obligations”
- The
fn missing() {}case with no recorded lines is reported asnot measured — FAIL, not as having no obligations. - The cfg-excluded function case also supports this.
Exception path
accepted_file_and_function_explanations_remain_separate_from_execution,missing_and_stale_explanations_fail_the_reportandfunction_explanations_never_transfer_to_other_functions_or_the_filecover accepted, missing, stale and false-determination exceptions, and{fixme}determinations.- They also check that a file exception does not waive functions and that a function exception does not transfer to other functions or the file.
No unresolved gap found.
Inputs
Tests
Input 7: outline src/execution_coverage/check.rs mod[tests]/fn[exact_per_file_threshold_and_partial_functions]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[exact_per_file_threshold_and_partial_functions] - Kind:
fn src/execution_coverage/check.rs:1130–1187
// {test}`requirements.test-coverage.check.threshold`
// {test}`requirements.test-coverage.check.report`
#[test]
fn exact_per_file_threshold_and_partial_functions() {
assert!(!threshold(79_999, 100_000)); // displays 80.0%, still fails
assert!(threshold(80_000, 100_000));
assert!(!threshold(0, 0));
let temp = fixture("fn a() {\n let x=1;\n let y=2;\n let z=3;\n}\n");
let root = temp.path();
record(
root,
"a",
1,
"same",
vec![process(root, &[(1, 1), (2, 1), (3, 1), (4, 0), (5, 1)], 1)],
);
let result = report(root);
assert!(result.passed, "{}", result.text);
assert!(result.text.contains("4/5 (80.0%) — pass"));
// Another file cannot be rescued by the first one's higher percentage.
fs::write(root.join("driver.rs"), "fn driver() {}").unwrap();
let mut p = process(root, &[(1, 1), (2, 1), (3, 1), (4, 1), (5, 1)], 1);
p.lines.insert("driver.rs".into(), BTreeMap::from([(1, 0)]));
p.functions.as_mut().unwrap().push(FunctionExecution {
file: "driver.rs".into(),
line: 1,
column: 1,
count: 0,
});
record(root, "a", 2, "same", vec![p]);
let result = report(root);
assert!(!result.passed);
assert!(result.text.contains("driver.rs: 0/1 (0.0%) — FAIL"));
assert!(result.text.contains("uncovered lines: 1"));
fs::write(root.join("driver.rs"), "fn driver() {\n let a=1;\n let b=2;\n let c=3;\n let d=4;\n let e=5;\n let f=6;\n let g=7;\n let h=8;\n}\n").unwrap();
let mut p = process(root, &[(1, 1), (2, 1), (3, 1), (4, 1), (5, 1)], 1);
p.lines.insert(
"driver.rs".into(),
(1..=10).map(|line| (line, u64::from(line <= 7))).collect(),
);
p.functions.as_mut().unwrap().push(FunctionExecution {
file: "driver.rs".into(),
line: 1,
column: 1,
count: 1,
});
record(root, "a", 3, "same", vec![p]);
let result = report(root);
assert!(
!result.passed,
"the 85% average of 100% and 70% cannot rescue driver.rs"
);
assert!(result.text.contains("driver.rs: 7/10 (70.0%) — FAIL"));
assert!(
!result.text.contains("#fn[driver]:"),
"the function did execute"
);
}
Input 8: outline src/execution_coverage/check.rs mod[tests]/fn[a_function_below_eighty_percent_needs_no_exception_when_its_file_passes]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[a_function_below_eighty_percent_needs_no_exception_when_its_file_passes] - Kind:
fn src/execution_coverage/check.rs:1189–1208
// {test}`requirements.test-coverage.check.threshold`
#[test]
fn a_function_below_eighty_percent_needs_no_exception_when_its_file_passes() {
let temp = fixture(
"fn partly() {\n let x=1;\n}\nfn fully() {\n let a=1;\n let b=2;\n let c=3;\n let d=4;\n let e=5;\n let f=6;\n let g=7;\n}\n",
);
let root = temp.path();
let lines = (1..=12)
.map(|line| (line, u64::from(line != 2 && line != 3)))
.collect::<Vec<_>>();
record(root, "a", 1, "same", vec![process(root, &lines, 1)]);
let result = report(root);
assert!(
result.passed,
"partly is at 1/3 while its file passes: {}",
result.text
);
assert!(result.text.contains("code.rs: 10/12 (83.3%) — pass"));
assert!(!result.text.contains("Accepted exceptions"));
}
Input 9: outline src/execution_coverage/check.rs mod[tests]/fn[children_and_filtered_runs_contribute_to_the_same_union]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[children_and_filtered_runs_contribute_to_the_same_union] - Kind:
fn src/execution_coverage/check.rs:1210–1232
// {test}`requirements.test-coverage.check.threshold`
// {test}`requirements.test-coverage.check.functions`
#[test]
fn children_and_filtered_runs_contribute_to_the_same_union() {
let temp = fixture("fn a() {\n let x=1;\n let y=2;\n let z=3;\n}\n");
let root = temp.path();
let first = process(root, &[(1, 1), (2, 1), (3, 0), (4, 0), (5, 1)], 0);
let mut child = process(root, &[(1, 0), (2, 0), (3, 1), (4, 1), (5, 0)], 1);
child.pid = 2;
record(root, "filtered-first", 1, "same", vec![first, child]);
assert!(report(root).passed);
record(
root,
"filtered-second",
2,
"same",
vec![process(root, &[(1, 0), (2, 0), (3, 0), (4, 0), (5, 0)], 0)],
);
assert!(
report(root).passed,
"a zero second test does not erase the first test's execution"
);
}
Input 10: outline src/execution_coverage/check.rs mod[tests]/fn[default_trait_bodies_and_cfg_exclusions_are_obligations_but_declarations_are_not]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[default_trait_bodies_and_cfg_exclusions_are_obligations_but_declarations_are_not] - Kind:
fn src/execution_coverage/check.rs:1262–1300
// {test}`requirements.test-coverage.check.scope`
// {test}`requirements.test-coverage.check.threshold`
// {test}`requirements.test-coverage.check.functions`
#[test]
fn default_trait_bodies_and_cfg_exclusions_are_obligations_but_declarations_are_not() {
let temp =
fixture("trait T { fn declaration(); fn body() {} }\n#[cfg(any())] fn excluded() {}\n");
let root = temp.path();
let mut p = process(root, &[(1, 1)], 0);
p.functions.as_mut().unwrap().retain(|f| f.line == 1);
record(root, "traits", 1, "same", vec![p]);
let result = report(root);
assert!(!result.passed);
assert!(result.text.contains("#fn[excluded]: not measured"));
assert!(
result.text.contains("#trait[T]/fn[body]: zero execution"),
"{}",
result.text
);
assert!(!result.text.contains("fn[declaration]"));
let parsed = crate::outline::parse_with(
&crate::outline::RUST_PROFILE,
"struct S;\ntrait T { fn declaration(); }\n",
)
.unwrap();
assert!(
inventory("struct S;\ntrait T { fn declaration(); }\n", &parsed)
.unwrap()
.1
);
let parsed =
crate::outline::parse_with(&crate::outline::RUST_PROFILE, "make_functions!();")
.unwrap();
assert!(!inventory("make_functions!();", &parsed).unwrap().1);
let parsed =
crate::outline::parse_with(&crate::outline::RUST_PROFILE, "#[derive(Clone)] struct S;")
.unwrap();
assert!(!inventory("#[derive(Clone)] struct S;", &parsed).unwrap().1);
}
Input 11: outline src/execution_coverage/check.rs mod[tests]/fn[stale_missing_legacy_and_uncertain_history_cannot_use_older_success]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[stale_missing_legacy_and_uncertain_history_cannot_use_older_success] - Kind:
fn src/execution_coverage/check.rs:1302–1337
// {test}`requirements.test-coverage.check.measurement`
// {test}`requirements.test-coverage.check.threshold`
#[test]
fn stale_missing_legacy_and_uncertain_history_cannot_use_older_success() {
let temp = fixture("fn a() {}");
let root = temp.path();
assert!(!report(root).passed);
record(root, "a", 1, "same", vec![process(root, &[(1, 1)], 1)]);
assert!(report(root).passed);
let mut old = process(root, &[(1, 1)], 1);
old.functions = None;
record(root, "old", 0, "other-config", vec![old]);
assert!(
report(root).passed,
"excluded legacy data cannot invalidate a supported active configuration"
);
let current = record(root, "a", 2, "same", vec![process(root, &[(1, 1)], 1)]);
fs::remove_file(current.join("profile.profraw")).unwrap();
assert!(report(root).text.contains("missing or unreadable"));
let mut legacy = process(root, &[(1, 1)], 1);
legacy.functions = None;
record(root, "a", 3, "same", vec![legacy]);
assert!(report(root).text.contains("lacks function attribution"));
record(root, "a", 4, "same", vec![process(root, &[(1, 1)], 1)]);
fs::write(root.join("code.rs"), "fn a() { let changed=1; }").unwrap();
assert!(report(root).text.contains("stale coverage"));
record(root, "a", 5, "same", vec![process(root, &[(1, 1)], 1)]);
assert!(report(root).passed);
fs::create_dir(root.join("target/habeas/coverage/corrupt")).unwrap();
fs::write(root.join("target/habeas/coverage/corrupt/run.json"), "{").unwrap();
assert!(
report(root)
.text
.contains("cannot establish latest-per-test")
);
}
Input 12: outline src/execution_coverage/check.rs mod[tests]/fn[accepted_file_and_function_explanations_remain_separate_from_execution]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[accepted_file_and_function_explanations_remain_separate_from_execution] - Kind:
fn src/execution_coverage/check.rs:1339–1419
// {test}`requirements.test-coverage.check.exceptions`
// {test}`requirements.test-coverage.check.exceptions.reviews`
// {test}`requirements.test-coverage.check.exceptions.binding`
// {test}`requirements.test-coverage.check.report`
// {test}`requirements.test-coverage.check.functions`
// {test}`requirements.test-coverage.check.measurement`
// {test}`requirements.test-coverage.check.threshold`
#[test]
fn accepted_file_and_function_explanations_remain_separate_from_execution() {
let temp = fixture(
"//! :::{cite} habeas:coverage\n//! Generated platform glue lacks a harness.\n//! :::\n\nfn a() {}\n",
);
let root = temp.path();
reviews(root, json!(true));
record(root, "a", 1, "same", vec![process(root, &[(5, 0)], 0)]);
let result = report(root);
assert!(!result.passed, "file exception cannot waive its function");
assert!(
result
.text
.contains("code.rs: 0/1 (0.0%) — accepted exception")
);
assert!(result.text.contains("#fn[a]: zero execution"));
fs::write(root.join("code.rs"),"//! :::{cite} habeas:coverage\n//! File rationale.\n//! :::\n\n// :::{cite} habeas:coverage\n// Function rationale, describing only a Linux condition.\n// :::\nfn a() {}\n").unwrap();
reviews(root, json!(true));
record(root, "a", 2, "linux", vec![process(root, &[(8, 0)], 0)]);
let result = report(root);
assert!(result.passed, "{}", result.text);
assert!(result.text.contains("0/1 (0.0%)"));
let exceptions = result
.text
.split_once("\nAccepted exceptions (do not increase execution coverage):\n")
.unwrap()
.1;
assert!(exceptions.contains("- code.rs: file threshold (0/1 (0.0%))"));
assert!(exceptions.contains("- code.rs#fn[a]: zero execution"));
let mut absent = process(root, &[(8, 0)], 0);
absent.functions = Some(vec![]);
record(root, "a", 3, "windows", vec![absent]);
let result = report(root);
assert!(
result.passed,
"same accepted citation covers unmeasured functions without conditional matching"
);
let exceptions = result
.text
.split_once("\nAccepted exceptions (do not increase execution coverage):\n")
.unwrap()
.1;
assert!(exceptions.contains("- code.rs#fn[a]: not measured"));
record(root, "a", 4, "covered", vec![process(root, &[(8, 1)], 1)]);
assert!(
report(root).passed,
"citation may remain when no exception is needed"
);
fs::write(root.join("driver.rs"), "fn driver() {}").unwrap();
let mut p = process(root, &[], 0);
p.lines.insert("driver.rs".into(), BTreeMap::from([(1, 1)]));
p.functions.as_mut().unwrap().push(FunctionExecution {
file: "driver.rs".into(),
line: 1,
column: 1,
count: 1,
});
record(root, "a", 5, "unmeasured-file", vec![p]);
let result = report(root);
assert!(result.passed, "{}", result.text);
assert!(
result
.text
.contains("code.rs: not measured — accepted exception"),
"{}",
result.text
);
assert!(!result.text.contains("code.rs: 0/"), "{}", result.text);
reviews(root, json!(false));
assert!(!report(root).passed);
assert!(report(root).text.contains("determination is false"));
reviews(root, json!({"FIXME":["acknowledgment"]}));
assert!(report(root).text.contains("cannot accept a {fixme}"));
}
Input 13: outline src/execution_coverage/check.rs mod[tests]/fn[unmeasured_executable_files_and_parse_failures_do_not_disappear]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[unmeasured_executable_files_and_parse_failures_do_not_disappear] - Kind:
fn src/execution_coverage/check.rs:1484–1538
// {test}`requirements.test-coverage.check.measurement`
// {test}`requirements.test-coverage.check.scope`
// {test}`requirements.test-coverage.check.threshold`
// {test}`requirements.test-coverage.check.report`
// {test}`requirements.test-coverage.check.functions`
#[test]
fn unmeasured_executable_files_and_parse_failures_do_not_disappear() {
let temp = fixture("struct S; trait T { fn declaration(); }");
let root = temp.path();
fs::write(root.join("driver.rs"), "fn driver() {}").unwrap();
let mut p = process(root, &[], 1);
p.lines.insert("driver.rs".into(), BTreeMap::from([(1, 1)]));
p.functions.as_mut().unwrap().push(FunctionExecution {
file: "driver.rs".into(),
line: 1,
column: 1,
count: 1,
});
record(root, "driver", 1, "same", vec![p]);
let result = report(root);
assert!(result.passed, "{}", result.text);
assert!(
result
.text
.contains("code.rs: no executable obligations — pass"),
"{}",
result.text
);
fs::write(root.join("code.rs"), "fn missing() {}").unwrap();
let mut p = process(root, &[], 1);
p.functions = Some(vec![]);
p.lines.insert("driver.rs".into(), BTreeMap::from([(1, 1)]));
p.functions.as_mut().unwrap().push(FunctionExecution {
file: "driver.rs".into(),
line: 1,
column: 1,
count: 1,
});
record(root, "driver", 2, "same", vec![p.clone()]);
let result = report(root);
assert!(result.text.contains("code.rs: not measured — FAIL"));
assert!(result.text.contains("#fn[missing]: not measured"));
fs::write(root.join("code.rs"), "fn malformed(").unwrap();
record(root, "driver", 3, "same", vec![p]);
let result = report(root);
assert!(!result.passed);
assert!(
result
.text
.to_lowercase()
.contains("cannot parse rust source"),
"{}",
result.text
);
}
Input 14: outline src/execution_coverage/check.rs mod[tests]/fn[missing_and_stale_explanations_fail_the_report]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[missing_and_stale_explanations_fail_the_report] - Kind:
fn src/execution_coverage/check.rs:1558–1613
// {test}`requirements.test-coverage.check.exceptions`
// {test}`requirements.test-coverage.check.exceptions.reviews`
// {test}`requirements.test-coverage.check.report`
// {test}`requirements.test-coverage.check.threshold`
#[test]
fn missing_and_stale_explanations_fail_the_report() {
let source = "//! :::{cite} habeas:coverage\n//! File rationale.\n//! :::\n// :::{cite} habeas:coverage\n// Function rationale.\n// :::\nfn a() {}\n";
let temp = fixture(source);
let root = temp.path();
record(root, "a", 1, "same", vec![process(root, &[(7, 0)], 0)]);
let result = report(root);
assert!(!result.passed);
assert!(
result
.text
.contains("missing citation review; run `habeas author"),
"{}",
result.text
);
reviews(root, json!(true));
assert!(report(root).passed);
fs::write(
root.join("code.rs"),
source.replace("Function rationale", "Changed rationale"),
)
.unwrap();
record(root, "a", 2, "same", vec![process(root, &[(7, 0)], 0)]);
let result = report(root);
assert!(!result.passed);
assert!(result.text.contains("citations changed"), "{}", result.text);
assert!(
result.text.contains("#fn[a]: zero execution"),
"{}",
result.text
);
fs::write(root.join("code.rs"), source).unwrap();
reviews(root, json!(true));
fs::write(
root.join("code.rs"),
source.replace("fn a() {}", "fn a() { let changed = 1; }"),
)
.unwrap();
record(root, "a", 3, "same", vec![process(root, &[(7, 0)], 0)]);
let result = report(root);
assert!(!result.passed);
assert!(
result.text.contains("outline input changed"),
"{}",
result.text
);
assert!(
result.text.contains("code.rs:7 #fn[a]: zero execution"),
"{}",
result.text
);
}
Input 15: outline src/execution_coverage/check.rs mod[tests]/fn[function_explanations_never_transfer_to_other_functions_or_the_file]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[function_explanations_never_transfer_to_other_functions_or_the_file] - Kind:
fn src/execution_coverage/check.rs:1615–1674
// {test}`requirements.test-coverage.check.exceptions`
// {test}`requirements.test-coverage.check.exceptions.reviews`
// {test}`requirements.test-coverage.check.threshold`
#[test]
fn function_explanations_never_transfer_to_other_functions_or_the_file() {
for (source, waived, remaining) in [
(
"// :::{cite} habeas:coverage\n// Outer reason.\n// :::\nfn outer() {\n fn inner() {}\n}\nfn sibling() {}\n",
"fn[outer]",
["fn[outer]/fn[inner]", "fn[sibling]"],
),
(
"fn outer() {\n // :::{cite} habeas:coverage\n // Inner reason.\n // :::\n fn inner() {}\n}\nfn sibling() {}\n",
"fn[outer]/fn[inner]",
["fn[outer]", "fn[sibling]"],
),
] {
let temp = fixture(source);
let root = temp.path();
reviews(root, json!(true));
record(root, "a", 1, "same", vec![process(root, &[(1, 1)], 0)]);
let result = report(root);
assert!(!result.passed);
assert!(
result
.text
.contains(&format!("- code.rs#{waived}: zero execution")),
"{}",
result.text
);
for selector in remaining {
assert!(
result
.text
.contains(&format!("#{selector}: zero execution; requires")),
"{}",
result.text
);
}
assert!(
!result
.text
.contains(&format!("#{waived}: zero execution; requires")),
"{}",
result.text
);
record(root, "a", 2, "same", vec![process(root, &[(1, 0)], 0)]);
let result = report(root);
assert!(
result.text.contains("code.rs: 0/1 (0.0%) — FAIL"),
"{}",
result.text
);
fs::write(root.join("driver.rs"), "fn other_file() {}").unwrap();
record(root, "a", 3, "same", vec![process(root, &[(1, 1)], 0)]);
let result = report(root);
assert!(result.text.contains("driver.rs: not measured — FAIL"));
assert!(result.text.contains("#fn[other_file]: not measured"));
}
}
Referenced definitions
Input 2: requirements selection requirements.references.rust_item_coverage
requirements.references.rust_item_coverage:md/requirements/references.md:224–226
:::{req} rust_item_coverage
During repository validation, Habeas MUST parse every first-party Rust source file: every `.rs` file among the sources reference discovery considers under {cite}`requirements.references.discovery`, except those under the project-root `vendor` directory. Each explicitly declared function or method, including trait methods and test helpers, and each struct, enum, and union is an item that can be covered. An item is covered when it has a valid `{impl}`, `{cite}`, or `{test}` reference to a defined requirement or named example, or a valid citation of the built-in `habeas:util` under {cite}`requirements.references.util`, in a Rust comment attached to it or within its body; or when its outline node, or an outline node containing it, is recorded with its current hash as an outline input of an evidence record, a citation review, or a site review. Outline inputs recorded from selected search snippets under {cite}`requirements.authoring.finish_search.inputs` MUST count alongside mandatory inputs and additional reads. Comments belong to items under {cite}`requirements.references.outline_comments`; a comment before a field, variant, or attribute inside an item belongs to that item. A named example MUST reference a requirement under {cite}`requirements.examples.definition`. A reference in a string literal, on an enclosing module or impl block, or only in an evidence input MUST NOT count for the items it encloses. Habeas MUST report a Rust parse failure instead of silently skipping the file. Only {cite}`requirements.references.coverage.tests` and {cite}`requirements.references.coverage.examples` make an uncovered item a validation error; other items without recent coverage are warned about under {cite}`requirements.references.coverage.report`.
:::
Input 3: requirements selection requirements.test-coverage.check.exceptions
requirements.test-coverage.check.exceptions:md/requirements/test-coverage.md:635–651
:::{req} check.exceptions
An unmet file threshold or an unexecuted or not-measured function MAY satisfy
the coverage policy only
through current, accepted, independently assessed evidence explaining why its
coverage is incomplete. An exception MUST be attached to the source file or
function whose incomplete coverage it justifies. A file-threshold exception
MUST NOT automatically excuse untested functions.
An exception MUST NOT excuse another source item's incomplete coverage.
Changes to the source item, justification, or other inputs
of its citation review MUST invalidate the affected exception under
{cite}`requirements.references.citation_review`.
A source comment or unassessed justification alone MUST NOT count as accepted
exception evidence. Function and gap identities MUST remain portable between
equivalent local and CI checkouts rather than depend on checkout paths,
run identifiers, timestamps, or process identifiers.
:::
Input 4: requirements selection requirements.test-coverage.index.summary
requirements.test-coverage.index.summary:md/requirements/test-coverage.md:206–225
:::{req} index.summary
The coverage index MUST display the combined view selected under
{cite}`requirements.test-coverage.index.selection` and
{cite}`requirements.test-coverage.index.freshness`. It MUST show the number of
selected test attempts and summarize coverage excluded because it is stale,
unavailable, or from a historical build configuration. Detailed test identities,
run provenance, and per-test execution data MUST remain in the saved coverage
artifacts rather than being included in the generated book.
For first-party Rust files under
{cite}`requirements.references.rust_item_coverage`, the summary MUST compute
line coverage from the union of instrumented file-and-line locations in the
selected fresh records, including their associated child-process records.
Each location MUST count once in the denominator and count as covered when any
selected record has a positive execution count for it. Percentages MUST be
computed from those union counts rather than averaged across process reports.
A view with no instrumented lines MUST show coverage as unavailable. The index
MUST visibly identify incomplete coverage and MUST NOT imply that every current
test has coverage merely because all available records are valid.
:::
Input 5: requirements selection requirements.test-coverage.index.selection
requirements.test-coverage.index.selection:md/requirements/test-coverage.md:178–194
:::{req} index.selection
The coverage index MUST combine the most recent recorded test attempt for each
nextest binary and test name among the retained runs. "Most recent" MUST refer
to when the attempt started, including failed or interrupted attempts. A newer
filtered run MUST update only the tests it executes, leaving other compatible
test records available to the combined view. A newer attempt with missing or
unreadable coverage MUST be shown as unavailable rather than replaced with an
older successful attempt. Results from incompatible instrumented build
configurations MUST NOT be combined under
{cite}`requirements.test-coverage.storage.configuration`.
The main combined view MUST use the instrumented build configuration of the
most recently started recorded test attempt. Latest-per-test selection MUST
occur within that configuration. Records from other configurations MUST be
identified as excluded historical coverage. Configuration selection MUST use
recorded metadata without building or executing tests.
:::
Input 6: requirements selection requirements.test-coverage.index.freshness
requirements.test-coverage.index.freshness:md/requirements/test-coverage.md:196–204
:::{req} index.freshness
Only records whose captured source inputs match the current project source and
whose build configurations are compatible MAY contribute execution counts to
the combined view of {cite}`requirements.test-coverage.index.selection`.
Records invalidated by a source change, or whose compatibility cannot be
established, MUST be identified as stale or unavailable and excluded from the
combined coverage totals. Their per-process reports and matching captured source
MUST remain retained in the build artifacts until those artifacts are removed.
:::
Other sources
Input 1: requirements selection requirements.test-coverage.check.threshold
requirements.test-coverage.check.threshold:md/requirements/test-coverage.md:582–603
:::{req} check.threshold
Each first-party Rust file under
{cite}`requirements.references.rust_item_coverage` MUST have at least 80%
execution coverage of its instrumented lines, or current accepted exception
evidence explaining why the file falls below that target under
{cite}`requirements.test-coverage.check.exceptions`. Counts MUST use the
file-and-line union rule of {cite}`requirements.test-coverage.index.summary`;
a line counts as executed when any eligible test process or its associated
child processes has a positive execution count for it.
The check MUST use the combined selection and freshness rules of
{cite}`requirements.test-coverage.index.selection` and
{cite}`requirements.test-coverage.index.freshness`, restricted to the active
build configuration. It MUST compare exact counts rather than rounded displayed
percentages, average file percentages, or impose an 80% target within each
function. A file whose executable code is not measured MUST require exception
evidence rather than pass with a fabricated percentage. A file established to
contain no executable coverage obligations MUST be reported as such and MUST
NOT require a threshold exception.
Absence of recorded instrumented lines alone MUST NOT establish that a file
contains no executable coverage obligations.
:::