requirements.references.site_review
Requirements index · View definition
Requirement
Every site of a distributed requirement under
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. The review MUST use the prompt defined by
. Mandatory inputs, under
, 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, andinputs, with determinations under.
appliesMUST be a Boolean recording whether the requirement applies to the site. A site to which the requirement does not apply MUST be judgedtrue, and the rationale MUST explain why it does not apply.habeas infoMUST 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, itsqueries, 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--allMUST include site reviews,habeas author sites:<full-name>MUST author the site reviews of the named requirement, andhabeas author sites:<full-name>/<file>#<selector>MUST author the review of the one site it names, under, where omitting
#<selector>names the file’s root node.habeas statusMUST report missing, stale, invalid, and false site reviews with their requirement, file, and selector, andhabeas infoMUST list each selected requirement’s sites with their determinations.
Rationale
I judge the tests adequate. I did not request any implementation source, because each obligation maps to a marked test with concrete assertions.
Review location and encoding
src/sites.rs#mod[tests]/fn[site_query_names_are_sorted_and_nested_review_paths_are_encoded]asserts the pathevidence/sites/<req>/<file>/<selector>.json. It checks that/in a nested selector is encoded as%2Fand that%is encoded as%25.- It also asserts that the recorded
queriesare sorted (a_checkers,panics,z_checkers). src/authoring/mod.rs#mod[tests]/fn[site_reviews_use_their_prompt_and_record_applies_and_the_site]asserts theevidence_pathfor a site subject.src/authoring/mod.rs#mod[tests]/fn[site_reviews_cite_declarations_go_stale_with_them_and_name_root_sites]asserts that a site named without a selector gets the_root.jsonpath.
Prompt, mandatory inputs and record content
site_reviews_use_their_prompt_and_record_applies_and_the_sitechecks the mandatory inputs. They are the site’s outline node (file and item), the requirement’s declaration, the cited requirement and the cited definition, 4 inputs in all.- The same test checks the subject message against the approved prompt, and that
submit_judgmentrequiresapplies. - It also checks that the record contains
requirement,file,item,queriesandapplies. It then writes the record and confirms that validation accepts it. - The cited-declaration test checks that each cited declaration and built-in text is an input. It also checks that a review missing a cited declaration is reported as incomplete.
applies and determination rules
each_site_needs_a_current_accepted_review_and_orphans_are_reportedasserts the error “applies is false, so the determination must be true”.status_and_info_report_site_reviews_by_requirement_file_and_selectorasserts the error “applies must be a Boolean”.- Whether a rationale explains non-applicability is a model-judgment matter, not a code-checkable property.
Validation and staleness
each_site_needs_a_current_accepted_review_and_orphans_are_reportedcovers four cases:- A current review passes.
- A false review is reported with its rationale (“determination is false: It panics.”).
- A review with wrong inputs is reported.
- An orphaned review is reported.
- It also checks that a changed site hash makes the review stale, and that a changed
querieslist is detected. - The cited-declaration test makes a review stale by changing both the requirement’s text and a cited declaration’s text.
a_fixme_inside_a_site_belongs_to_that_sites_review_onlycovers the in-site{fixme}rules:- A change in the
{fixme}references is reported on the site review. - Reflowing the body keeps the review current, and changing its words makes it stale.
- The in-site
{fixme}does not count toward the requirement’s evidence coverage or reference-set digest. - A
{fixme}outside any site still changes that digest.
- A change in the
a_closed_issue_of_a_fixme_inside_a_site_makes_only_its_site_review_staleshows a closed issue affects only the site review and not the requirement’s evidence.src/authoring/inputs.rs#mod[tests]/fn[cited_built_ins_contribute_their_text_and_fixmes_in_own_sites_do_not]shows an in-site{fixme}is an input to that site’s review (has_applicable_fixme) and not to the requirement’s own assessment.- The independence of each site review’s determination from the requirement’s evidence is exercised by the same tests. Site reviews are checked and reported with no requirement evidence file, and a requirement file written beside them does not affect them.
Authoring
tests/authoring_batch.rs#fn[site_reviews_are_authored_by_requirement_and_orphans_deleted_by_all]coversauthor sites:<req>, the single-site form, and--allincluding site reviews. It also covers:- current reviews being skipped, with no model or configuration;
--forcere-authoring;- an unknown requirement being an error;
- orphan deletion.
src/authoring/batch.rshas two tests,selection_includes_site_reviews_and_sites_of_selects_only_themandorphaned_citation_and_site_reviews_are_deleted, which cover subject selection and orphan deletion.
Reporting
status_and_info_report_site_reviews_by_requirement_file_and_selectorasserts thehabeas statusrows for Missing, Determination false, Invalid (including the stale and invalid-appliescases) and Valid. Each row names the requirement, file and selector.- It asserts
habeas infoprints “3 sites; the requirement does not apply to 1 of them.” It also asserts the per-site table withappliesand determination columns.
I found no obligation of the subject without a test that asserts its outcome. The tests are marked {test} for the subject. The prompt text and {fixme} acknowledgment semantics belong to other requirements that these tests also cite.
Inputs
Tests
Input 8: outline src/authoring/batch.rs mod[tests]/fn[selection_includes_site_reviews_and_sites_of_selects_only_them]
- File:
src/authoring/batch.rs - Selector:
mod[tests]/fn[selection_includes_site_reviews_and_sites_of_selects_only_them] - Kind:
fn src/authoring/batch.rs:752–792
// {test}`requirements.authoring.batch`
// {test}`requirements.references.site_review`
#[test]
fn selection_includes_site_reviews_and_sites_of_selects_only_them() {
let temp =
crate::sites::tests::project(crate::sites::tests::RULE, crate::sites::tests::SOURCE);
let root = temp.path();
crate::sites::tests::write_review(root, "fn[check_two]", serde_json::json!({}));
let inspection = crate::evidence::inspect_repository(root).unwrap();
let labels = |subjects: Vec<AuthoringSubject>| {
subjects
.iter()
.map(AuthoringSubject::label)
.collect::<Vec<_>>()
};
let (subjects, unchanged) = select_subjects(root, &inspection, None, false, &mut |_| {});
assert_eq!(
labels(subjects),
[
"requirements.rule",
"sites:requirements.rule/src/lib.rs#fn[check_one]",
"sites:requirements.rule/src/lib.rs#mod[inner]/fn[check_three]",
]
);
assert_eq!(unchanged, 1);
let (subjects, unchanged) = select_subjects(
root,
&inspection,
Some("requirements.rule"),
false,
&mut |_| {},
);
assert_eq!(
labels(subjects),
[
"sites:requirements.rule/src/lib.rs#fn[check_one]",
"sites:requirements.rule/src/lib.rs#mod[inner]/fn[check_three]",
]
);
assert_eq!(unchanged, 1);
}
Input 9: outline src/authoring/batch.rs mod[tests]/fn[orphaned_citation_and_site_reviews_are_deleted]
- File:
src/authoring/batch.rs - Selector:
mod[tests]/fn[orphaned_citation_and_site_reviews_are_deleted] - Kind:
fn src/authoring/batch.rs:794–827
// {test}`requirements.authoring.batch`
// {test}`requirements.references.site_review`
// {test}`requirements.references.citation_review`
#[test]
fn orphaned_citation_and_site_reviews_are_deleted() {
let temp =
crate::sites::tests::project(crate::sites::tests::RULE, crate::sites::tests::SOURCE);
let root = temp.path();
crate::sites::tests::write_review(root, "fn[check_two]", serde_json::json!({}));
crate::sites::tests::write_review(root, "fn[other]", serde_json::json!({}));
fs::create_dir_all(root.join("evidence/citations/src/lib.rs")).unwrap();
fs::write(
root.join("evidence/citations/src/lib.rs/fn[gone].json"),
"{}",
)
.unwrap();
let inspection = crate::evidence::inspect_repository(root).unwrap();
assert_eq!(
delete_orphaned_reviews(root, &inspection).unwrap(),
[
"evidence/citations/src/lib.rs/fn[gone].json",
"evidence/sites/requirements.rule/src/lib.rs/fn[other].json",
]
);
assert!(
root.join("evidence/sites/requirements.rule/src/lib.rs/fn[check_two].json")
.exists()
);
assert!(
!root
.join("evidence/sites/requirements.rule/src/lib.rs/fn[other].json")
.exists()
);
}
Input 10: outline src/authoring/inputs.rs mod[tests]/fn[cited_built_ins_contribute_their_text_and_fixmes_in_own_sites_do_not]
- File:
src/authoring/inputs.rs - Selector:
mod[tests]/fn[cited_built_ins_contribute_their_text_and_fixmes_in_own_sites_do_not] - Kind:
fn src/authoring/inputs.rs:1626–1704
// {test}`requirements.references.authoring_inputs`
// {test}`requirements.references.builtin_definitions`
// {test}`requirements.references.site_review`
// {test}`requirements.authoring.adaptive`
// {test}`requirements.authoring.fixme_inputs`
#[test]
fn cited_built_ins_contribute_their_text_and_fixmes_in_own_sites_do_not() {
let project = crate::authoring::tests::citing_site_project();
let root = project.path();
let fixme = |issue: &str| {
format!(
" // :::{{fixme}} requirements.rule\n // :github: o/r#{issue}\n // Panics instead of reporting.\n // :::\n"
)
};
let source = crate::sites::tests::SOURCE
.replace(
"fn check_two() {}",
&format!("fn check_two() {{\n{}}}", fixme("1")),
)
.replace(
"fn other() { panic!(\"y\"); }",
&format!("fn other() {{\n{}}}", fixme("2")),
);
fs::write(root.join("src/lib.rs"), &source).unwrap();
let sources = AssessmentSources::prepare(root, "requirements.rule").unwrap();
assert!(sources.has_applicable_fixme);
let own_site = AssessmentSources::prepare_site(
root,
"requirements.rule",
"src/lib.rs",
"fn[check_two]",
)
.unwrap();
assert!(own_site.has_applicable_fixme);
let clean_site = AssessmentSources::prepare_site(
root,
"requirements.rule",
"src/lib.rs",
"fn[check_one]",
)
.unwrap();
assert!(!clean_site.has_applicable_fixme);
assert!(clean_site.model_acknowledgments().is_empty());
let only_site = source.replace(&fixme("2"), "");
fs::write(root.join("src/lib.rs"), only_site).unwrap();
assert!(
!AssessmentSources::prepare(root, "requirements.rule")
.unwrap()
.has_applicable_fixme
);
fs::write(root.join("src/lib.rs"), &source).unwrap();
let mandatory = sources.mandatory_inputs();
let items = mandatory
.iter()
.filter_map(|input| input["item"].as_str())
.collect::<Vec<_>>();
// Only the acknowledgment outside the subject's own sites belongs to
// this assessment, and it contributes no containing source.
assert!(items.is_empty(), "{mandatory:#?}");
let acknowledgments = sources.model_acknowledgments();
assert_eq!(acknowledgments.len(), 1, "{acknowledgments:#?}");
assert_eq!(acknowledgments[0]["item"], "fn[other]");
assert_eq!(acknowledgments[0]["issues"][0]["reference"], "o/r#2");
// A cited built-in contributes its fixed text once, and a cited
// declaration its own declaration.
assert_eq!(
mandatory
.iter()
.filter(|input| input["builtin"] == "habeas:util")
.collect::<Vec<_>>(),
[&builtin_input("habeas:util")]
);
assert!(
mandatory
.iter()
.any(|input| input["requirements"] == "requirements.other"),
"{mandatory:#?}"
);
}
Input 11: outline src/authoring/mod.rs mod[tests]/fn[site_confirmed]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[site_confirmed] - Kind:
fn src/authoring/mod.rs:4608–4632
/// Runs the review of site `fn[check_one]` of `requirements.rule` with
/// `turns`, returning the outcome and the provider.
// {test}`requirements.references.site_review`
async fn site_confirmed(
turns: Vec<(&'static str, Value)>,
) -> (io::Result<(Judgment, Value)>, RecordingProvider) {
let project =
crate::sites::tests::project(crate::sites::tests::RULE, crate::sites::tests::SOURCE);
let state = tempfile::tempdir().unwrap();
let subject = AuthoringSubject::parse("sites:requirements.rule/src/lib.rs#fn[check_one]");
let sources = subject.sources(project.path()).unwrap();
let mut usage = UsageLog::start(state.path(), project.path(), &subject.label()).unwrap();
let provider = RecordingProvider::new(turns);
let result = assess_subject(
&provider,
project.path(),
state.path(),
&subject,
sources,
&mut usage,
AssessmentPolicy::Confirm,
)
.await;
(result, provider)
}
Input 12: outline src/authoring/mod.rs mod[tests]/fn[site_reviews_cite_declarations_go_stale_with_them_and_name_root_sites]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[site_reviews_cite_declarations_go_stale_with_them_and_name_root_sites] - Kind:
fn src/authoring/mod.rs:4668–4781
// {test}`requirements.references.site_review`
// {test}`requirements.references.builtin_definitions`
#[test]
fn site_reviews_cite_declarations_go_stale_with_them_and_name_root_sites() {
let project = citing_site_project();
let root = project.path();
// Records a current review of a site with its mandatory inputs.
let write = |label: &str, queries: &[&str], drop: Option<&str>| {
let subject = AuthoringSubject::parse(label);
let AuthoringSubject::Site {
requirement,
file,
item,
} = &subject
else {
unreachable!()
};
let mut sources = subject.sources(root).unwrap();
let mandatory = sources.mandatory_inputs().to_vec();
sources.record_inputs(&mandatory);
let inputs = sources
.recorded_inputs()
.iter()
.filter(|input| drop.is_none_or(|name| input["requirements"] != name))
.cloned()
.collect::<Vec<_>>();
let path = subject.evidence_path(root);
fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(
&path,
json!({"requirement": requirement, "file": file, "item": item,
"queries": queries, "applies": true, "fixmes": [],
"determination": true, "rationale": "Fine.", "inputs": inputs})
.to_string(),
)
.unwrap();
(sources, path)
};
let review_errors = |path: &Path| {
let prefix = format!("{}:", crate::evidence::display_path(root, path));
crate::sites::tests::inspect(root)
.0
.into_iter()
.filter(|error| error.starts_with(&prefix))
.collect::<Vec<_>>()
};
// A site review receives each declaration and built-in text its
// requirement cites.
let (sources, two) = write(
"sites:requirements.rule/src/lib.rs#fn[check_two]",
&["checkers"],
None,
);
let mandatory = sources.mandatory_inputs();
assert!(
mandatory
.iter()
.any(|input| input["requirements"] == "requirements.other"
&& input["text"][1] == "Other MUST hold."),
"{mandatory:#?}"
);
assert_eq!(
mandatory
.iter()
.filter(|input| input["builtin"] == "habeas:util")
.count(),
1,
"{mandatory:#?}"
);
assert_eq!(review_errors(&two), Vec::<String>::new());
// A review without a cited declaration is incomplete.
let (_, one) = write(
"sites:requirements.rule/src/lib.rs#fn[check_one]",
&["checkers", "panics"],
Some("requirements.other"),
);
assert!(
review_errors(&one)
.iter()
.any(|error| error
.contains("inputs must include the declaration of requirements.other")),
"{:#?}",
review_errors(&one)
);
// Omitting the selector names the file's root node.
let (_, attributes) = write("sites:requirements.attributes/src/lib.rs", &["inner"], None);
assert!(
attributes.ends_with("evidence/sites/requirements.attributes/src/lib.rs/_root.json"),
"{}",
attributes.display()
);
assert_eq!(review_errors(&attributes), Vec::<String>::new());
// Changing the requirement's or a cited declaration makes the review
// stale.
let chapter = root.join("md/requirements.md");
let original = fs::read_to_string(&chapter).unwrap();
for (old, new) in [
("Other MUST hold.", "Other MUST still hold."),
("Each checker MUST", "Every checker MUST"),
] {
fs::write(&chapter, original.replace(old, new)).unwrap();
assert!(
review_errors(&two)
.iter()
.any(|error| error.contains("input text changed")),
"{new}: {:#?}",
review_errors(&two)
);
}
}
Input 13: outline src/authoring/mod.rs mod[tests]/fn[site_reviews_use_their_prompt_and_record_applies_and_the_site]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[site_reviews_use_their_prompt_and_record_applies_and_the_site] - Kind:
fn src/authoring/mod.rs:4783–4960
// {test}`requirements.authoring.site_prompt`
// {test}`requirements.authoring.habeas_background`
// {test}`requirements.references.site_review`
// {test}`requirements.authoring.mandatory_inputs`
// {test}`requirements.authoring.judgment_rules`
// {test}`requirements.authoring.no_line_numbers`
#[tokio::test]
async fn site_reviews_use_their_prompt_and_record_applies_and_the_site() {
let project = crate::sites::tests::project(
crate::sites::tests::RULE,
&crate::sites::tests::SOURCE.replace(
"fn check_two() {}",
"fn check_two() {\n // :::{fixme} requirements.rule\n // Panics.\n // :::\n}",
),
);
let root = project.path();
let declaration = crate::sites::tests::RULE.replace("Each checker MUST report problems instead of panicking.", "Each checker MUST report problems instead of panicking. {cite}`requirements.other` {term}`terms.value`");
fs::write(
root.join("md/requirements.md"),
format!("{declaration}\n:::{{req}} other\nOther MUST hold.\n:::\n"),
)
.unwrap();
fs::write(
root.join("md/terms.md"),
":::{definition} value\n:phrase: value\nA useful value.\n:::\n",
)
.unwrap();
let subject = AuthoringSubject::parse("sites:requirements.rule/src/lib.rs#fn[check_two]");
assert_eq!(
subject.evidence_path(root),
root.join("evidence/sites/requirements.rule/src/lib.rs/fn[check_two].json")
);
let mut sources = subject.sources(root).unwrap();
let mandatory = sources.mandatory_inputs().to_vec();
assert_eq!(mandatory[0]["file"], "src/lib.rs");
assert_eq!(mandatory[0]["item"], "fn[check_two]");
assert_eq!(mandatory[1]["requirements"], "requirements.rule");
assert_eq!(mandatory.len(), 4, "{mandatory:#?}");
assert!(
mandatory
.iter()
.any(|input| input["requirements"] == "requirements.other")
);
assert!(
mandatory
.iter()
.any(|input| input["definition"] == "terms.value")
);
// The subject message names the requirement, the site's file and
// selector, and each query match with its kind, name and lines.
let matches =
json!([{"kind": "sites", "query": "checkers", "item": "fn[check_two]"}]).to_string();
let mandatory_inputs =
serde_json::to_string_pretty(&sources.model_mandatory_inputs()).unwrap();
let expected_subject = fill(
approved_text("site_prompt", 1),
&[
("requirement_name", "requirements.rule"),
("site_file", "src/lib.rs"),
("site_selector", "fn[check_two]"),
("matches", &matches),
("mandatory_inputs", &mandatory_inputs),
],
);
let initial = initial_prompt(&sources).unwrap();
assert_eq!(initial.subject, expected_subject);
assert!(
initial
.subject
.starts_with(&format!(
"# Subject\n\nSite under review: src/lib.rs fn[check_two]\nRequirement: requirements.rule\nMatches: {matches}\n"
)),
"{}",
initial.subject
);
let state = tempfile::tempdir().unwrap();
let mut usage = UsageLog::start(state.path(), root, &subject.label()).unwrap();
let provider = RecordingProvider::new(vec![(
"submit_judgment",
json!({"applies": true, "determination": {"FIXME": ["Panics."]}, "rationale": "Acknowledged."}),
)]);
let (_, record) = assess(&provider, &mut sources, &mut usage).await.unwrap();
let prompts = provider.prompts();
let (prompt, tools) = &prompts[0];
let prompt = serde_json::from_str::<Value>(prompt).unwrap();
let text = prompt.to_string();
assert!(
text.contains(
serde_json::to_string(&initial.subject)
.unwrap()
.trim_matches('"')
),
"the subject message reaches the model"
);
let heading = approved_text("site_prompt", 0)
.split("\n\n# Background")
.next()
.unwrap();
assert!(
text.contains(serde_json::to_string(heading).unwrap().trim_matches('"')),
"{heading}\n{text}"
);
for block in [
approved_text("habeas_background", 0),
distributed_background(),
approved_text("judgment_rules", 0),
] {
assert!(
text.contains(serde_json::to_string(block).unwrap().trim_matches('"')),
"{block}"
);
}
assert!(
!text.contains(
serde_json::to_string(approved_text("habeas_background", 1))
.unwrap()
.trim_matches('"')
),
"the site prompt has no reference roles"
);
assert!(!text.contains("{{"), "{text}");
assert!(tools.contains(&"submit_judgment".to_owned()));
let expected: Vec<_> = tool_definitions_with("submit_judgment", false)
.unwrap()
.into_iter()
.map(|tool| tool.name)
.collect();
assert_eq!(*tools, expected);
let duplicate = json!({"applies":true,"determination":true,"rationale":"Covered."});
let duplicate_provider = ScriptedProvider {
turns: vec![vec![
("submit_judgment", duplicate.clone()),
("submit_judgment", duplicate),
]],
requests: RefCell::default(),
};
let mut duplicate_sources = subject.sources(root).unwrap();
assert!(
assess(&duplicate_provider, &mut duplicate_sources, &mut usage)
.await
.unwrap_err()
.to_string()
.contains("exactly once")
);
let submit = provider.requests.borrow()[0]["tools"]
.as_array()
.unwrap()
.iter()
.find(|tool| tool["name"] == "submit_judgment")
.unwrap()
.clone();
assert_eq!(
submit["parameters"]["required"],
json!(["determination", "rationale", "applies"])
);
assert_eq!(record["requirement"], "requirements.rule");
assert_eq!(record["file"], "src/lib.rs");
assert_eq!(record["item"], "fn[check_two]");
assert_eq!(record["queries"], json!(["checkers"]));
assert_eq!(record["applies"], true);
assert_eq!(
record["fixmes"],
json!([{"item": "fn[check_two]", "commentary": "Panics."}])
);
// The recorded review satisfies validation for its site.
let path = subject.evidence_path(root);
fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(&path, record.to_string()).unwrap();
let errors = crate::validate_repository(root).unwrap().errors;
let prefix = crate::sites::review_path("requirements.rule", "src/lib.rs", "fn[check_two]");
assert!(
!errors.iter().any(|error| error.starts_with(&prefix)),
"{errors:#?}"
);
}
Input 14: outline src/github.rs mod[tests]/fn[a_closed_issue_of_a_fixme_inside_a_site_makes_only_its_site_review_stale]
- File:
src/github.rs - Selector:
mod[tests]/fn[a_closed_issue_of_a_fixme_inside_a_site_makes_only_its_site_review_stale] - Kind:
fn src/github.rs:921–962
// {test}`requirements.authoring.github_reads`
// {test}`requirements.references.site_review`
#[test]
fn a_closed_issue_of_a_fixme_inside_a_site_makes_only_its_site_review_stale() {
let github = FakeGithub::start(&[("/repos/o/r/issues/1", 200, issue("closed", ""))]);
let source = crate::sites::tests::SOURCE.replace(
"fn check_two() {}",
"fn check_two() {\n // :::{fixme} requirements.rule\n // :github: o/r#1\n // Panics.\n // :::\n}",
);
let temp = crate::sites::tests::project(crate::sites::tests::RULE, &source);
let root = temp.path();
crate::sites::tests::write_review(
root,
"fn[check_two]",
json!({"determination": {"FIXME": ["o/r#1"]}}),
);
fs::write(
root.join("evidence/requirements.rule.json"),
json!({"determination": {"FIXME": ["o/r#1"]}}).to_string(),
)
.unwrap();
let mut inspection = crate::evidence::inspect_repository(root).unwrap();
let before = inspection.report.errors.len();
add_issue_findings(
&mut inspection,
&GithubIssues::with_api(github.endpoint.clone(), None, None),
);
let added = inspection.report.errors[before..].to_vec();
let review = crate::sites::review_path("requirements.rule", "src/lib.rs", "fn[check_two]");
assert!(
added.contains(&format!(
"{review}: stale: issue o/r#1, named by the {{fixme}} to requirements.rule inside the site at src/lib.rs:3, is closed; reassess the review"
)),
"{added:#?}"
);
assert!(
!added
.iter()
.any(|error| error.starts_with("evidence/requirements.rule.json")),
"{added:#?}"
);
}
Input 15: outline src/sites.rs mod[tests]/fn[site_query_names_are_sorted_and_nested_review_paths_are_encoded]
- File:
src/sites.rs - Selector:
mod[tests]/fn[site_query_names_are_sorted_and_nested_review_paths_are_encoded] - Kind:
fn src/sites.rs:981–1000
// {test}`requirements.references.site_review`
#[test]
fn site_query_names_are_sorted_and_nested_review_paths_are_encoded() {
let duplicate = "\n::::{sites} a_checkers\n```yaml\nlanguage: rust\npaths: [src]\nrule:\n kind: function_item\n has: { field: name, regex: \"^check_\" }\nmatch: [\"fn check_one() {}\"]\nno_match: [\"fn other() {}\"]\n```\n::::\n:::::\n";
let chapter = RULE
.replace("checkers", "z_checkers")
.replace(":::::\n", duplicate);
let temp = project(&chapter, SOURCE);
let (_, sites) = inspect(temp.path());
let site = &sites["requirements.rule"][2];
assert_eq!(site.queries(), ["a_checkers", "panics", "z_checkers"]);
assert_eq!(
site.review_path(),
"evidence/sites/requirements.rule/src/lib.rs/mod[inner]%2Ffn[check_three].json"
);
assert_eq!(
review_path("rules.ready", "src/lib.rs", "fn[check%25]"),
"evidence/sites/rules.ready/src/lib.rs/fn[check%2525].json",
);
}
Input 16: 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 17: outline src/sites.rs mod[tests]/fn[a_fixme_inside_a_site_belongs_to_that_sites_review_only]
- File:
src/sites.rs - Selector:
mod[tests]/fn[a_fixme_inside_a_site_belongs_to_that_sites_review_only] - Kind:
fn src/sites.rs:1398–1505
// {test}`requirements.references.site_review`
// {test}`requirements.references.evidence_coverage`
// {test}`requirements.ci.reference_set`
#[test]
fn a_fixme_inside_a_site_belongs_to_that_sites_review_only() {
let fixme = |issue: &str| {
format!(
" // :::{{fixme}} requirements.rule\n // :github: o/r#{issue}\n // Panics instead of reporting.\n // :::\n"
)
};
let source = SOURCE
.replace(
"fn check_two() {}",
&format!("fn check_two() {{\n{}}}", fixme("1")),
)
.replace(
"fn other() { panic!(\"y\"); }",
&format!("fn other() {{\n{}}}", fixme("2")),
);
let temp = project(RULE, &source);
let root = temp.path();
fs::write(
root.join("evidence/requirements.rule.json"),
json!({"requirement": "x", "determination": true, "rationale": "Fine.", "inputs": []})
.to_string(),
)
.unwrap();
crate::evidence::tests::stamp_reference_sets(root);
write_review(
root,
"fn[check_two]",
json!({"determination": {"FIXME": ["o/r#1"]}}),
);
let (errors, _) = inspect(root);
let coverage = errors
.iter()
.filter(|error| error.contains("no input covers {fixme}"))
.collect::<Vec<_>>();
assert!(coverage.is_empty(), "{errors:#?}");
let two = review_errors(&errors, "fn[check_two]").join("\n");
assert!(
two.contains("{fixme} references to requirements.rule inside src/lib.rs fn[check_two] changed: recorded [], now [{\"item\":\"fn[check_two]\",\"commentary\":\":github: o/r#1\\n Panics instead of reporting.\"}]"),
"{two}"
);
assert!(!two.contains("FIXME entry"), "{two}");
// Editing the in-site `{fixme}` leaves the requirement's reference
// set unchanged; editing the other changes it.
let digest = crate::evidence::reference_set_digest_for(root, "requirements.rule").unwrap();
fs::write(
root.join("src/lib.rs"),
source.replacen("Panics instead", "Still panics instead", 1),
)
.unwrap();
assert_eq!(
crate::evidence::reference_set_digest_for(root, "requirements.rule").unwrap(),
digest
);
fs::write(
root.join("src/lib.rs"),
source.replace(
"// Panics instead of reporting.\n // :::\n}\nmod",
"// Edited.\n // :::\n}\nmod",
),
)
.unwrap();
assert_ne!(
crate::evidence::reference_set_digest_for(root, "requirements.rule").unwrap(),
digest
);
// A review recording the in-site `{fixme}` is current; reflowing its
// body keeps it current, and changing its words makes it stale.
fs::write(root.join("src/lib.rs"), &source).unwrap();
crate::evidence::tests::stamp_reference_sets(root);
write_review(
root,
"fn[check_two]",
json!({
"determination": {"FIXME": ["o/r#1"]},
"fixmes": [{"item": "fn[check_two]", "commentary": ":github: o/r#1\n Panics instead of reporting."}],
}),
);
let changed = |root: &Path| {
let (errors, _) = inspect(root);
review_errors(&errors, "fn[check_two]")
.into_iter()
.filter(|error| error.contains("{fixme} references"))
.collect::<Vec<_>>()
};
assert_eq!(changed(root), Vec::<String>::new());
fs::write(
root.join("src/lib.rs"),
source.replacen(
" // Panics instead of reporting.\n",
" // Panics instead\n // of reporting.\n",
1,
),
)
.unwrap();
assert_eq!(changed(root), Vec::<String>::new());
fs::write(
root.join("src/lib.rs"),
source.replacen("Panics instead", "Still panics instead", 1),
)
.unwrap();
assert_eq!(changed(root).len(), 1);
}
Input 18: outline src/sites.rs mod[tests]/fn[status_and_info_report_site_reviews_by_requirement_file_and_selector]
- File:
src/sites.rs - Selector:
mod[tests]/fn[status_and_info_report_site_reviews_by_requirement_file_and_selector] - Kind:
fn src/sites.rs:1549–1617
// {test}`requirements.references.site_review`
#[test]
fn status_and_info_report_site_reviews_by_requirement_file_and_selector() {
let temp = project(RULE, SOURCE);
let root = temp.path();
write_review(
root,
"fn[check_two]",
json!({"applies": false, "rationale": "A helper, not a checker."}),
);
write_review(
root,
"mod[inner]/fn[check_three]",
json!({"queries": ["checkers", "panics"], "determination": false, "rationale": "It panics."}),
);
let status = crate::status_markdown(root, false).unwrap();
for row in [
"| `requirements.rule` | `src/lib.rs` | `fn[check_one]` | Missing |",
"| `requirements.rule` | `src/lib.rs` | `mod[inner]/fn[check_three]` | Determination false |",
] {
assert!(status.contains(row), "{row}\n{status}");
}
assert!(!status.contains("`fn[check_two]` | Valid"), "{status}");
assert!(
status.contains("### `sites:requirements.rule/src/lib.rs#mod[inner]/fn[check_three]`"),
"{status}"
);
assert!(
status.contains("determination is false: It panics."),
"{status}"
);
let all = crate::status_markdown(root, true).unwrap();
assert!(
all.contains("| `requirements.rule` | `src/lib.rs` | `fn[check_two]` | Valid |"),
"{all}"
);
let info = crate::info_markdown(root, "requirements.rule").unwrap();
for text in [
"## Sites\n\n3 sites; the requirement does not apply to 1 of them.",
"| `src/lib.rs` | `fn[check_one]` | unknown | `none` | Missing |",
"| `src/lib.rs` | `fn[check_two]` | no | `true` | Valid |",
"| `src/lib.rs` | `mod[inner]/fn[check_three]` | yes | `false` | Determination false |",
] {
assert!(info.contains(text), "{text}\n{info}");
}
write_review(root, "fn[check_two]", json!({"applies":"yes"}));
let invalid = crate::status_markdown(root, false).unwrap();
assert!(
invalid.contains("| `requirements.rule` | `src/lib.rs` | `fn[check_two]` | Invalid |"),
"{invalid}"
);
assert!(invalid.contains("applies must be a Boolean"), "{invalid}");
write_review(root, "fn[check_two]", json!({}));
fs::write(
root.join("src/lib.rs"),
SOURCE.replace("fn check_two() {}", "fn check_two() { let changed = 1; }"),
)
.unwrap();
let stale = crate::status_markdown(root, false).unwrap();
assert!(
stale.contains("| `requirements.rule` | `src/lib.rs` | `fn[check_two]` | Invalid |"),
"{stale}"
);
assert!(
stale.contains("outline input changed: src/lib.rs fn[check_two]"),
"{stale}"
);
}
Input 19: outline tests/authoring_batch.rs fn[site_reviews_are_authored_by_requirement_and_orphans_deleted_by_all]
- File:
tests/authoring_batch.rs - Selector:
fn[site_reviews_are_authored_by_requirement_and_orphans_deleted_by_all] - Kind:
fn tests/authoring_batch.rs:1482–1593
// {test}`requirements.references.site_review`
// {test}`requirements.authoring.batch`
// {test}`requirements.authoring.refresh`
#[test]
fn site_reviews_are_authored_by_requirement_and_orphans_deleted_by_all() {
let server = Server::start(false, None);
let fixture = Fixture::new(&server.endpoint, None);
let chapter = fs::read_to_string(fixture.project.join("md/requirements.md")).unwrap();
fs::write(
fixture.project.join("md/requirements.md"),
format!(
"{chapter}\n:::::{{req}} spread\nEach public function MUST return a constant.\n\n::::{{sites}} public\n```yaml\nlanguage: rust\nrule: {{ kind: function_item, regex: \"^pub fn (alpha|beta)\" }}\nmatch: [\"pub fn alpha() {{}}\"]\nno_match: [\"fn alpha() {{}}\"]\n```\n::::\n:::::\n"
),
)
.unwrap();
let output = fixture.run(&["author", "sites:requirements.spread"]);
assert!(
output.status.success(),
"{}",
String::from_utf8_lossy(&output.stderr)
);
let mut subjects = server.subjects();
subjects.sort();
assert_eq!(subjects, ["src/lib.rs fn[alpha]", "src/lib.rs fn[beta]"]);
let review = fixture
.project
.join("evidence/sites/requirements.spread/src/lib.rs/fn[alpha].json");
let record: Value = serde_json::from_str(&fs::read_to_string(&review).unwrap()).unwrap();
assert_eq!(record["applies"], true);
assert_eq!(record["queries"], json!(["public"]));
// Current reviews are kept; an unknown requirement is an error.
let output = fixture.run(&["author", "sites:requirements.spread"]);
assert!(output.status.success());
assert_eq!(server.subjects().len(), 2);
// A single named site review that is current is kept under `--missing`,
// the default, without a model or configuration.
fs::write(&fixture.config, "not toml [").unwrap();
let site = "sites:requirements.spread/src/lib.rs#fn[alpha]";
for args in [&["author", site][..], &["author", site, "--missing"]] {
let output = fixture.run(args);
assert!(
output.status.success(),
"{args:?}: {}",
String::from_utf8_lossy(&output.stderr)
);
assert_eq!(
String::from_utf8_lossy(&output.stdout).trim(),
format!("{site}: evidence is current; 1 skipped as current (use --force to reassess)")
);
}
assert_eq!(server.subjects().len(), 2, "no model was invoked");
fs::write(&fixture.config, &fixture.config_text).unwrap();
let mut before: Value = serde_json::from_slice(&fs::read(&review).unwrap()).unwrap();
before["rationale"] = json!("CURRENT_RECORD_BEFORE_FORCE");
fs::write(&review, before.to_string()).unwrap();
let output = fixture.run(&["author", site, "--force"]);
assert!(output.status.success(), "{output:?}");
assert_eq!(server.subjects().len(), 3);
assert!(review.exists());
assert_eq!(
serde_json::from_slice::<Value>(&fs::read(&review).unwrap()).unwrap()["item"],
"fn[alpha]"
);
assert!(
!fs::read_to_string(&review)
.unwrap()
.contains("CURRENT_RECORD_BEFORE_FORCE")
);
let output = fixture.run(&["author", "--all", "--force"]);
assert!(output.status.success(), "{output:?}");
assert_eq!(server.subjects().len(), 12);
assert_eq!(
server
.subjects()
.iter()
.filter(|s| *s == "src/lib.rs fn[alpha]")
.count(),
3
);
assert_eq!(
server
.subjects()
.iter()
.filter(|s| *s == "src/lib.rs fn[beta]")
.count(),
2
);
let output = fixture.run(&["author", "sites:requirements.alpha"]);
assert!(!output.status.success());
assert!(
String::from_utf8_lossy(&output.stderr).contains("no distributed requirement"),
"{}",
String::from_utf8_lossy(&output.stderr)
);
// `--all` deletes a review whose site is gone, without configuration.
let orphan = fixture
.project
.join("evidence/sites/requirements.spread/src/lib.rs/fn[gone].json");
fs::write(&orphan, "{}").unwrap();
fs::remove_file(&fixture.config).unwrap();
let output = fixture.run(&["author", "--all"]);
assert!(!orphan.exists());
assert!(
String::from_utf8_lossy(&output.stderr).contains(
"Deleted orphaned review evidence/sites/requirements.spread/src/lib.rs/fn[gone].json"
),
"{}",
String::from_utf8_lossy(&output.stderr)
);
assert!(review.exists());
}
Referenced definitions
Input 2: requirements selection requirements.references.distributed
requirements.references.distributed:md/requirements/references.md:472–519
:::{req} distributed
A requirement MAY be distributed: it states obligations that each of many sites
in the sources must uphold on its own, such as a convention every validation
function follows, and MAY also state obligations that particular code carries
out, which that code implements with `{impl}`. A `{req}` body declares a distributed requirement
by containing one or more nested query directives: `:::{sites} <name>` for a
site query, which finds the places the obligation applies, or
`:::{violations} <name>` for a violation query, which finds constructs likely to
break it. A requirement with a violation query MUST also have a site query.
Query names MUST be single identifier segments under
{cite}`requirements.ci.identifiers`, unique within the requirement. A query
directive outside a `{req}` body MUST be a validation error. Each query body
MUST be one fenced `yaml` code block containing a mapping with only these keys:
- `language`, required: the name of an outline profile with a grammar under
{cite}`requirements.references.outlines`: `rust`, `python`, `typescript`,
`tsx`, `css`, `markdown`, `toml`, or `yaml`.
- `paths`, optional: project-relative files or directories. Only sources at or
under one of them are searched; without it, every source of the language is.
- `exclude`, optional: project-relative files or directories whose sources are
not searched, even under `paths`.
- `rule`, required, with optional `utils` and `constraints`: an ast-grep rule
core in the syntax of Habeas's pinned `ast-grep-config` version, matched
against the language's pinned grammar.
- `within`, required for violation queries and not allowed for site queries:
the name of a site query in the same requirement.
- `match` and `no_match`, required: nonempty lists of source snippets in the
query's language. Each `match` snippet MUST contain at least one match of the
query, and each `no_match` snippet none, where a violation query counts only matches inside a site of its `within` query in the same snippet.
Validation MUST report a query whose body is not such a mapping, whose rule does
not compile, whose `within` names no site query of the requirement, a violation query without `within`, or one of whose snippets fails to parse or has the wrong match result, and a site query
that matches nothing in the project. Queries MUST search exactly the sources
reference discovery considers under {cite}`requirements.references.discovery`, in
their original text.
A match's site MUST be the innermost outline node, under
{cite}`requirements.references.outlines`, whose range contains the match; for a violation query, it MUST instead be the innermost site of its `within` query that contains the match, and a match inside none of that query's
sites MUST be discarded. A requirement's sites MUST be the distinct sites of all
its queries' matches. Each site MUST have a site review under
{cite}`requirements.references.site_review`, and needs no reference to the
requirement; being a site MUST NOT count as a reference for
{cite}`requirements.references.rust_item_coverage`, because a distributed
requirement concerns a cross-cutting obligation, not why the item exists.
Upgrading `ast-grep-config` MAY change matches and MUST be treated as a
deliberate change. The book MUST render each query directive as a badge
naming its kind and name, followed by its code block.
:::
Input 3: 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 4: requirements selection requirements.authoring.site_prompt
requirements.authoring.site_prompt:md/requirements/authoring.md:408–491
:::{req} site_prompt
A site review under {cite}`requirements.references.site_review` MUST use the
same tools and exactly-once submission rule as other assessments, except that
`submit_judgment` MUST also require an `applies: Boolean` field, recorded as the
review's `applies`; a submission with `applies` false and a determination other
than `true` MUST be invalid. It MUST use this prompt, replacing
`{{requirement_name}}`, `{{site_file}}`, `{{site_selector}}`, `{{matches}}` (a
JSON array giving, for each query match at the site, the query's kind, `sites`
or `violations`, its name, and the selector, under
{cite}`requirements.references.outline_selectors`, of the innermost outline node
containing the match, but no line numbers, and for a violation match its
matched source text),
`{{habeas_background}}` under {cite}`requirements.authoring.habeas_background`,
`{{distributed_background}}` under
{cite}`requirements.authoring.habeas_background`, `{{judgment_rules}}` under
{cite}`requirements.authoring.judgment_rules`, and
`{{mandatory_inputs}}`, the first block as its system prompt and the second as
its subject message under {cite}`requirements.authoring.prompt_parts`:
```text
# Task
Review one site of a distributed requirement. Your determination should be the
one any careful reviewer would reach from the same text and sources.
# Background: Habeas terms
{{habeas_background}}
{{distributed_background}}
# Your task
The mandatory inputs at the end contain the site, the requirement, and the
declarations it cites.
The requirement may also state obligations that particular code carries out;
those, and the requirement's tests, are assessed with the requirement, not here.
A site needs no {impl} or {test} reference and no tests of its own. Do not
assess the site against other requirements, and do not assess the queries, the
site's callers, or other sites.
1. Decide applies from the requirement's text describing its sites, not from
which query matched; a violation match alone does not make the requirement
apply. Read the site's callers only when its own code does not settle whether
the text describes it. Set applies to true when the best-supported reading of
that text, or one its wording supports equally well, governs the site.
Otherwise set applies to false and determination to true, and explain in your
rationale why the requirement does not apply.
2. If applies is true, judge the site: each obligation the requirement states
for its sites that the site does not meet is a gap. Violation matches are
leads, not verdicts: judge each one listed above, saying whether it breaks
the requirement here and why, but a match may be harmless and the site may
break the requirement without one.
3. Follow code the site calls only as far as needed to decide the site's
behavior under the requirement, and do not judge that code on its own
account.
# How to judge
{{judgment_rules}}
# Submitting
Choose true when your task finds no gap, {"FIXME": ["..."]} when every gap is
acknowledged, and false otherwise. You MUST end by calling submit_judgment
with applies, determination, and rationale until one submission is accepted.
A rejected submission does not complete the assessment. A judgment written in
your reply text is not accepted.
```
```text
# Subject
Site under review: {{site_file}} {{site_selector}}
Requirement: {{requirement_name}}
Matches: {{matches}}
Judge against: the obligations the requirement states for each of its sites.
# Mandatory inputs
{{mandatory_inputs}}
```
:::
Input 5: requirements selection requirements.authoring.mandatory_inputs
requirements.authoring.mandatory_inputs:md/requirements/authoring.md:1285–1297
:::{req} mandatory_inputs
The harness MUST construct each assessment's mandatory input set by combining
the contributions specified by the requirements applicable to that subject and
its inputs. A requirement that contributes inputs MUST cite this requirement and
define which sources it contributes and when. The harness MUST include every
applicable contribution, deduplicate identical selections, and report
unresolvable mandatory inputs before inference. The complete set MUST be supplied
in the initial model request.
Generated output under project-root `evidence/`, including symlink aliases, MUST
be omitted from mandatory inputs when the default exclusion applies. An explicit
workspace allow MUST permit those selections; an explicit disallow MUST abort
under {cite}`requirements.authoring.read_denial.mandatory`.
:::
Input 6: requirements selection requirements.ci.outcomes
requirements.ci.outcomes:md/requirements/ci.md:112–149
:::{req} outcomes
Every assessment judgment MUST use one of these outcomes, applying
{cite}`requirements.ci.review_criteria`:
- `true`: the reviewed tests adequately check a requirement or example under
{cite}`requirements.ci.review_criteria`, including applicable testing
exemptions and obligations assessed by a refining requirement or a site's
own review. For a citation or site review, the review finds no gap under its
own task.
- `false`: the sources do not support the subject, or information is missing,
and the gaps are not all acknowledged by `{fixme}` references to it.
- `FIXME`: some aspects remain unmet or untested, and `{fixme}` references to
the subject acknowledge every one of those gaps. The reviewer MUST explain the
gaps and their source locations in the rationale and record their issue
references or other identifying content from the supplied acknowledgments or
inputs.
The JSON `determination` MUST be `true`, `false`, or an object containing exactly
`"FIXME"` with a nonempty array of nonempty strings, such as
`{"FIXME": ["example/queue#125", "rust-lang/rust#123"]}`. A gap MUST count as
acknowledged only by a `{fixme}` reference under
{cite}`requirements.references.roles` whose body describes that gap and that
references the assessed definition, or, for a site review, the distributed requirement from within that site; a citation review MUST NOT accept a `{fixme}`; a plain
`FIXME` comment, another marker such as `TODO`, or prose MUST NOT. The strings
MUST list each distinct issue reference the acknowledging `{fixme}` references
name in their option lines, as written after `:github:`, and, for a `{fixme}`
naming no issue, its body's words, without comment delimiters, joined by single
spaces. A `{fixme}` reference describing a gap that the review establishes no
longer exists within its task's scope MUST itself be treated as a gap. A reference
describing only an implementation defect MUST NOT create a test-adequacy gap or
require implementation review; it MUST acknowledge a testing gap only when its
body describes that same gap. A `{fixme}` naming a GitHub issue that
{cite}`requirements.authoring.github_reads` reports closed MUST NOT count as
acknowledging its gap. A FIXME judgment MUST be grounded in recorded evidence
inputs or, for an acknowledgment supplied under
{cite}`requirements.authoring.fixme_inputs`, the reference-set digest covering
that acknowledgment.
:::
Input 7: requirements selection requirements.authoring.refresh
requirements.authoring.refresh:md/requirements/authoring.md:62–73
:::{req} refresh
Every `habeas author` form MUST accept `--missing` and `--force`, which are
mutually exclusive; `--missing` MUST be the default. Under `--missing`, the
command MUST assess only the selected subjects whose evidence is missing, stale,
or invalid, and MUST preserve every current record without invoking a model,
including accepted FIXME judgments and current false judgments; a current false
judgment is reassessed only when its subject or inputs change or `--force` is
given. Under `--force`, the command MUST assess every selected subject. `--stdout`
MUST imply `--force`, because it writes no evidence. The command MUST report the
number of selected subjects it skipped as current. When no assessment is needed,
the command MUST succeed without resolving model configuration or credentials.
:::
Other sources
Input 1: 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.
:::