requirements.refactor.record_files
Requirements index · View definition
Requirement
For each changed record,
habeas refactorMUST move its evidence file, citation review file under, or site review file under
to the path its mapped subject, file, and selector determine. It MUST NOT overwrite an existing file; it MUST leave that record unchanged and report the conflict.
Rationale
The tests adequately check requirements.refactor.record_files. I found no gaps.
Obligations derived from the text
- A changed evidence file moves to the path its mapped subject determines.
- A changed citation review file moves to the path its mapped file and selector determine.
- A changed site review file moves to the path its mapped requirement, file, and selector determine.
- A move MUST NOT overwrite an existing file.
- On such a conflict, the record is left unchanged and the conflict is reported.
Coverage
- Evidence move:
tests/refactor.rs#fn[a_moved_requirement_renames_its_references_and_evidence]mapsrules.loadtocore.load. It asserts the report lineevidence/rules.load.json -> evidence/core.load.json. It asserts the old file is gone and the new one has the right content. A snapshot diff shows only the expected files changed. - Example evidence move:
tests/refactor.rs#fn[a_moved_example_rewrites_its_example_field]moves example evidence toevidence/examples.loading.json. - Citation review move:
tests/refactor.rs#fn[a_citation_review_follows_its_item_and_the_name_it_cites]moves the item to another file and renames the cited requirement. It asserts the report line movingevidence/citations/src/config.rs/fn[helper].jsontoevidence/citations/src/helper.rs/fn[helper].json. It asserts the old directory is gone and the moved record equals the expected content. - Site review move:
src/refactor/tests.rs#fn[site_reviews_follow_their_site_and_renamed_requirement]renames the requirement and moves the site to another file. The new path isevidence/sites/rules.rule/src/other.rs/fn[check_two].json. The test asserts the report line, the new file’srequirement,fileanditemfields, and that the old requirement directory is gone. It also asserts the site errors stay empty. - Refused overwrite:
tests/refactor.rs#fn[a_rename_onto_an_existing_record_is_refused]pre-creates the target. It asserts the conflict is reported as... would be overwritten. It asserts the existing file’s content is untouched and the source record still exists. - Cascading refusal:
tests/refactor.rs#fn[a_move_onto_a_record_whose_own_move_is_refused_is_refused_too]covers a conflict that exposes a second one. It asserts both conflicts are reported. It uses a before/after snapshot to show all three involved records are unchanged.
Residual points
- Conflict detection is only exercised on evidence files. The citation and site review moves share the generic conflict loop in
src/refactor.rs#fn[refactor], which works on record paths regardless of kind. The text does not distinguish the kinds for the no-overwrite rule, so I did not treat this as a separate scenario needing its own test. - The
%2Fencoding of nested selectors in a moved path is not exercised. The text does not single it out as a boundary for this requirement, and the encoding is defined under the citation review requirement.
Inputs
Implementation
Input 10: outline src/refactor.rs fn[refactor]
- File:
src/refactor.rs - Selector:
fn[refactor] - Kind:
fn src/refactor.rs:1122–1240
/// Runs `habeas refactor` with `--map` values, reporting what it changed,
/// or with `dry_run`, what it would change.
// {impl}`requirements.refactor.command`
// {impl}`requirements.refactor.dry_run`
// {impl}`requirements.refactor.record_files`
// {impl}`requirements.refactor.equivalence`
// {impl}`requirements.refactor.rationale.untouched`
pub fn refactor(root: &Path, values: &[String], dry_run: bool) -> Result<String, RefactorError> {
let root = fs::canonicalize(root)?;
let records = load_records(&root)?;
let mappings = parse_mappings(&root, values, &records)?;
let states = States::compute(&root, mappings)?;
let mut changed = Vec::new();
let mut unchanged = Vec::new();
let mut targets = BTreeMap::<String, usize>::new();
for (path, record) in &records {
match rewrite_record(&states, path, record)? {
Outcome::Unaffected => {}
Outcome::Unchanged(reason) => unchanged.push((path.clone(), reason)),
Outcome::Changed {
path: target,
value,
mentions,
} => {
*targets.entry(target.clone()).or_default() += 1;
changed.push((path.clone(), target, value, mentions));
}
}
}
// A move may take the place of a record that moves away, but only if
// that record's move survives: dropping one conflict can expose another,
// so conflicts are dropped until none remain.
loop {
let moving = changed
.iter()
.filter(|(path, target, ..)| path != target)
.map(|(path, ..)| path.clone())
.collect::<BTreeSet<_>>();
let before = changed.len();
changed.retain(|(path, target, ..)| {
let conflict = targets[target] > 1
|| (path != target && root.join(target).exists() && !moving.contains(target));
if conflict {
unchanged.push((path.clone(), format!("{target} would be overwritten")));
}
!conflict
});
if changed.len() == before {
break;
}
}
unchanged.sort();
if !dry_run {
for (file, (content, _)) in &states.rewritten {
fs::write(root.join(file), content)?;
}
for (path, ..) in &changed {
if !changed.iter().any(|(_, target, ..)| target == path) {
let old = root.join(path);
if fs::remove_file(&old).is_ok() {
prune(&root, &old);
}
}
}
for (_, target, value, _) in &changed {
let target = root.join(target);
if let Some(parent) = target.parent() {
fs::create_dir_all(parent)?;
}
fs::write(
&target,
format!(
"{}\n",
serde_json::to_string_pretty(value).map_err(io::Error::from)?
),
)?;
}
}
let (rewrote, change, leave) = if dry_run {
("Would rewrite", "Would change", "Would leave")
} else {
("Rewrote", "Changed", "Left")
};
let mut report = String::new();
if !states.rewritten.is_empty() {
let _ = writeln!(
report,
"{rewrote} references or anchors in {} files:",
states.rewritten.len()
);
for (file, (_, edits)) in &states.rewritten {
let _ = writeln!(report, "- {file} ({edits})");
}
}
let _ = writeln!(report, "{change} {} records:", changed.len());
for (path, target, _, mentions) in &changed {
if path == target {
let _ = writeln!(report, "- {path}");
} else {
let _ = writeln!(report, "- {path} -> {target}");
}
for mention in mentions {
let _ = writeln!(report, " - review the rationale's {mention}");
}
}
if !unchanged.is_empty() {
let _ = writeln!(
report,
"{leave} {} records unchanged; they stay stale until reassessed:",
unchanged.len()
);
for (path, reason) in &unchanged {
let _ = writeln!(report, "- {path}: {reason}");
}
}
Ok(report)
}
Tests
Input 4: outline src/refactor/tests.rs fn[site_reviews_follow_their_site_and_renamed_requirement]
- File:
src/refactor/tests.rs - Selector:
fn[site_reviews_follow_their_site_and_renamed_requirement] - Kind:
fn src/refactor/tests.rs:249–320
// {test}`requirements.refactor.record_files`
// {test}`requirements.refactor.record_fields`
// {test}`requirements.refactor.equivalence`
#[test]
fn site_reviews_follow_their_site_and_renamed_requirement() {
use crate::sites::tests::{RULE, SOURCE, inspect, project, write_review};
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_one]",
json!({"queries": ["checkers", "panics"]}),
);
write_review(root, "fn[check_two]", json!({}));
write_review(
root,
"mod[inner]/fn[check_three]",
json!({"queries": ["checkers", "panics"]}),
);
let site_errors = |root: &Path| {
let (errors, _) = inspect(root);
errors
.into_iter()
.filter(|error| error.starts_with("evidence/sites/"))
.collect::<Vec<_>>()
};
assert_eq!(site_errors(root), Vec::<String>::new());
// The requirement moves to the `rules` chapter and `check_two` to its
// own file, both unchanged.
let chapter = fs::read_to_string(root.join("md/requirements.md")).unwrap();
fs::remove_file(root.join("md/requirements.md")).unwrap();
fs::write(root.join("md/rules.md"), chapter).unwrap();
fs::write(
root.join("src/lib.rs"),
SOURCE.replace("fn check_two() {}\n", ""),
)
.unwrap();
fs::write(root.join("src/other.rs"), "fn check_two() {}\n").unwrap();
let report = refactor(
root,
&[
"requirements.rule=rules.rule".to_owned(),
"src/lib.rs#fn[check_two]=src/other.rs#fn[check_two]".to_owned(),
],
false,
)
.unwrap();
assert!(
report.contains(
"- evidence/sites/requirements.rule/src/lib.rs/fn[check_two].json -> evidence/sites/rules.rule/src/other.rs/fn[check_two].json"
),
"{report}"
);
let moved: Value = serde_json::from_str(
&fs::read_to_string(root.join("evidence/sites/rules.rule/src/other.rs/fn[check_two].json"))
.unwrap(),
)
.unwrap();
assert_eq!(moved["requirement"], "rules.rule");
assert_eq!(moved["file"], "src/other.rs");
assert_eq!(moved["item"], "fn[check_two]");
assert!(!root.join("evidence/sites/requirements.rule").exists());
assert_eq!(site_errors(root), Vec::<String>::new());
}
Input 5: outline tests/refactor.rs fn[a_moved_requirement_renames_its_references_and_evidence]
- File:
tests/refactor.rs - Selector:
fn[a_moved_requirement_renames_its_references_and_evidence] - Kind:
fn tests/refactor.rs:276–366
// {test}`requirements.refactor.moved_requirement`
// {test}`requirements.refactor.reference_rewrite`
// {test}`requirements.refactor.record_files`
// {test}`requirements.refactor.definition_inputs`
// {test}`requirements.refactor.subject_text`
// {test}`requirements.refactor.rationale.names`
// {test}`requirements.refactor.command`
// {test}`requirements.refactor.mappings`
#[test]
fn a_moved_requirement_renames_its_references_and_evidence() {
let temp = project();
let root = temp.path();
author(root);
fs::write(
root.join("md/notes.md"),
"Loading follows {cite}`rules.load`.\n",
)
.unwrap();
// `load` moves to the `core` chapter; references still name the old name.
fs::write(
root.join("md/rules.md"),
"# Rules\n\n:::{req} check\n:impl: data.txt\nThe data MUST be checked.\n:::\n",
)
.unwrap();
fs::write(
root.join("md/core.md"),
"# Core\n\n:::{req} load\nConfiguration MUST load.\n:::\n",
)
.unwrap();
let before = snapshot(root);
let output = refactor(root, &["--map", "rules.load=core.load"]);
assert!(output.status.success(), "{output:?}");
let report = stdout(&output);
assert!(report.contains("- src/config.rs (2)"), "{report}");
assert!(report.contains("- md/notes.md (1)"), "{report}");
assert_eq!(
fs::read_to_string(root.join("md/notes.md")).unwrap(),
"Loading follows {cite}`core.load`.\n"
);
// Only the rewritten references and the moved evidence changed.
let after = snapshot(root);
let differing = before
.keys()
.chain(after.keys())
.filter(|file| before.get(*file) != after.get(*file))
.cloned()
.collect::<std::collections::BTreeSet<_>>();
assert_eq!(
differing.into_iter().collect::<Vec<_>>(),
[
"evidence/core.load.json",
"evidence/rules.load.json",
"md/notes.md",
"src/config.rs",
]
);
assert!(
report.contains("- evidence/rules.load.json -> evidence/core.load.json"),
"{report}"
);
// The glob no longer matches what it recorded, so that record is stale.
assert!(
report.contains(
"- evidence/rules.check.json: inputs[0]: rules.* no longer selects what it recorded"
),
"{report}"
);
assert!(!root.join("evidence/rules.load.json").exists());
let source = fs::read_to_string(root.join("src/config.rs")).unwrap();
assert!(source.contains("// {impl}`core.load`") && source.contains("// {test}`core.load`"));
let record: Value =
serde_json::from_str(&fs::read_to_string(root.join("evidence/core.load.json")).unwrap())
.unwrap();
assert_eq!(
record["inputs"][0],
requirements_input("core.load", &["core.load"], &LOAD_TEXT)
);
assert!(
record["rationale"]
.as_str()
.unwrap()
.contains("as `core.load` asks")
);
let remaining = errors(root);
assert!(
remaining
.iter()
.all(|error| error.starts_with("evidence/rules.check.json")),
"{remaining:#?}"
);
}
Input 6: outline tests/refactor.rs fn[a_rename_onto_an_existing_record_is_refused]
- File:
tests/refactor.rs - Selector:
fn[a_rename_onto_an_existing_record_is_refused] - Kind:
fn tests/refactor.rs:488–518
// {test}`requirements.refactor.record_files`
#[test]
fn a_rename_onto_an_existing_record_is_refused() {
let temp = project();
let root = temp.path();
author(root);
fs::write(
root.join("md/rules.md"),
"# Rules\n\n:::{req} check\n:impl: data.txt\nThe data MUST be checked.\n:::\n",
)
.unwrap();
fs::write(
root.join("md/core.md"),
"# Core\n\n:::{req} load\nConfiguration MUST load.\n:::\n",
)
.unwrap();
fs::write(root.join("evidence/core.load.json"), "{}\n").unwrap();
let output = refactor(root, &["--map", "rules.load=core.load"]);
assert!(output.status.success(), "{output:?}");
assert!(
stdout(&output)
.contains("- evidence/rules.load.json: evidence/core.load.json would be overwritten"),
"{}",
stdout(&output)
);
assert_eq!(
fs::read_to_string(root.join("evidence/core.load.json")).unwrap(),
"{}\n"
);
assert!(root.join("evidence/rules.load.json").exists());
}
Input 7: outline tests/refactor.rs fn[a_citation_review_follows_its_item_and_the_name_it_cites]
- File:
tests/refactor.rs - Selector:
fn[a_citation_review_follows_its_item_and_the_name_it_cites] - Kind:
fn tests/refactor.rs:569–653
// {test}`requirements.refactor.record_files`
// {test}`requirements.refactor.record_fields`
// {test}`requirements.refactor.equivalence`
#[test]
fn a_citation_review_follows_its_item_and_the_name_it_cites() {
let temp = project();
let root = temp.path();
let cited = format!(
"{}\n// {{cite}}`rules.load`\nfn helper() {{}}\n",
config_source("")
);
fs::write(root.join("src/config.rs"), &cited).unwrap();
author(root);
let review = |root: &Path, file: &str, name: &str, text: &[&str]| {
json!({
"file": file,
"item": "fn[helper]",
"citations": [{"role": "cite", "name": name, "commentary": ""}],
"determination": true,
"rationale": format!("`{file}#fn[helper]` relies on `{name}`."),
"inputs": [
habeas::outline_input(root, file, "fn[helper]").unwrap(),
requirements_input(name, &[name], text),
],
})
};
fs::create_dir_all(root.join("evidence/citations/src/config.rs")).unwrap();
fs::write(
root.join("evidence/citations/src/config.rs/fn[helper].json"),
serde_json::to_string_pretty(&review(root, "src/config.rs", "rules.load", &LOAD_TEXT))
.unwrap(),
)
.unwrap();
assert_eq!(errors(root), Vec::<String>::new());
// The helper moves to its own file, and `load` to the `core` chapter.
fs::write(root.join("src/config.rs"), config_source("")).unwrap();
fs::write(
root.join("src/helper.rs"),
"// {cite}`rules.load`\nfn helper() {}\n",
)
.unwrap();
fs::write(
root.join("md/rules.md"),
"# Rules\n\n:::{req} check\n:impl: data.txt\nThe data MUST be checked.\n:::\n",
)
.unwrap();
fs::write(
root.join("md/core.md"),
"# Core\n\n:::{req} load\nConfiguration MUST load.\n:::\n",
)
.unwrap();
let output = refactor(
root,
&[
"--map",
"src/config.rs#fn[helper]=src/helper.rs#fn[helper]",
"--map",
"rules.load=core.load",
],
);
assert!(output.status.success(), "{output:?}");
assert!(
stdout(&output).contains(
"- evidence/citations/src/config.rs/fn[helper].json -> evidence/citations/src/helper.rs/fn[helper].json"
),
"{}",
stdout(&output)
);
assert!(!root.join("evidence/citations/src/config.rs").exists());
let moved: Value = serde_json::from_str(
&fs::read_to_string(root.join("evidence/citations/src/helper.rs/fn[helper].json")).unwrap(),
)
.unwrap();
assert_eq!(
moved,
review(root, "src/helper.rs", "core.load", &LOAD_TEXT)
);
let remaining = errors(root);
assert!(
remaining
.iter()
.all(|error| error.starts_with("evidence/rules.check.json")),
"{remaining:#?}"
);
}
Input 8: outline tests/refactor.rs fn[a_move_onto_a_record_whose_own_move_is_refused_is_refused_too]
- File:
tests/refactor.rs - Selector:
fn[a_move_onto_a_record_whose_own_move_is_refused_is_refused_too] - Kind:
fn tests/refactor.rs:670–729
// {test}`requirements.refactor.record_files`
#[test]
fn a_move_onto_a_record_whose_own_move_is_refused_is_refused_too() {
let temp = project();
let root = temp.path();
// `core.load` exists, with evidence of its own.
fs::write(
root.join("md/core.md"),
"# Core\n\n:::{req} load\nConfiguration MUST load.\n:::\n",
)
.unwrap();
author(root);
write_evidence(
root,
"core.load",
"Fine.",
vec![requirements_input("core.load", &["core.load"], &LOAD_TEXT)],
);
// `rules.load` becomes `core.load`, and `core.load` becomes `next.load`,
// whose evidence path is already taken.
fs::write(
root.join("md/rules.md"),
"# Rules\n\n:::{req} check\n:impl: data.txt\nThe data MUST be checked.\n:::\n",
)
.unwrap();
fs::write(
root.join("md/next.md"),
"# Next\n\n:::{req} load\nConfiguration MUST load.\n:::\n",
)
.unwrap();
fs::write(root.join("evidence/next.load.json"), "{}\n").unwrap();
let before = snapshot(root);
let output = refactor(
root,
&[
"--map",
"rules.load=core.load",
"--map",
"core.load=next.load",
],
);
assert!(output.status.success(), "{output:?}");
let report = stdout(&output);
assert!(
report.contains("- evidence/core.load.json: evidence/next.load.json would be overwritten"),
"{report}"
);
assert!(
report.contains("- evidence/rules.load.json: evidence/core.load.json would be overwritten"),
"{report}"
);
let after = snapshot(root);
for file in [
"evidence/core.load.json",
"evidence/next.load.json",
"evidence/rules.load.json",
] {
assert_eq!(after.get(file), before.get(file), "{file}");
}
}
Input 9: outline tests/refactor.rs fn[a_moved_example_rewrites_its_example_field]
- File:
tests/refactor.rs - Selector:
fn[a_moved_example_rewrites_its_example_field] - Kind:
fn tests/refactor.rs:1090–1162
// {test}`requirements.refactor.subject_text`
// {test}`requirements.refactor.record_files`
#[test]
fn a_moved_example_rewrites_its_example_field() {
let temp = project();
let root = temp.path();
author(root);
// The role's brace is an argument, so this source holds no reference.
let body = |name: &str| format!("Loading works. {{cite}}`{name}`");
fs::write(
root.join("md/cases.md"),
format!(
"# Cases\n\n:::{{example}} loading\n{}\n:::\n",
body("rules.load")
),
)
.unwrap();
fs::write(
root.join("evidence/cases.loading.json"),
serde_json::to_string_pretty(&json!({
"example": body("rules.load"),
"determination": false,
"rationale": "No test covers `cases.loading`.",
"references": habeas::reference_set_digest_for(root, "cases.loading").unwrap(),
"inputs": [
requirements_input("cases.loading", &["cases.loading"], &[":::{example} loading", &body("rules.load"), ":::"]),
requirements_input("rules.load", &["rules.load"], &LOAD_TEXT),
],
}))
.unwrap(),
)
.unwrap();
let case_errors = |root: &Path| {
errors(root)
.into_iter()
.filter(|error| error.starts_with("evidence/cases."))
.collect::<Vec<_>>()
};
let before = case_errors(root);
// The example moves to the `examples` chapter.
fs::remove_file(root.join("md/cases.md")).unwrap();
fs::write(
root.join("md/examples.md"),
format!(
"# Examples\n\n:::{{example}} loading\n{}\n:::\n",
body("rules.load")
),
)
.unwrap();
let output = refactor(root, &["--map", "cases.loading=examples.loading"]);
assert!(output.status.success(), "{output:?}");
let record: Value = serde_json::from_str(
&fs::read_to_string(root.join("evidence/examples.loading.json")).unwrap(),
)
.unwrap();
assert_eq!(record["example"], body("rules.load"));
assert!(record.get("requirement").is_none());
// It fails validation exactly as before, under its new name.
let after = errors(root)
.into_iter()
.filter(|error| error.starts_with("evidence/examples."))
.map(|error| error.replace("examples.loading", "cases.loading"))
.collect::<Vec<_>>();
let before = before
.into_iter()
.map(|error| {
error
.replacen("evidence/cases.", "evidence/examples.", 1)
.replace("examples.loading", "cases.loading")
})
.collect::<Vec<_>>();
assert_eq!(after, before);
}
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.refactor.record_files
requirements.refactor.record_files:md/requirements/refactor.md:110–116
:::{req} record_files
For each changed record, `habeas refactor` MUST move its evidence file,
citation review file under {cite}`requirements.references.citation_review`, or
site review file under {cite}`requirements.references.site_review` to the path
its mapped subject, file, and selector determine. It MUST NOT overwrite an
existing file; it MUST leave that record unchanged and report the conflict.
:::