requirements.ci.orphans
Requirements index · View definition
Requirement
Every JSON file directly under
evidence/MUST correspond to a declared requirement or named example. Habeas MUST report evidence JSON files that do not, and evidence JSON files in any other location underevidence/except the review directories defined byand
.
Rationale
I judged the tests adequate for requirements.ci.orphans. I did not request implementation source, because every obligation maps to a supplied test with concrete assertions.
Obligations derived from the text:
- A JSON file directly under
evidence/that matches no declared requirement or named example MUST be reported. - A JSON file in any other location under
evidence/MUST be reported, except in the review directories for citations (evidence/citations) and sites (evidence/sites). - The review directories are exempt, so their files are not reported as having “no matching requirement or example”.
- Only JSON files are in scope.
Test mapping:
- Top-level orphans (obligation 1):
src/evidence.rs#mod[tests]/fn[collects_missing_orphan_format_false_and_changed_line_errors]writesevidence/ghost.json, which is valid in format but orphaned. It asserts the error text “no matching requirement”.tests/evidence_boundaries.rs#fn[evidence_named_for_terms_or_nothing_is_reported_at_the_top_level]checks thatrules.ghost.jsonand a file named for a vocabulary definition term (rules.datum.json) are each reported. It does this with an exact-equality assertion on the filtered orphan errors. A definition term is not a requirement or named example, so this test covers the “declared requirement or named example” boundary.
- Nested locations (obligation 2):
tests/evidence_boundaries.rs#fn[nested_evidence_files_are_reported]copies a valid record toevidence/nested/rules.ready.jsonandevidence/rust/src/lib.rs.json. It asserts that each path is reported as “no matching requirement or example”. The nested copy has a name that would be valid at the top level, so the assertion shows the location is what triggers the report. - Symlinks:
tests/evidence_boundaries.rs#fn[symlinked_evidence_json_files_are_checked_like_other_files]shows that symlinked orphan and nested files are reported. It also shows that a symlink with the expected name is accepted. This is an extra boundary the requirement does not name. - Review-directory exemptions (obligation 3):
tests/references.rs#fn[citation_reviews_are_required_current_and_not_orphaned]ends by asserting that no “no matching requirement or example” error appears anywhere, while a review sits atevidence/citations/src/lib.rs/fn[helper].json. The review has nested directories and[/]in its name.src/sites.rs#mod[tests]/fn[each_site_needs_a_current_accepted_review_and_orphans_are_reported]asserts that no error starting withevidence/sites/contains “no matching requirement or example”. This holds even for the orphaned site review, which is reported only as an orphaned site review.
- Non-JSON files (obligation 4): The
evidence_named_for_terms_or_nothing_is_reported_at_the_top_leveltest also writesevidence/notes.txtand asserts that validation then produces no errors. - Positive case:
src/evidence.rs#mod[tests]/fn[cited_example_with_a_test_and_matching_evidence_validates]validates files that do correspond to a requirement and an example. It assertsevidence_files == 2and no errors, so correctly named files are not falsely reported.
Gaps: I found none. A plausible violation such as ignoring nested files, reporting review directories, or accepting files named for definition terms would be caught by one of the assertions above. All the tests carry {test} references to requirements.ci.orphans.
Inputs
Tests
Input 4: outline src/evidence.rs mod[tests]/fn[collects_missing_orphan_format_false_and_changed_line_errors]
- File:
src/evidence.rs - Selector:
mod[tests]/fn[collects_missing_orphan_format_false_and_changed_line_errors] - Kind:
fn src/evidence.rs:2566–2667
// {test}`requirements.integration.report_api`
// {test}`requirements.ci.errors`
// {test}`requirements.ci.diagnostics`
// {test}`requirements.ci.input_containment`
// {test}`requirements.ci.definition_errors`
// {test}`requirements.ci.orphans`
// {test}`requirements.ci.coverage`
// {test}`requirements.ci.determination`
// {test}`requirements.ci.outline_inputs`
// {test}`requirements.ci.requirement_text`
// {test}`requirements.ci.schema`
#[test]
fn collects_missing_orphan_format_false_and_changed_line_errors() {
let temp = fixture();
fs::write(
temp.path().join("md/requirements.md"),
"# Requirements\n\n:::{req} one\nFirst.\n:::\n\n:::{req} two\nSecond.\n:::\n\n:::{req} three\nThird.\n:::\n\n:::{req} one\nDuplicate.\n:::\n\n:::{req} empty\n \n:::\n",
)
.unwrap();
fs::write(
temp.path().join("evidence/requirements.one.json"),
json!({
"requirement": "Old text.",
"determination": false,
"rationale": "Work remains.",
"inputs": [
{
"file": "src/main.rs",
"item": "",
"hash": "0".repeat(64)
},
{
"file": "",
"item": 0,
"hash": "ABC"
},
{
"file": "src/main.rs",
"item": "fn[missing]",
"hash": "0".repeat(64)
},
{
"file": "src/main.rs",
"line_start": 1,
"line_end": 1,
"text": ["// first line"]
},
{
"requirements": "requirements.two",
"matches": ["requirements.two"],
"text": [1]
}
]
})
.to_string(),
)
.unwrap();
fs::write(
temp.path().join("evidence/requirements.three.json"),
json!({"requirement": 3, "inputs": {}}).to_string(),
)
.unwrap();
fs::write(
temp.path().join("evidence/ghost.json"),
json!({
"requirement": "Ghost.",
"determination": true,
"rationale": "A valid but orphaned file.",
"inputs": []
})
.to_string(),
)
.unwrap();
fs::write(temp.path().join("evidence/broken.json"), "{").unwrap();
let report = validate_repository(temp.path()).unwrap();
let errors = report.errors.join("\n");
for detail in [
"no matching requirement",
"invalid JSON",
"missing for requirement",
"requirement text changed",
"- Old text.",
"+ First.",
"determination is false",
"inputs[0]: outline input changed: src/main.rs <root> (now lines 1-2) no longer has the recorded hash",
"inputs[1]: file must be a nonempty path",
"inputs[1]: item must be a string",
"inputs[1]: hash must be a lowercase hexadecimal SHA-256 digest",
"inputs[2]: src/main.rs: no outline node matches \"fn[missing]\"",
"inputs[3]: unexpected field \"line_start\"",
"inputs[3]: missing field \"item\"",
"inputs[4]: text[0] must be a string",
"requirement must be a string",
"missing field \"determination\"",
"inputs must be an array",
"duplicate requirement requirements.one; first declared at md/requirements.md:3",
"requirement requirements.empty has no text",
] {
assert!(errors.contains(detail), "missing {detail:?} in:\n{errors}");
}
}
Input 5: outline src/evidence.rs mod[tests]/fn[cited_example_with_a_test_and_matching_evidence_validates]
- File:
src/evidence.rs - Selector:
mod[tests]/fn[cited_example_with_a_test_and_matching_evidence_validates] - Kind:
fn src/evidence.rs:3498–3632
// {test}`requirements.examples.definition`
// {test}`requirements.examples.evidence`
// {test}`requirements.integration.report_api`
// {test}`requirements.ci.schema`
// {test}`requirements.references.evidence_coverage`
// {test}`requirements.ci.requirements_inputs`
// {test}`requirements.ci.orphans`
#[test]
fn cited_example_with_a_test_and_matching_evidence_validates() {
let temp = fixture();
let chapter = "# Rules\n\n:::{req} ready\nReady.\n:::\n\n:::{example} case\nGiven ready, it succeeds. {cite}`rules.ready` {test}`rules.ready`\n:::\n";
fs::write(temp.path().join("md/rules.md"), chapter).unwrap();
let test_source = "// {test}`rules.case`\n#[test]\nfn checks_case() { assert!(true); }\n";
fs::write(temp.path().join("src/main.rs"), test_source).unwrap();
fs::write(
temp.path().join("evidence/rules.ready.json"),
json!({
"requirement": "Ready.",
"determination": true,
"rationale": "The example cites this rule.",
"inputs": crate::inputs::outline_inputs_for_lines(temp.path(), "md/rules.md", 8, 8)
.unwrap()
})
.to_string(),
)
.unwrap();
let example_path = temp.path().join("evidence/rules.case.json");
fs::write(
&example_path,
json!({
"example": "Given ready, it succeeds. {cite}`rules.ready` {test}`rules.ready`",
"determination": true,
"rationale": "checks_case sets up ready and asserts the result.",
"inputs": [
outline(temp.path(), "src/main.rs", "fn[checks_case]"),
{
"requirements": "rules.*",
"matches": ["rules.case", "rules.ready"],
"text": [
chapter.lines().nth(6).unwrap(),
chapter.lines().nth(7).unwrap(),
chapter.lines().nth(8).unwrap(),
"",
chapter.lines().nth(2).unwrap(),
chapter.lines().nth(3).unwrap(),
chapter.lines().nth(4).unwrap()
]
}
]
})
.to_string(),
)
.unwrap();
let report = validate_repository(temp.path()).unwrap();
assert_eq!(report.requirements, 1);
assert_eq!(report.examples, 1);
assert_eq!(report.evidence_files, 2);
assert!(report.errors.is_empty(), "{:?}", report.errors);
let ready_path = temp.path().join("evidence/rules.ready.json");
let ready = fs::read_to_string(&ready_path).unwrap();
let mut missing: Value = serde_json::from_str(&ready).unwrap();
missing["inputs"] = json!([]);
fs::write(&ready_path, missing.to_string()).unwrap();
let errors = validate_repository(temp.path()).unwrap().errors;
assert!(
errors.iter().any(|error| error.contains("no input covers")
&& error.contains("{test}")
&& error.contains("rules.ready")
&& error.contains("md/rules.md:8")),
"{errors:?}"
);
fs::write(ready_path, ready).unwrap();
let old = fs::read_to_string(&example_path).unwrap();
let mut uncovered: serde_json::Value = serde_json::from_str(&old).unwrap();
uncovered["inputs"] = json!([]);
fs::write(&example_path, uncovered.to_string()).unwrap();
let errors = validate_repository(temp.path()).unwrap().errors.join("\n");
assert!(errors.contains("no input covers"), "{errors}");
assert!(errors.contains("src/main.rs:1"), "{errors}");
fs::write(&example_path, &old).unwrap();
fs::write(
temp.path().join("src/main.rs"),
test_source.replace("assert!(true)", "assert!(false)"),
)
.unwrap();
let errors = validate_repository(temp.path()).unwrap().errors.join("\n");
assert!(
errors.contains(
"outline input changed: src/main.rs fn[checks_case] (now lines 1-3) no longer has the recorded hash"
),
"{errors}"
);
fs::write(temp.path().join("src/main.rs"), test_source).unwrap();
fs::write(
temp.path().join("md/rules.md"),
format!("{chapter}\n:::{req} added\nAdded.\n:::\n", req = "{req}"),
)
.unwrap();
let errors = validate_repository(temp.path()).unwrap().errors.join("\n");
assert!(
errors.contains(
"requirements glob \"rules.*\" matches changed; added [\"rules.added\"], removed []"
),
"{errors}"
);
let mut evidence: serde_json::Value = serde_json::from_str(&old).unwrap();
evidence["example"] = "Outdated.".into();
fs::write(&example_path, evidence.to_string()).unwrap();
let errors = validate_repository(temp.path()).unwrap().errors.join("\n");
assert!(errors.contains("example text changed"), "{errors}");
assert!(errors.contains("- Outdated."), "{errors}");
let mut wrong_field: serde_json::Value = serde_json::from_str(&old).unwrap();
let example_text = wrong_field
.as_object_mut()
.unwrap()
.remove("example")
.unwrap();
wrong_field["requirement"] = example_text;
fs::write(&example_path, wrong_field.to_string()).unwrap();
let errors = validate_repository(temp.path()).unwrap().errors.join("\n");
assert!(errors.contains("missing field \"example\""), "{errors}");
assert!(
errors.contains("unexpected field \"requirement\""),
"{errors}"
);
fs::remove_file(&example_path).unwrap();
let errors = validate_repository(temp.path()).unwrap().errors.join("\n");
assert!(errors.contains("missing for example"), "{errors}");
}
Input 6: outline src/sites.rs mod[tests]/fn[each_site_needs_a_current_accepted_review_and_orphans_are_reported]
- File:
src/sites.rs - Selector:
mod[tests]/fn[each_site_needs_a_current_accepted_review_and_orphans_are_reported] - Kind:
fn src/sites.rs:1300–1361
// {test}`requirements.references.site_review`
// {test}`requirements.ci.orphans`
#[test]
fn each_site_needs_a_current_accepted_review_and_orphans_are_reported() {
let temp = project(RULE, SOURCE);
let root = temp.path();
write_review(root, "fn[check_two]", json!({}));
write_review(
root,
"fn[check_one]",
json!({"applies": false, "determination": false, "rationale": "It panics."}),
);
write_review(root, "mod[inner]/fn[check_three]", json!({"inputs": []}));
write_review(root, "fn[other]", json!({}));
let (errors, _) = inspect(root);
assert_eq!(
review_errors(&errors, "fn[check_two]"),
Vec::<String>::new()
);
let one = review_errors(&errors, "fn[check_one]").join("\n");
for text in [
"queries changed for src/lib.rs fn[check_one]: recorded [\"checkers\"], now [\"checkers\",\"panics\"]",
"applies is false, so the determination must be true",
"determination is false: It panics.",
] {
assert!(one.contains(text), "{text}: {one}");
}
let three = review_errors(&errors, "mod[inner]/fn[check_three]").join("\n");
for text in [
"inputs must select the site src/lib.rs mod[inner]/fn[check_three]",
"inputs must include the declaration of requirements.rule",
] {
assert!(three.contains(text), "{text}: {three}");
}
assert_eq!(
review_errors(&errors, "fn[other]"),
[format!(
"{}: orphaned site review: its file and selector name no site of a distributed requirement",
review_path("requirements.rule", "src/lib.rs", "fn[other]")
)]
);
assert!(
!errors
.iter()
.any(|error| error.contains("no matching requirement or example")
&& error.starts_with("evidence/sites/")),
"{errors:#?}"
);
// A changed site makes its review stale.
fs::write(
root.join("src/lib.rs"),
SOURCE.replace("fn check_two() {}", "fn check_two() { let _ = 1; }"),
)
.unwrap();
let (errors, _) = inspect(root);
assert!(
review_errors(&errors, "fn[check_two]")
.iter()
.any(|error| error.contains("hash")),
"{errors:#?}"
);
}
Input 7: outline tests/evidence_boundaries.rs fn[nested_evidence_files_are_reported]
- File:
tests/evidence_boundaries.rs - Selector:
fn[nested_evidence_files_are_reported] - Kind:
fn tests/evidence_boundaries.rs:321–343
// {test}`requirements.ci.orphans`
#[test]
fn nested_evidence_files_are_reported() {
let temp = fixture();
let root = temp.path().join("project");
assert!(validate_repository(&root).unwrap().errors.is_empty());
let record = fs::read(root.join("evidence/rules.ready.json")).unwrap();
for directory in ["evidence/nested", "evidence/rust/src"] {
fs::create_dir_all(root.join(directory)).unwrap();
}
fs::write(root.join("evidence/nested/rules.ready.json"), &record).unwrap();
fs::write(root.join("evidence/rust/src/lib.rs.json"), &record).unwrap();
let errors = validate_repository(&root).unwrap().errors.join("\n");
for label in [
"evidence/nested/rules.ready.json",
"evidence/rust/src/lib.rs.json",
] {
assert!(
errors.contains(&format!("{label}: no matching requirement or example")),
"{errors}"
);
}
}
Input 8: outline tests/evidence_boundaries.rs fn[evidence_named_for_terms_or_nothing_is_reported_at_the_top_level]
- File:
tests/evidence_boundaries.rs - Selector:
fn[evidence_named_for_terms_or_nothing_is_reported_at_the_top_level] - Kind:
fn tests/evidence_boundaries.rs:345–378
// {test}`requirements.ci.orphans`
#[test]
fn evidence_named_for_terms_or_nothing_is_reported_at_the_top_level() {
let temp = fixture();
let root = temp.path().join("project");
fs::write(
root.join("md/rules.md"),
":::{req} ready\nRead the data.\n:::\n\n:::{definition} datum\n:phrase: datum\n\nA datum.\n:::\n",
)
.unwrap();
assert!(validate_repository(&root).unwrap().errors.is_empty());
let record = fs::read(root.join("evidence/rules.ready.json")).unwrap();
for name in ["rules.datum", "rules.ghost"] {
fs::write(root.join(format!("evidence/{name}.json")), &record).unwrap();
}
let errors = validate_repository(&root).unwrap().errors;
let orphans: Vec<_> = errors
.iter()
.filter(|error| error.ends_with(": no matching requirement or example"))
.collect();
assert_eq!(
orphans,
[
"evidence/rules.datum.json: no matching requirement or example",
"evidence/rules.ghost.json: no matching requirement or example",
],
"{errors:?}"
);
// Other files under evidence/ are not evidence JSON files.
fs::remove_file(root.join("evidence/rules.datum.json")).unwrap();
fs::remove_file(root.join("evidence/rules.ghost.json")).unwrap();
fs::write(root.join("evidence/notes.txt"), "not evidence").unwrap();
assert!(validate_repository(&root).unwrap().errors.is_empty());
}
Input 9: outline tests/evidence_boundaries.rs fn[symlinked_evidence_json_files_are_checked_like_other_files]
- File:
tests/evidence_boundaries.rs - Selector:
fn[symlinked_evidence_json_files_are_checked_like_other_files] - Kind:
fn tests/evidence_boundaries.rs:380–408
// {test}`requirements.ci.orphans`
#[cfg(unix)]
#[test]
fn symlinked_evidence_json_files_are_checked_like_other_files() {
let temp = fixture();
let root = temp.path().join("project");
let outside = temp.path().join("outside.json");
fs::copy(root.join("evidence/rules.ready.json"), &outside).unwrap();
std::os::unix::fs::symlink(&outside, root.join("evidence/rules.ghost.json")).unwrap();
fs::create_dir(root.join("evidence/nested")).unwrap();
std::os::unix::fs::symlink(&outside, root.join("evidence/nested/rules.ready.json")).unwrap();
let errors = validate_repository(&root).unwrap().errors.join("\n");
for label in [
"evidence/rules.ghost.json",
"evidence/nested/rules.ready.json",
] {
assert!(
errors.contains(&format!("{label}: no matching requirement or example")),
"{errors}"
);
}
// A symlink with the expected name is accepted as that definition's file.
fs::remove_file(root.join("evidence/rules.ghost.json")).unwrap();
fs::remove_dir_all(root.join("evidence/nested")).unwrap();
fs::remove_file(root.join("evidence/rules.ready.json")).unwrap();
std::os::unix::fs::symlink(&outside, root.join("evidence/rules.ready.json")).unwrap();
let report = validate_repository(&root).unwrap();
assert!(report.errors.is_empty(), "{:?}", report.errors);
}
Input 10: outline tests/references.rs fn[citation_reviews_are_required_current_and_not_orphaned]
- File:
tests/references.rs - Selector:
fn[citation_reviews_are_required_current_and_not_orphaned] - Kind:
fn tests/references.rs:469–642
// {test}`requirements.references.citation_review`
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.orphans`
// {test}`requirements.ci.errors`
#[test]
fn citation_reviews_are_required_current_and_not_orphaned() {
let temp = project();
let root = temp.path();
let cr = role("cite");
let helper = |body: &str| {
format!(
"// {cr}`rules.ready`\n// :::{cr} habeas:util\n// {body}\n// :::\nfn helper() {{\n work();\n}}\n"
)
};
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
fs::write(root.join("notes.txt"), format!("See {cr}`rules.ready`.\n")).unwrap();
// Citations in the book are reviewed with their declaration instead.
fs::write(
root.join("md/guide.md"),
format!("# Guide\n\nSee {cr}`rules.ready`.\n"),
)
.unwrap();
let path = "evidence/citations/src/lib.rs/fn[helper].json";
let errors_for = |prefix: &str| {
errors(root)
.into_iter()
.filter(|error| error.starts_with(prefix))
.collect::<Vec<_>>()
};
let missing = errors_for("evidence/citations/");
assert!(
has(
&missing,
"evidence/citations/src/lib.rs/fn[helper].json: missing citation review for src/lib.rs fn[helper] at src/lib.rs:1"
),
"{missing:#?}"
);
assert!(
has(
&missing,
"evidence/citations/notes.txt/_root.json: missing citation review for notes.txt <root>"
),
"{missing:#?}"
);
assert!(!has(&missing, "md/guide.md"), "{missing:#?}");
let citations = json!([
{"role": "cite", "name": "rules.ready", "commentary": ""},
{"role": "cite", "name": "habeas:util", "commentary": "Formats output."}
]);
fs::create_dir_all(root.join("evidence/citations/src/lib.rs")).unwrap();
let write = |record: Value| fs::write(root.join(path), record.to_string()).unwrap();
write(review(root, citations.clone(), json!(true)));
assert_eq!(errors_for(path), Vec::<String>::new());
write(review(
root,
json!([null, {"role": "broken", "name": 7, "commentary": 8}]),
json!(true),
));
let malformed = errors_for(path);
assert!(
has(&malformed, "citations[0]: expected a JSON object"),
"{malformed:?}"
);
assert!(
has(&malformed, "citations[1]: unknown role"),
"{malformed:?}"
);
assert!(
has(&malformed, "citations[1]: name must be a string"),
"{malformed:?}"
);
assert!(
has(&malformed, "citations[1]: commentary must be a string"),
"{malformed:?}"
);
// A citation review cannot accept a `{fixme}`, so FIXME is reported; a
// false review is reported with its rationale.
write(review(
root,
citations.clone(),
json!({"FIXME": ["example/rules#4"]}),
));
assert!(
has(
&errors_for(path),
"determination is FIXME, but a citation review cannot accept a"
),
"{:#?}",
errors_for(path)
);
write(review(root, citations.clone(), json!(false)));
assert!(
has(
&errors_for(path),
"determination is false: The citations are sensible."
),
"{:#?}",
errors_for(path)
);
// Changed commentary or citations make the review stale; reflowing does not.
write(review(root, citations.clone(), json!(true)));
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
assert_eq!(errors_for(path), Vec::<String>::new());
fs::write(root.join("src/lib.rs"), helper("Formats all output.")).unwrap();
assert!(
has(&errors_for(path), "citations changed"),
"{:#?}",
errors_for(path)
);
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
// So do an edited item and an edited cited declaration.
fs::write(
root.join("src/lib.rs"),
helper("Formats output.").replace("work()", "rest()"),
)
.unwrap();
assert!(
has(&errors_for(path), "outline input changed"),
"{:#?}",
errors_for(path)
);
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
fs::write(
root.join("md/rules.md"),
":::{req} ready\nReady now.\n:::\n",
)
.unwrap();
assert!(
has(&errors_for(path), "input text changed"),
"{:#?}",
errors_for(path)
);
fs::write(root.join("md/rules.md"), ":::{req} ready\nReady.\n:::\n").unwrap();
// The item and each cited declaration must be inputs.
let mut record = review(root, citations.clone(), json!(true));
record["inputs"] = json!([]);
write(record);
let found = errors_for(path);
assert!(
has(&found, "inputs must select the reviewed item"),
"{found:#?}"
);
assert!(
has(
&found,
"inputs must include the cited declaration rules.ready"
),
"{found:#?}"
);
let mut record = review(root, citations.clone(), json!(true));
record["extra"] = json!(1);
write(record);
assert!(has(&errors_for(path), "unexpected field \"extra\""));
// Removing the citations orphans the review.
write(review(root, citations, json!(true)));
fs::write(
root.join("src/lib.rs"),
format!("// {}`rules.ready`\nfn helper() {{}}\n", role("impl")),
)
.unwrap();
assert!(
has(&errors_for(path), "orphaned citation review"),
"{:#?}",
errors_for(path)
);
// The review is not mistaken for misplaced definition evidence.
assert!(!has(&errors(root), "no matching requirement or example"));
}
Referenced definitions
Input 2: requirements selection requirements.references.citation_review
requirements.references.citation_review:md/requirements/references.md:146–174
:::{req} citation_review
Every source item outside the book that carries at least one `{cite}` reference
other than a citation of `habeas:util` under {cite}`requirements.references.util`
MUST have a citation review: an assessment of that item's citations, recorded at
`evidence/citations/<file>/<selector>.json`, where `<file>` is the item's
project-relative path, `<selector>` is its outline selector with every `/` and
`%` percent-encoded, and the root node uses `_root`. The review MUST use the
prompt defined by {cite}`requirements.authoring.citation_prompt`. For citations
of project requirements and examples, the reviewer MUST assess whether the item
should be re-checked or kept in sync when the cited definition changes, and
whether the reference procedure of
{cite}`requirements.references.procedure` calls for `{impl}` or `{test}` instead.
For citations of built-ins, the reviewer MUST check the permitted reference
roles and forms and any citation-review criteria stated in the built-in's fixed
text, using the item's source and commentary. A permitted citation role alone
MUST NOT suffice when the fixed text states additional criteria. Mandatory inputs,
under {cite}`requirements.authoring.mandatory_inputs`, MUST be the item's outline
node, each cited declaration or built-in text, and the citations' commentary. The record MUST contain the item's file and selector,
its citations by role, name, and commentary, `determination`, `rationale`, and
`inputs`, with determinations under {cite}`requirements.ci.outcomes`. Validation
MUST require a current, accepted review for every such item and report stale,
missing, or orphaned reviews; a review MUST become stale when the item's hash,
a cited declaration, or its citations or their commentary change. Authoring with
`--all` MUST include citation reviews, and `habeas author citations:<file>#<selector>`
MUST author the review of the one item it names, under
{cite}`requirements.authoring.refresh`, where omitting `#<selector>`
names the file's root node. A citation in a requirement or example
declaration is reviewed as part of that definition's own assessment instead.
:::
Input 3: requirements selection requirements.references.site_review
requirements.references.site_review:md/requirements/references.md:521–559
:::{req} site_review
Every site of a distributed requirement under
{cite}`requirements.references.distributed` MUST have a site review: an
assessment of whether that site upholds the requirement, recorded at
`evidence/sites/<full-name>/<file>/<selector>.json`, where `<file>` and
`<selector>` are encoded as under
{cite}`requirements.references.citation_review`. The review MUST use the prompt
defined by {cite}`requirements.authoring.site_prompt`. Mandatory inputs, under
{cite}`requirements.authoring.mandatory_inputs`, MUST be the site's outline
node, the requirement's complete declaration, and each declaration the
requirement cites. The record MUST contain the requirement's full name, the
site's file and selector, `queries`, the sorted names of the queries with a
match at the site, `applies`, `determination`, `rationale`, and `inputs`, with
determinations under {cite}`requirements.ci.outcomes`. `applies` MUST be a
Boolean recording whether the requirement applies to the site. A site to which
the requirement does not apply MUST be judged `true`, and the rationale MUST
explain why it does not apply. `habeas info` MUST report, for each selected
distributed requirement, how many of its sites the requirement does not apply
to.
Validation MUST require a current, accepted review for every site, MUST report a
false review with its rationale, and MUST report stale, missing, or orphaned
reviews; a review is orphaned when its file and selector no longer name a site
of the requirement. A `{fixme}` naming the requirement inside a site
acknowledges a gap at that site only: it MUST be an input to that site's review
and MUST NOT contribute to the requirement's own review, coverage, or reference
set. A review MUST become stale when the site's hash, the requirement's
declaration, a cited declaration, its `queries`, or the `{fixme}` references
naming the requirement inside the site, with the words of their bodies, change.
Each site review's determination MUST be checked on its own, independently of
the requirement's evidence. Authoring with `--all` MUST include site reviews,
`habeas author sites:<full-name>` MUST author the site reviews of the named
requirement, and `habeas author sites:<full-name>/<file>#<selector>` MUST author
the review of the one site it names, under
{cite}`requirements.authoring.refresh`, where omitting `#<selector>` names the
file's root node. `habeas status` MUST report missing, stale, invalid, and false
site reviews with their requirement, file, and selector, and `habeas info` MUST
list each selected requirement's sites with their determinations.
:::
Other sources
Input 1: requirements selection requirements.ci.orphans
requirements.ci.orphans:md/requirements/ci.md:7–9
:::{req} orphans
Every JSON file directly under `evidence/` MUST correspond to a declared requirement or named example. Habeas MUST report evidence JSON files that do not, and evidence JSON files in any other location under `evidence/` except the review directories defined by {cite}`requirements.references.citation_review` and {cite}`requirements.references.site_review`.
:::