requirements.definitions.authoring_inputs
Requirements index · View definition
Requirement
When preparing the mandatory input set defined by
, every terminology definition referenced by the subject, any contributed source, or an acknowledgment supplied under
MUST contribute its complete fenced declaration, including its phrase option. Definitions referenced by those definitions MUST also be included transitively, without duplicates or nontermination on cycles.
When an additional source read introduces a terminology dependency, the same complete, transitive definition set MUST be supplied to the model and recorded before accepting a submission.
Rationale
The reviewed tests cover each obligation in requirements.definitions.authoring_inputs.
Initial mandatory inputs: definitions referenced by the subject, contributed sources and acknowledgments.
src/authoring/inputs.rs#mod[tests]/fn[bundle_combines_direct_references_terms_and_current_existing_selectors]covers terms reached from the subject’s own text. The subject citesterms.unit, andterms.unitandterms.valuereference each other. The test asserts that exactly two definition inputs are supplied. That shows the transitive closure is complete, has no duplicates, and terminates on the cycle.src/authoring/inputs.rs#mod[tests]/fn[mandatory_git_inputs_require_staging_declarations_sources_and_terms]covers terms referenced from a contributed source. A staged source with a{term}reference makesterms.readya mandatory definition input. An unstaged term file is reported as an error.src/authoring/inputs.rs#mod[tests]/fn[acknowledgment_only_terms_are_supplied_and_validated_without_implementation_reads]covers terms referenced only from an acknowledgment body. The{term}reference is toterms.boundary, which depends onterms.unit. The test asserts that both definitions’ text reaches the prompt. It also asserts that the implementation body is absent and that no outline input is created. The definitions are recorded, and evidence validation then detects a changed transitive definition and a missing definition input.
Declaration completeness, including the phrase option.
src/authoring/mod.rs#mod[tests]/fn[definitions_introduced_by_a_read_are_supplied_and_recorded_before_submission]asserts that each definition input’s text starts with:::{definition}followed by a:phrase:line.src/authoring/tools.rs#mod[tests]/fn[reading_records_only_delivered_sources_and_their_terms]asserts the full definition text. It checks thattext[1]equals:phrase: value.src/authoring/tools.rs#mod[tests]/fn[declaration_text_reaches_the_model_redacted]asserts the exact full declaration text ofterms.value. It also asserts that the definitions supplied for a requirement read,terms.baseandterms.value, are transitive and duplicate-free.
Terminology dependencies introduced by an additional source read.
- The test in
src/authoring/mod.rshas the model readfn[work], which referencesterms.value, a term in a cycle withterms.unit. It asserts that the recorded definitions are exactly["terms.unit", "terms.value"], once each. It asserts that the second request, which is the one before submission, delivers “A unit of” text, and that the first request did not contain it. reading_records_only_delivered_sources_and_their_termsandsrc/authoring/pages.rs#mod[tests]/fn[paged_inputs_carry_their_definitions_and_deliver_only_their_own_inputs]verify that line-range reads, item reads and paged reads carry and record their definitions.
No obligation is left without a test and assertion. The implementation was not needed to reach this conclusion.
Inputs
Tests
Input 4: outline src/authoring/inputs.rs mod[tests]/fn[acknowledgment_only_terms_are_supplied_and_validated_without_implementation_reads]
- File:
src/authoring/inputs.rs - Selector:
mod[tests]/fn[acknowledgment_only_terms_are_supplied_and_validated_without_implementation_reads] - Kind:
fn src/authoring/inputs.rs:877–953
// {test}`requirements.authoring.fixme_inputs`
// {test}`requirements.definitions.dependencies`
// {test}`requirements.ci.reference_set`
// {test}`requirements.definitions.authoring_inputs`
#[test]
fn acknowledgment_only_terms_are_supplied_and_validated_without_implementation_reads() {
let root = project();
let (path, configuration) = crate::execution_coverage::configure(root.path()).unwrap();
fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(path, configuration).unwrap();
fs::create_dir(root.path().join("evidence")).unwrap();
let terms = ":::{definition} unit\n:phrase: unit\nA unit.\n:::\n\n:::{definition} boundary\n:phrase: boundary\nA {term}`terms.unit` at the limit.\n:::\n";
fs::write(root.path().join("md/terms.md"), terms).unwrap();
let source = "// :::{fixme} requirements.ready\n// The {term}`terms.boundary` is untested.\n// :::\nfn gap() { panic!(\"IMPLEMENTATION_BODY\"); }\n";
fs::write(root.path().join("src/lib.rs"), source).unwrap();
let mut sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let prompt = super::super::initial_prompt(&sources).unwrap().joined();
assert!(prompt.contains("A unit."));
assert!(prompt.contains("at the limit."));
assert!(prompt.contains("is untested."));
assert!(!prompt.contains("IMPLEMENTATION_BODY"));
assert!(
!sources
.mandatory_inputs()
.iter()
.any(|input| input.get("item").is_some())
);
let mandatory = sources.mandatory_inputs().to_vec();
sources.record_inputs(&mandatory);
let record = json!({
"requirement": "The project MUST be ready.",
"determination": {"FIXME": ["The {term}`terms.boundary` is untested."]},
"rationale": "The boundary test is acknowledged as missing.",
"references": sources.reference_set,
"inputs": sources.recorded_inputs(),
});
let path = root.path().join("evidence/requirements.ready.json");
fs::write(&path, record.to_string()).unwrap();
let check = || {
crate::evidence::validate_repository(root.path())
.unwrap()
.errors
};
assert!(check().is_empty(), "{:?}", check());
// An unread body can change without changing the judgment's inputs.
fs::write(
root.path().join("src/lib.rs"),
source.replace("panic!(\"IMPLEMENTATION_BODY\")", "let _value = 1"),
)
.unwrap();
assert!(check().is_empty(), "{:?}", check());
// The acknowledgment introduces a real, transitive term dependency.
fs::write(
root.path().join("md/terms.md"),
terms.replace("A unit.", "A changed unit."),
)
.unwrap();
let errors = check().join("\n");
assert!(
errors.contains("input text changed for Definition { definition: \"terms.unit\" }"),
"{errors}"
);
fs::write(root.path().join("md/terms.md"), terms).unwrap();
let mut missing = record.clone();
missing["inputs"]
.as_array_mut()
.unwrap()
.retain(|input| input["definition"] != "terms.boundary");
fs::write(&path, missing.to_string()).unwrap();
let errors = check().join("\n");
assert!(
errors.contains("expected exactly one definition input for terms.boundary, found 0"),
"{errors}"
);
}
Input 5: outline src/authoring/inputs.rs mod[tests]/fn[bundle_combines_direct_references_terms_and_current_existing_selectors]
- File:
src/authoring/inputs.rs - Selector:
mod[tests]/fn[bundle_combines_direct_references_terms_and_current_existing_selectors] - Kind:
fn src/authoring/inputs.rs:955–1058
// {test}`requirements.authoring.complete_initial_bundle`
// {test}`requirements.authoring.mandatory_inputs`
// {test}`requirements.authoring_input`
// {test}`requirements.examples.authoring_inputs`
// {test}`requirements.references.authoring_inputs`
// {test}`requirements.definitions.authoring_inputs`
// {test}`requirements.ci.authoring_inputs`
// {test}`requirements.ci.reference_set`
#[test]
fn bundle_combines_direct_references_terms_and_current_existing_selectors() {
let root = project();
let terms = format!(
":::{{definition}} unit\n:phrase: unit\nA {}.\n:::\n\n:::{{definition}} value\n:phrase: value\nA {}.\n:::\n",
role("term", "terms.value"),
role("term", "terms.unit")
);
fs::write(root.path().join("md/terms.md"), terms).unwrap();
let declarations = format!(
":::{{req}} ready\nReady uses {} and {}.\n:::\n\n:::{{req}} base\nBase cites {}.\n:::\n\n:::{{req}} distant\nDistant MUST work.\n:::\n\n:::{{example}} case\nReady example. {} {}\n:::\n",
role("cite", "requirements.base"),
role("term", "terms.unit"),
role("cite", "requirements.distant"),
role("cite", "requirements.ready"),
role("test", "requirements.ready")
);
fs::write(root.path().join("md/requirements.md"), declarations).unwrap();
fs::write(root.path().join("src/lib.rs"), format!("struct Thing;\nimpl Thing {{\n // {}\n fn run(&self) {{}}\n fn unrelated(&self) {{}}\n}}\n// {}\nfn test_ready() {{}}\n", role("impl", "requirements.ready"), role("test", "requirements.ready"))).unwrap();
fs::write(root.path().join("notes.txt"), "new source text\n").unwrap();
fs::create_dir(root.path().join("evidence")).unwrap();
fs::write(
root.path().join("evidence/requirements.ready.json"),
json!({
"determination": false, "rationale": "old secret judgment",
"inputs": [{"file":"notes.txt", "line_start":1, "line_end":1, "text":["old text"]}]
})
.to_string(),
)
.unwrap();
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
// The recorded digest covers the same `{impl}` and `{test}` edges.
assert_eq!(
sources.reference_set,
crate::evidence::reference_set_digest_for(root.path(), "requirements.ready").unwrap()
);
let inputs = sources.mandatory_inputs();
assert!(sources.recorded_inputs().is_empty());
assert!(
!inputs
.iter()
.any(|input| input["item"] == "impl[Thing]/fn[run]")
);
assert!(inputs.iter().any(|input| input["item"] == "fn[test_ready]"));
assert!(!inputs.iter().any(|input| input["item"] == "impl[Thing]"));
assert!(
inputs
.iter()
.any(|input| input["requirements"] == "requirements.case")
);
assert!(
inputs
.iter()
.any(|input| input["requirements"] == "requirements.base")
);
assert!(
!inputs
.iter()
.any(|input| input["requirements"] == "requirements.distant")
);
assert_eq!(
inputs
.iter()
.filter(|input| input.get("definition").is_some())
.count(),
2
);
// Earlier evidence inputs are not carried forward.
assert!(!inputs.iter().any(|input| input["file"] == "notes.txt"));
assert!(
!serde_json::to_string(inputs)
.unwrap()
.contains("old secret judgment")
);
let example = AssessmentSources::prepare(root.path(), "requirements.case").unwrap();
assert!(matches!(
example.subject_kind,
AssessmentKind::Definition(DefinitionKind::Example, false)
));
assert_eq!(
example.mandatory_inputs()[0]["requirements"],
"requirements.case"
);
assert_eq!(
example.mandatory_inputs()[0]["text"],
json!([
":::{example} case",
format!(
"Ready example. {} {}",
role("cite", "requirements.ready"),
role("test", "requirements.ready")
),
":::"
])
);
}
Input 6: outline src/authoring/inputs.rs mod[tests]/fn[mandatory_git_inputs_require_staging_declarations_sources_and_terms]
- File:
src/authoring/inputs.rs - Selector:
mod[tests]/fn[mandatory_git_inputs_require_staging_declarations_sources_and_terms] - Kind:
fn src/authoring/inputs.rs:1120–1187
// {test}`requirements.authoring.source_tools`
// {test}`requirements.authoring.mandatory_inputs`
// {test}`requirements.definitions.authoring_inputs`
// {test}`requirements.authoring_input`
// {test}`requirements.references.authoring_inputs`
// {test}`requirements.authoring.read_denial`
// {test}`requirements.references.discovery`
#[test]
fn mandatory_git_inputs_require_staging_declarations_sources_and_terms() {
let root = project();
git(root.path(), &["init", "--quiet"]);
git(root.path(), &["add", "Cargo.toml", "book.toml"]);
let error = AssessmentSources::prepare(root.path(), "requirements.ready")
.err()
.unwrap();
assert!(
error.to_string().contains("md/requirements.md")
&& error.to_string().contains("git add"),
"{error}"
);
git(root.path(), &["add", "md"]);
fs::write(
root.path().join("src/lib.rs"),
format!(
"// {}\nfn ready() {{}}\n",
role("test", "requirements.ready")
),
)
.unwrap();
// Discovery does not consider an untracked source, so its reference is
// not yet an input; staging it makes the source mandatory.
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let supplied = serde_json::to_string(sources.mandatory_inputs()).unwrap();
assert!(!supplied.contains("src/lib.rs"), "{supplied}");
git(root.path(), &["add", "src"]);
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let supplied = serde_json::to_string(sources.mandatory_inputs()).unwrap();
assert!(supplied.contains("src/lib.rs"), "{supplied}");
fs::write(
root.path().join("md/terms.md"),
":::{definition} ready\n:phrase: ready\nReady to proceed.\n:::\n",
)
.unwrap();
fs::write(
root.path().join("src/lib.rs"),
format!(
"// {} {}\nfn ready() {{}}\n",
role("test", "requirements.ready"),
role("term", "terms.ready")
),
)
.unwrap();
let error = AssessmentSources::prepare(root.path(), "requirements.ready")
.err()
.unwrap();
assert!(
error.to_string().contains("md/terms.md") && error.to_string().contains("git add"),
"{error}"
);
git(root.path(), &["add", "md/terms.md"]);
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
assert!(
sources
.mandatory_inputs()
.iter()
.any(|input| input["definition"] == "terms.ready")
);
}
Input 7: outline src/authoring/mod.rs mod[tests]/fn[definitions_introduced_by_a_read_are_supplied_and_recorded_before_submission]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[definitions_introduced_by_a_read_are_supplied_and_recorded_before_submission] - Kind:
fn src/authoring/mod.rs:1859–1915
// {test}`requirements.definitions.authoring_inputs`
#[tokio::test]
async fn definitions_introduced_by_a_read_are_supplied_and_recorded_before_submission() {
let project = inputs::tests::project();
fs::write(
project.path().join("md/terms.md"),
format!(
":::{{definition}} value\n:phrase: value\nA {}.\n:::\n\n:::{{definition}} unit\n:phrase: unit\nA unit of {}.\n:::\n",
inputs::tests::role("term", "terms.unit"),
inputs::tests::role("term", "terms.value"),
),
)
.unwrap();
fs::write(
project.path().join("src/lib.rs"),
format!(
"// {}\nfn work() {{}}\n",
inputs::tests::role("term", "terms.value")
),
)
.unwrap();
let mut sources = AssessmentSources::prepare(project.path(), "requirements.ready").unwrap();
let state = tempfile::tempdir().unwrap();
let mut usage =
UsageLog::start(state.path(), project.path(), &sources.subject_name).unwrap();
let provider = ReadingProvider {
read: json!({"file": "src/lib.rs", "item": "fn[work]"}),
requests: RefCell::default(),
};
let (_, evidence) = assess(&provider, &mut sources, &mut usage).await.unwrap();
let definitions = evidence["inputs"]
.as_array()
.unwrap()
.iter()
.filter(|input| input.get("definition").is_some())
.collect::<Vec<_>>();
assert_eq!(
definitions
.iter()
.map(|input| input["definition"].as_str().unwrap())
.collect::<Vec<_>>(),
["terms.unit", "terms.value"],
"the transitive set, once each: {evidence}"
);
for input in &definitions {
let text = input["text"].as_array().unwrap();
assert!(text[0].as_str().unwrap().starts_with(":::{definition}"));
assert!(text[1].as_str().unwrap().starts_with(":phrase: "));
}
// The submission came after the definitions were delivered.
let requests = provider.requests.borrow();
assert_eq!(requests.len(), 2);
let delivered = requests[1].to_string();
assert!(delivered.contains("A unit of"), "{delivered}");
assert!(!requests[0].to_string().contains("A unit of"));
}
Input 8: outline src/authoring/pages.rs mod[tests]/fn[paged_inputs_carry_their_definitions_and_deliver_only_their_own_inputs]
- File:
src/authoring/pages.rs - Selector:
mod[tests]/fn[paged_inputs_carry_their_definitions_and_deliver_only_their_own_inputs] - Kind:
fn src/authoring/pages.rs:806–896
// {test}`requirements.authoring.result_pages`
// {test}`requirements.authoring.delivered_inputs`
// {test}`requirements.definitions.authoring_inputs`
// {test}`requirements.authoring.read_denial`
#[test]
// {test}`requirements.authoring.source_tools`
fn paged_inputs_carry_their_definitions_and_deliver_only_their_own_inputs() {
let root = project();
fs::write(
root.path().join("md/terms.md"),
":::{definition} value\n:phrase: value\nA useful value.\n:::\n",
)
.unwrap();
let term = role("term", "terms.value");
let mut source = String::new();
for index in 0..400 {
// Only the last function uses the term, so only its page needs it.
let comment = if index == 399 { term.as_str() } else { "plain" };
source.push_str(&format!(
"// {comment}\nfn needle_{index}() {{\n let text = \"padding padding padding\";\n}}\n\n"
));
}
fs::write(root.path().join("src/lib.rs"), source).unwrap();
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let mut pages = ResultPages::default();
let error = dispatch_paged(&sources, &mut pages, "next_page", &json!({}))
.err()
.unwrap();
assert!(
error.to_string().contains("token must be a string"),
"{error}"
);
let first = dispatch_paged(
&sources,
&mut pages,
"habeas",
&json!({"file":"src/lib.rs","line_start":1}),
)
.unwrap();
let delivered = all_pages(&mut pages, first);
let mut items = Vec::new();
for (number, page) in delivered.iter().enumerate() {
assert!(page.result.to_string().len() <= PAGE_LIMIT);
let inputs = page.result["inputs"].as_array().unwrap();
let definitions = page.result["definitions"].as_array().unwrap();
// A page's delivery is exactly its own inputs and definitions.
let mut expected = inputs.clone();
expected.extend(definitions.iter().cloned());
assert_eq!(page.inputs, expected);
let last = number == delivered.len() - 1;
assert_eq!(
definitions
.iter()
.any(|definition| definition["definition"] == "terms.value"),
last,
"page {number}: {definitions:?}"
);
items.extend(
inputs
.iter()
.map(|input| input["item"].as_str().unwrap().to_owned()),
);
}
let expected = (0..400)
.map(|index| format!("fn[needle_{index}]"))
.collect::<Vec<_>>();
assert_eq!(items, expected);
// A token is unknown to another assessment, and an unknown token is
// an explanatory tool error.
let token = delivered[0].result["page"]["next"].as_str().unwrap();
let mut other = ResultPages::default();
let error = other.next_page(token).err().unwrap();
assert!(error.to_string().contains("unknown page token"), "{error}");
let error = dispatch_paged(
&sources,
&mut pages,
"next_page",
&json!({"token":"not-a-token"}),
)
.err()
.unwrap();
assert!(
error.to_string().contains("valid only in the assessment"),
"{error}"
);
// A token's page comes back in the same shape when asked again.
let again =
dispatch_paged(&sources, &mut pages, "next_page", &json!({"token": token})).unwrap();
assert_eq!(again.result, delivered[1].result);
}
Input 9: outline src/authoring/tools.rs mod[tests]/fn[reading_records_only_delivered_sources_and_their_terms]
- File:
src/authoring/tools.rs - Selector:
mod[tests]/fn[reading_records_only_delivered_sources_and_their_terms] - Kind:
fn src/authoring/tools.rs:1532–1649
// {test}`requirements.authoring.source_tools`
// {test}`requirements.authoring.file_discovery`
// {test}`requirements.authoring.delivered_inputs`
// {test}`requirements.definitions.authoring_inputs`
// {test}`requirements.authoring.no_line_numbers`
#[test]
fn reading_records_only_delivered_sources_and_their_terms() {
let root = project();
fs::write(
root.path().join("md/terms.md"),
":::{definition} value\n:phrase: value\nA useful value.\n:::\n",
)
.unwrap();
fs::write(
root.path().join("src/lib.rs"),
format!("// {}\nfn work() {{}}\n", role("term", "terms.value")),
)
.unwrap();
let mut sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let listing = dispatch(&sources, "list_files", &json!({"path":"src"})).unwrap();
assert_eq!(listing.result, json!([{"path":"src/lib.rs","kind":"file"}]));
assert!(listing.inputs.is_empty());
let read = dispatch(
&sources,
"habeas",
&json!({"file":"src/lib.rs","item":"fn[work]"}),
)
.unwrap();
assert_eq!(read.inputs.len(), 2);
assert_eq!(read.result["input"]["item"], "fn[work]");
assert_eq!(read.result["input"]["kind"], "fn");
// Results give the selector, never line numbers.
assert!(read.result["input"].get("line_start").is_none());
assert!(read.result["input"].get("line_end").is_none());
assert_eq!(read.result["input"]["text"][1], "fn work() {}");
assert_eq!(read.result["definitions"][0]["definition"], "terms.value");
assert!(sources.recorded_inputs().is_empty());
sources.record_inputs(&read.inputs);
sources.record_inputs(&read.inputs);
assert_eq!(sources.recorded_inputs().len(), 2);
// Recorded outline inputs carry only the file, selector, and hash.
assert_eq!(
sources.recorded_inputs()[0],
crate::inputs::outline_input(root.path(), "src/lib.rs", "fn[work]").unwrap()
);
let eof = dispatch(
&sources,
"habeas",
&json!({"file":"src/lib.rs","line_start":2}),
)
.unwrap();
assert_eq!(eof.result["inputs"].as_array().unwrap().len(), 1);
assert_eq!(eof.result["inputs"][0]["item"], "fn[work]");
assert!(eof.result["inputs"][0].get("line_end").is_none());
// A line-range read supplies the terminology of what it delivers.
let fresh = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let lines = dispatch(
&fresh,
"habeas",
&json!({"file":"src/lib.rs","line_start":1}),
)
.unwrap();
assert_eq!(lines.result["definitions"][0]["definition"], "terms.value");
assert_eq!(lines.result["definitions"][0]["text"][1], ":phrase: value");
assert_eq!(lines.inputs.len(), 2);
assert!(
dispatch(
&sources,
"habeas",
&json!({"file":"src/lib.rs","line_start":3})
)
.is_err()
);
assert!(
dispatch(
&sources,
"habeas",
&json!({"file":"src/lib.rs","item":"fn[missing]"})
)
.is_err()
);
assert!(
dispatch(
&sources,
"habeas",
&json!({"file":"src/lib.rs","line_start":0})
)
.is_err()
);
// The provider-facing schema leaves selector fields optional; the
// harness still rejects incomplete, mixed, and unknown request forms.
for arguments in [
json!({}),
json!({"file":"src/lib.rs"}),
json!({"line_start":1}),
json!({"rust_file":"src/lib.rs","rust_item":"fn[work]"}),
json!({"item":"fn[work]"}),
json!({"file":"src/lib.rs","line_start":1,"definition":"terms.value"}),
json!({"file":"src/lib.rs","item":"fn[work]","line_start":1}),
json!({"file":"src/lib.rs","item":"fn[work]","requirements":"requirements.*"}),
json!({"requirements":"requirements.*","definition":"terms.value"}),
json!({"definition":"terms.value","extra":true}),
] {
assert!(
dispatch(&sources, "habeas", &arguments).is_err(),
"unexpectedly accepted {arguments}"
);
}
assert!(
dispatch(
&sources,
"habeas",
&json!({"requirements":"requirements.*"})
)
.is_ok()
);
assert!(dispatch(&sources, "habeas", &json!({"definition":"terms.value"})).is_ok());
}
Input 10: outline src/authoring/tools.rs mod[tests]/fn[declaration_text_reaches_the_model_redacted]
- File:
src/authoring/tools.rs - Selector:
mod[tests]/fn[declaration_text_reaches_the_model_redacted] - Kind:
fn src/authoring/tools.rs:1776–1898
// {test}`requirements.authoring.redaction`
// {test}`requirements.authoring.source_tools`
// {test}`requirements.authoring.delivered_inputs`
// {test}`requirements.definitions.authoring_inputs`
#[test]
fn declaration_text_reaches_the_model_redacted() {
let root = project();
let token = crate::redaction::tests::github_token();
fs::write(
root.path().join("md/terms.md"),
format!(":::{{definition}} value\n:phrase: value\nA value such as {token}, with a {}.\n:::\n\n:::{{definition}} base\n:phrase: base\nA foundation.\n:::\n", role("term", "terms.base")),
)
.unwrap();
fs::write(
root.path().join("md/requirements.md"),
format!(
":::{{req}} ready\nThe project MUST accept {token} as a {}.\n{}\n:::\n\n:::{{req}} other\nOther MUST reject\n{token}\non its own line.\n:::\n",
role("term", "terms.value"),
role("cite", "requirements.other"),
),
)
.unwrap();
git(root.path(), &["init", "--quiet"]);
git(root.path(), &["add", "."]);
// The subject, a cited requirement, and a term in the mandatory
// inputs and so the prompt, with their line structure kept.
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let mandatory = Value::Array(sources.mandatory_inputs().to_vec());
let text = mandatory.to_string();
assert!(!text.contains(&token), "{mandatory:#}");
for expected in [
"The project MUST accept [REDACTED:GitHub Token] as a",
"A value such as [REDACTED:GitHub Token], with a",
"\"Other MUST reject\",\"[REDACTED:GitHub Token]\",\"on its own line.\"",
] {
assert!(
text.contains(expected),
"missing {expected:?}: {mandatory:#}"
);
}
let prompt = super::super::initial_prompt(&sources).unwrap().joined();
assert!(!prompt.contains(&token), "{prompt}");
// Requirements and definition reads.
for arguments in [
json!({"requirements":"requirements.*"}),
json!({"definition":"terms.value"}),
] {
let read = dispatch(&sources, "habeas", &arguments).unwrap();
let text = read.result.to_string();
assert!(!text.contains(&token), "{arguments}: {:#}", read.result);
assert!(
text.contains("[REDACTED:GitHub Token]"),
"{arguments}: {:#}",
read.result
);
let definition = arguments.get("definition").is_some();
assert_eq!(read.result["input"].get("definition").is_some(), definition);
assert_eq!(
read.result["input"].get("requirements").is_some(),
!definition
);
assert!(read.result.get("inputs").is_none());
let expected_terms = if definition {
vec!["terms.base"]
} else {
vec!["terms.base", "terms.value"]
};
let terms: Vec<_> = read.result["definitions"]
.as_array()
.unwrap()
.iter()
.map(|input| input["definition"].as_str().unwrap())
.collect();
assert_eq!(terms, expected_terms);
if definition {
assert_eq!(read.result["input"]["definition"], "terms.value");
assert_eq!(
read.result["input"]["text"],
json!([
":::{definition} value",
":phrase: value",
"A value such as [REDACTED:GitHub Token], with a {term}`terms.base`.",
":::"
])
);
} else {
assert_eq!(read.result["input"]["requirements"], "requirements.*");
assert_eq!(
read.result["input"]["matches"],
json!(["requirements.other", "requirements.ready"])
);
assert_eq!(
read.result["input"]["text"],
json!([
":::{req} other",
"Other MUST reject",
"[REDACTED:GitHub Token]",
"on its own line.",
":::",
"",
":::{req} ready",
"The project MUST accept [REDACTED:GitHub Token] as a {term}`terms.value`.",
"{cite}`requirements.other`",
":::"
])
);
}
let mut fresh = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
assert!(fresh.recorded_inputs().is_empty());
fresh.record_inputs(&read.inputs);
fresh.record_inputs(&read.inputs);
let mut expected = vec![read.result["input"].clone()];
expected.extend(
read.result["definitions"]
.as_array()
.unwrap()
.iter()
.cloned(),
);
assert_eq!(fresh.recorded_inputs(), expected);
assert_eq!(read.inputs, expected);
}
}
Referenced definitions
Input 2: 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 3: requirements selection requirements.authoring.fixme_inputs
requirements.authoring.fixme_inputs:md/requirements/authoring.md:1305–1345
:::{req} fixme_inputs
For a requirement or example assessment, the initial request MUST include every
valid named `{fixme}` reference to the subject found under
{cite}`requirements.references.discovery`, except a reference inside one of
the subject's sites under {cite}`requirements.references.site_review`, in this
form:
```text
Acknowledgment {
file: String,
item: String,
body: String,
issues: Array<{ reference: String, state: "open" | "closed" }>,
}
```
`file` and `item` MUST locate the containing source by project-relative path and
outline selector, using `<root>` for a whole file. `body` MUST contain the
reference's complete fenced commentary without its fences or source-comment
delimiters, including its option lines, redacted under
{cite}`requirements.authoring.redaction`. `issues` MUST give every distinct issue
its `:github:` lines name, in their order, with state supplied under
{cite}`requirements.authoring.github_reads`. Acknowledgments MUST be ordered by
file and position in the file and MUST carry no line numbers or containing
implementation source.
The locations and bodies MUST be protected against staleness by the reference-set
digest under {cite}`requirements.ci.reference_set`; the acknowledgment MUST NOT
create an outline input merely to cover its containing source. Actual reads of
that source MUST still be recorded under
{cite}`requirements.authoring.delivered_inputs`. Sources MUST satisfy
{cite}`requirements.authoring.source_tools`; an inaccessible acknowledgment
MUST be reported before inference.
Terminology definitions referenced by an acknowledgment's body MUST contribute
their complete, transitive declarations to the mandatory input set under
{cite}`requirements.definitions.authoring_inputs` and MUST be recorded as
definition inputs. Only the acknowledgment's body MUST contribute these
dependencies; its containing implementation source MUST NOT be supplied merely
to discover them.
:::
Other sources
Input 1: requirements selection requirements.definitions.authoring_inputs
requirements.definitions.authoring_inputs:md/requirements/definitions.md:53–65
:::{req} authoring_inputs
When preparing the mandatory input set defined by
{cite}`requirements.authoring.mandatory_inputs`, every terminology definition
referenced by the subject, any contributed source, or an acknowledgment supplied
under {cite}`requirements.authoring.fixme_inputs` MUST contribute its complete
fenced declaration, including its phrase option. Definitions referenced by those
definitions MUST also be included transitively, without duplicates or
nontermination on cycles.
When an additional source read introduces a terminology dependency, the same
complete, transitive definition set MUST be supplied to the model and recorded
before accepting a submission.
:::