requirements.ci.authoring_inputs
Requirements index · View definition
Requirement
When
habeas authorassesses a subject with existing evidence, that evidence MUST only determine whether the subject needs assessment. Its inputs, determination, and rationale MUST NOT contribute to the mandatory input set defined byor otherwise be supplied to the model. A new assessment’s evidence MUST record only the inputs supplied to it, so sources that an earlier assessment read but that no longer exist or are no longer relevant cannot block or shape reassessment.
Rationale
The tests adequately cover requirements.ci.authoring_inputs.
Obligations derived from the text
- Existing evidence MUST NOT add to the mandatory input set. This covers its inputs, determination and rationale.
- Existing evidence MUST NOT otherwise be supplied to the model.
- A new assessment’s evidence MUST record only the inputs supplied to it. Sources an earlier assessment read, which are gone or no longer relevant, MUST NOT block or shape reassessment.
- Existing evidence MUST only decide whether assessment is needed.
Coverage
- Obligation 1, existing sources:
src/authoring/inputs.rs#mod[tests]/fn[earlier_evidence_inputs_and_judgments_are_not_carried_forward]writes an old record. It cites a still-existingnotes.txtand the evidence file itself, and it carries a rationaleold secret judgment. The test asserts that none ofnotes.txt,evidence/or the old rationale appears in the serialized mandatory inputs. It also asserts that the evidence file is left unchanged. - Obligation 1, combined bundle:
fn[bundle_combines_direct_references_terms_and_current_existing_selectors]has an old record withnotes.txtinput text anddeterminationfalse. It assertsrecorded_inputs()is empty, nonotes.txtinput is present, and the old rationale is absent. It also asserts the expected current inputs are present. - Obligation 3, stale inputs:
fn[unresolvable_earlier_inputs_do_not_block_reassessment]records inputs that no longer exist: a missing file, a removed Rust item and a removed requirement.preparestill succeeds. The mandatory inputs are exactly the current subject declaration, so the stale entries neither block nor shape reassessment. - Obligations 2 and 3, end to end:
src/authoring/mod.rs#mod[tests]/fn[reassessment_records_only_freshly_delivered_inputs]runs a fullassessover old evidence. The old evidence has a deleted file, an old item andOLD_RATIONALE.- The new record contains the fresh
requirements.readyinput. - The record does not contain the stale file, item or rationale.
- The first full request text sent to the provider does not contain them either.
RecordingProvider::promptsserializes the whole request, so this covers the model-facing input. - The record’s rationale is the fresh one.
- The new record contains the fresh
- Obligation 4: The “only decides whether assessment is needed” clause is the skip decision in
batch::subject_is_current, called fromauthor_evidence_with_options. It is the invocation requirement’s behavior. The restrictive part of the clause, that evidence is used for nothing else, is covered by the negative assertions above.
Gaps: I found none. Plausible violations would be carrying old inputs into the bundle, including the old rationale in the prompt, failing on unresolvable old inputs, or recording stale inputs in the new evidence. Each of these would fail at least one of the assertions above.
Inputs
Tests
Input 3: 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 4: outline src/authoring/inputs.rs mod[tests]/fn[unresolvable_earlier_inputs_do_not_block_reassessment]
- File:
src/authoring/inputs.rs - Selector:
mod[tests]/fn[unresolvable_earlier_inputs_do_not_block_reassessment] - Kind:
fn src/authoring/inputs.rs:1060–1089
// {test}`requirements.authoring.mandatory_inputs`
// {test}`requirements.ci.authoring_inputs`
// {test}`requirements.authoring_input`
#[test]
fn unresolvable_earlier_inputs_do_not_block_reassessment() {
let root = project();
fs::create_dir(root.path().join("evidence")).unwrap();
fs::write(
root.path().join("evidence/requirements.ready.json"),
json!({
"inputs": [
{"file":"missing.txt", "line_start":1, "line_end":1},
{"rust_file":"src/lib.rs", "rust_item":"fn[removed]", "text":["fn removed() {}"]},
{"requirements":"requirements.removed", "matches":["requirements.removed"], "text":["gone"]}
]
})
.to_string(),
)
.unwrap();
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
assert_eq!(
sources.mandatory_inputs(),
&[json!({
"requirements": "requirements.ready",
"matches": ["requirements.ready"],
"text": [":::{req} ready", "The project MUST be ready.", ":::"]
})]
);
assert!(AssessmentSources::prepare(root.path(), "missing").is_err());
}
Input 5: outline src/authoring/inputs.rs mod[tests]/fn[earlier_evidence_inputs_and_judgments_are_not_carried_forward]
- File:
src/authoring/inputs.rs - Selector:
mod[tests]/fn[earlier_evidence_inputs_and_judgments_are_not_carried_forward] - Kind:
fn src/authoring/inputs.rs:1091–1118
// {test}`requirements.authoring.mandatory_inputs`
// {test}`requirements.ci.authoring_inputs`
#[test]
fn earlier_evidence_inputs_and_judgments_are_not_carried_forward() {
let root = project();
fs::write(root.path().join("notes.txt"), "current source\n").unwrap();
fs::create_dir_all(root.path().join("evidence")).unwrap();
let old = json!({
"requirement": "The project MUST be ready.",
"determination": false,
"rationale": "old secret judgment",
"inputs": [
{"file":"evidence/requirements.ready.json", "line_start":1, "line_end":1, "text":["old judgment"]},
{"file":"notes.txt", "line_start":1, "line_end":1, "text":["old source"]},
]
});
let path = root.path().join("evidence/requirements.ready.json");
fs::write(&path, old.to_string()).unwrap();
let sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
let supplied = serde_json::to_string(sources.mandatory_inputs()).unwrap();
assert!(!supplied.contains("notes.txt"), "{supplied}");
assert!(!supplied.contains("evidence/"), "{supplied}");
assert!(!supplied.contains("old secret judgment"), "{supplied}");
assert_eq!(
serde_json::from_str::<Value>(&fs::read_to_string(path).unwrap()).unwrap(),
old
);
}
Input 6: outline src/authoring/mod.rs mod[tests]/fn[reassessment_records_only_freshly_delivered_inputs]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[reassessment_records_only_freshly_delivered_inputs] - Kind:
fn src/authoring/mod.rs:3751–3776
// {test}`requirements.ci.authoring_inputs`
#[tokio::test]
async fn reassessment_records_only_freshly_delivered_inputs() {
let project = inputs::tests::project();
let subject = AuthoringSubject::Definition("requirements.ready".into());
let path = subject.evidence_path(project.path());
fs::create_dir_all(path.parent().unwrap()).unwrap();
fs::write(&path, json!({"determination":false,"rationale":"OLD_RATIONALE","inputs":[{"file":"deleted.rs","item":"fn[old]","hash":"0".repeat(64)}]}).to_string()).unwrap();
let mut sources = subject.sources(project.path()).unwrap();
let state = tempfile::tempdir().unwrap();
let mut usage = UsageLog::start(state.path(), project.path(), &subject.label()).unwrap();
let provider = RecordingProvider::new(vec![judgment(json!(true), "Fresh assessment.")]);
let (_, record) = assess(&provider, &mut sources, &mut usage).await.unwrap();
assert!(
record["inputs"]
.as_array()
.unwrap()
.iter()
.any(|input| input["requirements"] == "requirements.ready")
);
for stale in ["deleted.rs", "fn[old]", "OLD_RATIONALE"] {
assert!(!record.to_string().contains(stale));
assert!(!provider.prompts()[0].0.contains(stale));
}
assert_eq!(record["rationale"], "Fresh assessment.");
}
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`.
:::
Other sources
Input 1: requirements selection requirements.ci.authoring_inputs
requirements.ci.authoring_inputs:md/requirements/ci.md:343–351
:::{req} authoring_inputs
When `habeas author` assesses a subject with existing evidence, that evidence
MUST only determine whether the subject needs assessment. Its inputs,
determination, and rationale MUST NOT contribute to the mandatory input set
defined by {cite}`requirements.authoring.mandatory_inputs` or otherwise be
supplied to the model. A new assessment's evidence MUST record only the inputs
supplied to it, so sources that an earlier assessment read but that no longer
exist or are no longer relevant cannot block or shape reassessment.
:::