requirements.test-coverage.check.report
Requirements index · View definition
Requirement
The coverage check MUST show each file’s measured coverage and threshold result, identify each unsatisfied function by source file and function, list uncovered locations or absence of measurement, and explain missing, stale, or rejected exception evidence. It MUST report accepted exceptions separately from executed coverage; accepting an exception MUST NOT increase any displayed execution-coverage percentage.
Rationale
The tests marked for requirements.test-coverage.check.report in src/execution_coverage/check.rs cover each obligation in the text. I did not read implementation source, because the supplied test text was enough to judge adequacy.
- Per-file coverage and threshold result.
exact_per_file_threshold_and_partial_functionsasserts a passing file line with its covered/total fraction and percentage. It also asserts failing lines for a second file at zero percent and at seventy percent, and that another file’s higher percentage cannot rescue a failing file.unmeasured_executable_files_and_parse_failures_do_not_disappearasserts the “no executable obligations — pass” line.readable_failed_execution_can_contribute_but_outcomes_remain_visibleasserts that the output containsattempt failed.
- Unsatisfied functions identified by file and function.
uncovered_ranges_and_function_locations_are_reportedasserts a<file>:<line> #fn[a]: zero execution; requiresentry.missing_and_stale_explanations_fail_the_reportasserts the same kind of entry.exact_per_file_threshold_and_partial_functionsasserts that no#fn[driver]:entry appears when the function did execute.
- Uncovered locations and absence of measurement.
uncovered_ranges_and_function_locations_are_reportedasserts compressed uncovered line ranges plus a separate single line.exact_per_file_threshold_and_partial_functionsasserts an uncovered-lines entry for a single line.unmeasured_executable_files_and_parse_failures_do_not_disappearasserts “not measured — FAIL” and#fn[missing]: not measured. It also asserts that a parse failure reports “cannot parse rust source”.
- Missing, stale and rejected exception evidence.
missing_and_stale_explanations_fail_the_reportasserts a “missing citation review; runhabeas author” message for a missing review. It assertscitations changedfor changed citation text andoutline input changedfor a changed outline input.accepted_file_and_function_explanations_remain_separate_from_executionassertsdetermination is falsefor a rejected review. It assertscannot accept a {fixme}for a {fixme} determination.
- Accepted exceptions reported separately, without raising coverage.
accepted_file_and_function_explanations_remain_separate_from_executionasserts that a file exception does not waive the function result.- The same test asserts the displayed fraction stays at zero percent. It also asserts the separate “Accepted exceptions (do not increase execution coverage):” section with file-threshold, zero-execution and not-measured entries.
- It asserts a “not measured — accepted exception” line for an unmeasured file and that no zero-fraction line appears for it, so an accepted exception does not become a percentage.
I found no relevant scenario that is untested or unmarked, and there are no acknowledgments to account for.
Inputs
Tests
Input 2: 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 3: 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 4: 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 5: outline src/execution_coverage/check.rs mod[tests]/fn[readable_failed_execution_can_contribute_but_outcomes_remain_visible]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[readable_failed_execution_can_contribute_but_outcomes_remain_visible] - Kind:
fn src/execution_coverage/check.rs:1540–1556
// {test}`requirements.test-coverage.check.measurement`
// {test}`requirements.test-coverage.check.report`
#[test]
fn readable_failed_execution_can_contribute_but_outcomes_remain_visible() {
let temp = fixture("fn a() {}");
let root = temp.path();
let path = record(root, "a", 1, "same", vec![process(root, &[(1, 1)], 1)]);
let mut attempt: Attempt = load(&path.join("attempt.json")).unwrap();
attempt.outcome = "failed".into();
save(&path.join("attempt.json"), &attempt).unwrap();
let result = report(root);
assert!(result.passed, "{}", result.text);
assert!(result.text.contains("attempt failed"));
attempt.processes[0].diagnostic = Some("broken coverage map".into());
save(&path.join("attempt.json"), &attempt).unwrap();
assert!(!report(root).passed);
}
Input 6: 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 7: outline src/execution_coverage/check.rs mod[tests]/fn[uncovered_ranges_and_function_locations_are_reported]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[uncovered_ranges_and_function_locations_are_reported] - Kind:
fn src/execution_coverage/check.rs:1809–1835
// {test}`requirements.test-coverage.check.report`
#[test]
fn uncovered_ranges_and_function_locations_are_reported() {
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, 0), (3, 0), (4, 1), (5, 0)], 0)],
);
let result = report(root);
assert!(!result.passed);
assert!(
result.text.contains("uncovered lines: 2-3, 5"),
"{}",
result.text
);
assert!(
result
.text
.contains("code.rs:1 #fn[a]: zero execution; requires"),
"{}",
result.text
);
}
Other sources
Input 1: requirements selection requirements.test-coverage.check.report
requirements.test-coverage.check.report:md/requirements/test-coverage.md:736–743
:::{req} check.report
The coverage check MUST show each file's measured coverage and threshold result,
identify each unsatisfied function by source file and function, list uncovered
locations or absence of measurement, and explain missing, stale, or rejected
exception evidence. It MUST report accepted
exceptions separately from executed coverage; accepting an exception MUST NOT
increase any displayed execution-coverage percentage.
:::