requirements.test-coverage.check.exceptions.binding
Requirements index · View definition
Requirement
The coverage check MUST use the citation’s source attachment and current accepted review to identify an exception. It MUST NOT require structured exception metadata, match exceptions to targets, profiles, or feature sets, or interpret build conditions in prose as machine-enforced restrictions. A citation with a current accepted review MUST remain eligible across build configurations even when its prose describes a condition specific to one configuration. Satisfying the item’s measured coverage obligations MUST NOT by itself invalidate the citation or make its presence a coverage-check error.
Rationale
The reviewed tests adequately check requirements.test-coverage.check.exceptions.binding. The marked test is src/execution_coverage/check.rs#mod[tests]/fn[accepted_file_and_function_explanations_remain_separate_from_execution]. I did not read the implementation, so this judges the tests against the requirement text only.
Obligations and the scenarios that cover them
-
Use the citation’s source attachment and current accepted review to identify an exception.
- The fixture has a file-level
//!citation and, later, a function-level//citation. Thereviewshelper writes accepted reviews keyed to each citation’s file, item and structural hash. - With only the file citation accepted, the test asserts the file shows
accepted exceptionand#fn[a]: zero executionstill fails the report. The file exception does not waive the function, so each exception is bound to its own attachment. - After a function citation is added and accepted, the report passes. It lists
code.rs: file thresholdandcode.rs#fn[a]: zero executionunder “Accepted exceptions”. - A review with determination
falsefails with “determination is false”. A{"FIXME": [...]}determination fails with “cannot accept a {fixme}”. Only an accepted review therefore counts as an exception. - The “current” part of the obligation is exercised in the sibling test
missing_and_stale_explanations_fail_the_report. That test shows a missing review, changed citations and a changed outline input all stop the exception from applying. It is marked forexceptions.reviews, not for the subject. I treat that as the reviews requirement’s concern, not a gap for the binding requirement.
- The fixture has a file-level
-
MUST NOT require structured exception metadata, match exceptions to targets, profiles or feature sets, or interpret build conditions in prose.
- The citations contain only free prose. Their only fields are the review’s
file,item,citationsand determination, so no structured metadata is supplied and the exception still applies. - The function rationale says “describing only a Linux condition”. It is accepted and applies for config
linux, and again for configwindows, where the function is absent from the measured inventory (absent.functions = Some(vec![])). There the test asserts the report passes and listscode.rs#fn[a]: not measured. This rules out an implementation that ties the exception to the Linux profile. - It then runs configs
coveredandunmeasured-file, which also use different config names.
- The citations contain only free prose. Their only fields are the review’s
-
A citation with a current accepted review MUST remain eligible across build configurations even when its prose describes one configuration. The same unchanged citation and review are reused across the
linux,windows,coveredandunmeasured-fileruns. In theunmeasured-fileruncode.rsis not measured at all, and the report still passes withcode.rs: not measured — accepted exception. -
Satisfying measured coverage obligations MUST NOT by itself invalidate the citation or make its presence an error. In the run with
record(... "covered" ...)the function executes once, so no exception is needed. The test assertsreport(root).passed, with the message “citation may remain when no exception is needed”.
Other tests that bear on the same point
static_validation_never_uses_runtime_gaps_to_decide_citation_applicability runs validate_repository with zero and covered runs. It asserts no errors in either case, so the citation’s presence is not a validation error. It is marked for check.guidance, not for the subject, but it supports the same conclusion.
I found no plausible requirement-violating behavior that these tests would accept.
Inputs
Tests
Input 2: 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}"));
}
Other sources
Input 1: requirements selection requirements.test-coverage.check.exceptions.binding
requirements.test-coverage.check.exceptions.binding:md/requirements/test-coverage.md:699–708
:::{req} check.exceptions.binding
The coverage check MUST use the citation's source attachment and current
accepted review to identify an exception. It MUST NOT require structured
exception metadata, match exceptions to targets, profiles, or feature sets, or
interpret build conditions in prose as machine-enforced restrictions.
A citation with a current accepted review MUST remain eligible across build
configurations even when its prose describes a condition specific to one
configuration. Satisfying the item's measured coverage obligations MUST NOT
by itself invalidate the citation or make its presence a coverage-check error.
:::
Input 3: outline src/execution_coverage/check.rs mod[tests]/fn[reviews]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[reviews] - Kind:
fn src/execution_coverage/check.rs:680–699
// Synthetic fixture evidence only: production evidence is authored by a model.
// {cite}`habeas:util`
fn reviews(root: &Path, determination: serde_json::Value) {
let outlines = OutlineCache::default();
let mut errors = Vec::new();
let references = crate::evidence::collect_references(root, &mut errors);
assert!(errors.is_empty(), "{errors:?}");
for item in citation_items(root, &BTreeMap::new(), &references, &outlines).into_values() {
let parsed = outlines.parse(root, &item.file);
let parsed = parsed.as_ref().as_ref().unwrap();
let node = parsed.resolve(&item.file, &item.item).unwrap();
let path = root.join(item.review_path());
fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(path, serde_json::to_vec(&json!({
"file": item.file, "item": item.item, "citations": item.citations_value(),
"determination": determination, "rationale": "Synthetic accepted explanation for test fixture.",
"inputs": [{"file": item.file, "item": item.item, "hash": parsed.outline.nodes[node].structural_hash}]
})).unwrap()).unwrap();
}
}
Input 4: 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 5: outline src/execution_coverage/check.rs mod[tests]/fn[static_validation_never_uses_runtime_gaps_to_decide_citation_applicability]
- File:
src/execution_coverage/check.rs - Selector:
mod[tests]/fn[static_validation_never_uses_runtime_gaps_to_decide_citation_applicability] - Kind:
fn src/execution_coverage/check.rs:1837–1861
// {test}`requirements.test-coverage.check.guidance`
#[test]
fn static_validation_never_uses_runtime_gaps_to_decide_citation_applicability() {
let temp = fixture(
"//! :::{cite} habeas:coverage\n//! File rationale.\n//! :::\n// :::{cite} habeas:coverage\n// Function rationale.\n// :::\nfn a() {}\n",
);
let root = temp.path();
let (path, source) = crate::execution_coverage::configure(root).unwrap();
fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(path, source).unwrap();
reviews(root, json!(true));
assert!(!root.join("target/habeas/coverage").exists());
assert!(crate::validate_repository(root).unwrap().errors.is_empty());
for (started, count) in [(1, 0), (2, 1)] {
record(
root,
"a",
started,
"same",
vec![process(root, &[(7, count)], count)],
);
let result = crate::validate_repository(root).unwrap();
assert!(result.errors.is_empty(), "{:?}", result.errors);
}
}