requirements.ci.outcomes
Requirements index · View definition
Requirement
Every assessment judgment MUST use one of these outcomes, applying
:
true: the reviewed tests adequately check a requirement or example under, 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
determinationMUST betrue,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 underwhose 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 plainFIXMEcomment, another marker such asTODO, 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 thatreports closed MUST NOT count as acknowledging its gap. A FIXME judgment MUST be grounded in recorded evidence inputs or, for an acknowledgment supplied under
, the reference-set digest covering that acknowledgment.
Rationale
I judge the reviewed tests adequate for requirements.ci.outcomes. I read only the supplied test sources and did not request implementation source. Each obligation maps to tests as follows.
Outcome shape (true, false, or an object with exactly FIXME holding a nonempty array of nonempty strings)
src/authoring/mod.rs#mod[tests]/fn[submit_judgment_advertises_exactly_the_three_outcome_shapes]asserts the exactsubmit_judgmentschema. It requires a boolean or an object withadditionalProperties: false,required: ["FIXME"],minItems: 1, and string items withminLength: 1.tests/outcomes.rs#fn[judgments_round_trip_and_reject_invalid_fixme_shapes]round-tripstrue,false, and the two valid FIXME forms.- It rejects null, a bare string, an array,
{}, an empty array, an empty string, a whitespace-only string, and a non-string item. - It rejects a non-array value, an extra key, and a lowercase
fixmekey.
- It rejects null, a bare string, an array,
tests/outcomes.rs#fn[malformed_fixme_is_invalid_and_reports_the_required_shape]shows that an emptyFIXMEarray is reported as invalid with “nonempty array” and shown asInvalidin status.
false outcome (gaps not all acknowledged)
tests/outcomes.rs#fn[an_unacknowledged_gap_beside_an_acknowledged_one_is_false]recordsfalsewhere a{fixme}exists and checks the “determination is false: …” error.
FIXME outcome and what counts as acknowledgment
tests/outcomes.rs#fn[an_acknowledged_implementation_gap_records_its_issue]covers several cases.- A valid
{fixme}plus a matching FIXME judgment is accepted. - Strings that are not the issue as written after
:github:are rejected, such as#125andFIXME(example/queue#125). - An issue named by no
{fixme}is rejected. - Plain
FIXME/TODOcomments and prose acknowledge nothing. - The reference-set digest protects the acknowledgment: changing its body or moving it to another source makes the record stale.
- A valid
tests/outcomes.rs#fn[an_acknowledged_gap_without_an_issue_records_the_body_words]checks the no-issue case. It accepts the body words joined by single spaces. It rejects an invented issue and words that are not single-space joined.tests/outcomes.rs#fn[fixme_strings_list_each_issue_of_an_acknowledging_fixme_once]checks the omission of a named issue and a duplicate entry.src/fixme.rs#mod[tests]/fn[a_fixme_acknowledges_its_distinct_issues_or_its_description]checks de-duplication and whitespace joining.tests/commands.rs#fn[fixme_fixture]builds a multi-subject fixture. It covers mixed issues, shared issues, an example subject, and case-distinct references. The fixture asserts that the repository validates cleanly with the recorded FIXME judgments.
Site reviews and citation reviews
src/sites.rs#mod[tests]/fn[a_site_reviews_fixme_entries_count_only_fixmes_within_that_site]checks that only a{fixme}inside the site acknowledges it. A{fixme}in another site, or outside every site, does not.tests/references.rs#fn[citation_reviews_are_required_current_and_not_orphaned]checks that a citation review with a FIXME determination is reported (“a citation review cannot accept a…”).
Closed issues
tests/authoring_batch.rs#fn[closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed]checks several behaviors.- A recorded FIXME judgment becomes stale and invalid once its issue is closed.
- Reassessment yields
false. - Repository validation does not contact GitHub.
- Issue states are not recorded in the evidence.
Reviewer-conduct obligations
src/authoring/mod.rs#mod[tests]/fn[initial_prompt_conveys_when_to_choose_each_outcome]asserts that the prompt text carries the required guidance:- when to choose each outcome;
- the closed-issue rule;
- the rule that a
{fixme}for a no-longer-real gap is itself a gap; - the rule that an implementation-bug acknowledgment does not create a test-adequacy gap;
- the rule that plain FIXME/TODO comments do not acknowledge a gap.
- Whether a reviewer follows this guidance is a model-behavior matter. The prompt test is the testable proxy.
All the tests carry {test} references to requirements.ci.outcomes, so there are no marking gaps. I found no plausible violating behavior that these tests would accept. No acknowledgments were supplied and none are needed.
Inputs
Tests
Input 6: outline src/authoring/mod.rs mod[tests]/fn[submit_judgment_advertises_exactly_the_three_outcome_shapes]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[submit_judgment_advertises_exactly_the_three_outcome_shapes] - Kind:
fn src/authoring/mod.rs:2513–2541
// {test}`requirements.ci.outcomes`
#[test]
fn submit_judgment_advertises_exactly_the_three_outcome_shapes() {
let definitions = serde_json::to_value(tool_definitions().unwrap()).unwrap();
let submit = definitions
.as_array()
.unwrap()
.iter()
.find(|definition| definition["name"] == "submit_judgment")
.expect("submit_judgment is advertised");
// `true` or `false`, or an object holding exactly `FIXME` with a
// nonempty array of nonempty strings.
assert_eq!(
submit["parameters"]["properties"]["determination"],
json!({"oneOf": [
{"type": "boolean"},
{
"type": "object",
"additionalProperties": false,
"required": ["FIXME"],
"properties": {"FIXME": {
"type": "array",
"minItems": 1,
"items": {"type": "string", "minLength": 1}
}}
}
]})
);
}
Input 7: outline src/authoring/mod.rs mod[tests]/fn[initial_prompt_conveys_when_to_choose_each_outcome]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[initial_prompt_conveys_when_to_choose_each_outcome] - Kind:
fn src/authoring/mod.rs:2543–2565
// {test}`requirements.ci.outcomes`
#[test]
fn initial_prompt_conveys_when_to_choose_each_outcome() {
let project = inputs::tests::project();
let sources = AssessmentSources::prepare(project.path(), "requirements.ready").unwrap();
let prompt = initial_prompt(&sources).unwrap().joined();
for guidance in [
"Choose true when your task finds no gap, {\"FIXME\": [\"...\"]} when every gap is\nacknowledged, and false otherwise.",
"You MUST end by calling submit_judgment\nwith determination and rationale until one submission is accepted.\nA rejected submission does not complete the assessment. A judgment written in your\nreply text is not accepted.",
"A gap is acknowledged only by a {fixme} reference",
"a {fixme} naming a\n closed issue no longer acknowledges its gap",
"including\n any acknowledged gaps",
"A {fixme} describing a gap that your review establishes\n no longer exists within its task's scope is itself a gap.",
"A plain FIXME or TODO comment is\n not an acknowledgment.",
"An acknowledgment of an implementation bug alone does not establish a\n test-adequacy gap or acknowledge a different missing-test or assertion gap.",
"Do not inspect implementation correctness merely to validate an out-of-scope\n acknowledgment.",
] {
assert!(
prompt.contains(guidance),
"missing {guidance:?} in:\n{prompt}"
);
}
}
Input 8: outline src/fixme.rs mod[tests]/fn[a_fixme_acknowledges_its_distinct_issues_or_its_description]
- File:
src/fixme.rs - Selector:
mod[tests]/fn[a_fixme_acknowledges_its_distinct_issues_or_its_description] - Kind:
fn src/fixme.rs:341–351
// {test}`requirements.ci.outcomes`
#[test]
fn a_fixme_acknowledges_its_distinct_issues_or_its_description() {
let body = FixmeBody::parse(":github: o/r#1\n:github: o/r#2\n:github: o/r#1\nGap.");
assert_eq!(body.acknowledgments(), ["o/r#1", "o/r#2"]);
let body = FixmeBody::parse("Cancellation races are\nnot tested.");
assert_eq!(
body.acknowledgments(),
["Cancellation races are not tested."]
);
}
Input 9: outline src/sites.rs mod[tests]/fn[a_site_reviews_fixme_entries_count_only_fixmes_within_that_site]
- File:
src/sites.rs - Selector:
mod[tests]/fn[a_site_reviews_fixme_entries_count_only_fixmes_within_that_site] - Kind:
fn src/sites.rs:1507–1547
// {test}`requirements.ci.outcomes`
#[test]
fn a_site_reviews_fixme_entries_count_only_fixmes_within_that_site() {
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();
// A {fixme} inside the site acknowledges its gap; one outside every
// site, or inside another site, does not.
write_review(
root,
"fn[check_two]",
json!({"determination": {"FIXME": ["o/r#1", "o/r#2"]}}),
);
write_review(
root,
"fn[check_one]",
json!({"determination": {"FIXME": ["o/r#1"]}}),
);
let (errors, _) = inspect(root);
let entry = |item: &str, issue: &str| {
review_errors(&errors, item)
.iter()
.any(|error| error.contains(&format!("FIXME entry \"o/r#{issue}\" is neither")))
};
assert!(!entry("fn[check_two]", "1"), "{errors:#?}");
assert!(entry("fn[check_two]", "2"), "{errors:#?}");
assert!(entry("fn[check_one]", "1"), "{errors:#?}");
}
Input 10: outline tests/authoring_batch.rs fn[closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed]
- File:
tests/authoring_batch.rs - Selector:
fn[closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed] - Kind:
fn tests/authoring_batch.rs:2384–2483
// {test}`requirements.ci.fixme_closed_issue`
// {test}`requirements.cli.fixme_issues`
// {test}`requirements.authoring.github_reads`
// {test}`requirements.authoring.batch`
// {test}`requirements.ci.outcomes`
// {test}`requirements.configuration.state_location`
#[test]
fn closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed() {
let server = Server::start_with(false, Behavior::ClosedIssueIsFalse);
let github = FakeGithub::start();
let fixture = Fixture::new(&server.endpoint, None);
let source = fixture.project.join("src/lib.rs");
fs::write(
&source,
fs::read_to_string(&source).unwrap().replace(
"pub fn beta()",
"// :::{fixme} requirements.beta\n// :github: example/queue#125\n// Zero capacity is untested.\n// :::\npub fn beta()",
),
)
.unwrap();
let run = |args: &[&str]| {
let output = fixture
.command()
.env("HABEAS_GITHUB_API_URL", &github.endpoint)
.env("GITHUB_TOKEN", "TEST_GITHUB_TOKEN")
.args(args)
.output()
.unwrap();
assert!(
output.status.success(),
"{}",
String::from_utf8_lossy(&output.stderr)
);
String::from_utf8(output.stdout).unwrap()
};
run(&["author", "--all"]);
assert!(github.headers.lock().unwrap().iter().any(|headers| {
headers
.to_ascii_lowercase()
.contains("authorization: bearer test_github_token\r\n")
}));
assert_eq!(server.subjects().len(), 6);
// The issue was open, so record the acknowledged gap as current FIXME
// evidence.
let mut beta = fixture.evidence("requirements.beta");
beta["determination"] = json!({"FIXME": ["example/queue#125"]});
fs::write(
fixture.project.join("evidence/requirements.beta.json"),
serde_json::to_vec_pretty(&beta).unwrap(),
)
.unwrap();
let cache = fixture.state.join(if cfg!(windows) {
"habeas/state/github/example+queue+125.json"
} else {
"habeas/github/example+queue+125.json"
});
assert!(
cache.exists(),
"GitHub reads are cached under the state root"
);
let status = run(&["status"]);
assert!(!status.contains("stale"), "{status}");
let reads = github.requests();
*github.state.lock().unwrap() = "closed";
// The cached open state is reused for an hour.
assert!(!run(&["status"]).contains("stale"));
assert_eq!(github.requests(), reads);
fs::remove_file(&cache).unwrap();
let status = run(&["status"]);
assert_eq!(github.requests(), reads + 1);
let row = status
.lines()
.find(|line| line.starts_with("| `requirements.beta`"))
.unwrap_or_else(|| panic!("{status}"));
assert!(row.contains("Invalid"), "{status}");
for expected in [
"evidence/requirements.beta.json: stale: issue example/queue#125, named by the acknowledging {fixme} to requirements.beta at src/lib.rs:5, is closed",
"src/lib.rs:5: {fixme} names example/queue#125, which is closed",
"src/lib.rs:9: fn beta fails: its {fixme} at line 5 names example/queue#125, which is closed",
] {
assert!(status.contains(expected), "{expected}\n{status}");
}
// Repository validation, which does not contact GitHub, still accepts it.
let report = habeas::validate_repository(&fixture.project).unwrap();
assert!(report.errors.is_empty(), "{:?}", report.errors);
assert_eq!(github.requests(), reads + 1);
run(&["author", "--all"]);
let subjects = server.subjects();
assert_eq!(subjects.len(), 7, "{subjects:?}");
assert_eq!(subjects[6], "requirement requirements.beta");
let beta = fixture.evidence("requirements.beta");
assert_eq!(beta["determination"], json!(false), "{beta}");
// Issue states are supplied with inputs but never recorded.
assert!(!beta.to_string().contains("github_issues"), "{beta}");
for run in fixture.usage() {
assert!(!run.to_string().contains("github_issues"), "{run}");
}
}
Input 11: outline tests/commands.rs fn[fixme_fixture]
- File:
tests/commands.rs - Selector:
fn[fixme_fixture] - Kind:
fn tests/commands.rs:119–221
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.determination`
// {test}`requirements.ci.schema`
// {test}`requirements.integration.report_api`
fn fixme_fixture() -> TempDir {
let temp = TempDir::new().unwrap();
fs::create_dir(temp.path().join("md")).unwrap();
fs::create_dir(temp.path().join("evidence")).unwrap();
fs::write(
temp.path().join("Cargo.toml"),
"[package]\nname = 'fixture'\n",
)
.unwrap();
fs::write(temp.path().join("book.toml"), "[book]\nsrc = 'md'\n").unwrap();
let example = "A concrete case. {cite}`rules.alpha`.";
let declarations = [
(
"req",
"alpha",
"Alpha MUST work.",
vec![
"example/app#123",
"rust-lang/rust#456",
"Unlinked extra detail",
],
),
(
"req",
"beta",
"Beta MUST work.",
vec![
"example/app#123",
"example/app#45",
"Rust-Lang/rust#456",
"An unrelated note",
],
),
("example", "case", example, vec!["example/app#45"]),
(
"req",
"unlinked",
"Unlinked MUST work.",
vec![
"No ticket for <script>alert(1)</script>",
"#123 is not a qualified issue",
"https://github.com/rust-lang/rust/issues/456",
],
),
];
let source: String = declarations
.iter()
.map(|(kind, name, text, _)| format!(":::{{{kind}}} {name}\n{text}\n:::\n\n"))
.collect();
fs::write(temp.path().join("md/rules.md"), &source).unwrap();
// Each judgment's strings come from the `{fixme}` references to it: one
// naming its issues, and one per gap without an issue.
let mut gaps = String::new();
for (_, name, _, entries) in &declarations {
let (issues, others): (Vec<&str>, Vec<&str>) = entries
.iter()
.partition(|entry| entry.contains('/') && !entry.contains(' ') && !entry.contains(':'));
if !issues.is_empty() {
gaps.push_str(&format!(":::{{fixme}} rules.{name}\n"));
for issue in issues {
gaps.push_str(&format!(":github: {issue}\n"));
}
gaps.push_str("Tracked gaps.\n:::\n\n");
}
for other in others {
gaps.push_str(&format!(":::{{fixme}} rules.{name}\n{other}\n:::\n\n"));
}
}
fs::write(temp.path().join("gaps.txt"), gaps).unwrap();
let input = habeas::outline_input(temp.path(), "md/rules.md", "").unwrap();
let gaps_input = habeas::outline_input(temp.path(), "gaps.txt", "").unwrap();
for (kind, name, text, references) in declarations {
let subject_key = if kind == "example" {
"example"
} else {
"requirement"
};
fs::write(
temp.path().join(format!("evidence/rules.{name}.json")),
json!({
subject_key: text,
"determination": {"FIXME": references},
"rationale": "The fixture records acknowledged implementation gaps.",
"references": habeas::reference_set_digest_for(
temp.path(),
&format!("rules.{name}")
)
.unwrap(),
"inputs": [input, gaps_input]
})
.to_string(),
)
.unwrap();
}
common::coverage_setup(temp.path());
let report = habeas::validate_repository(temp.path()).unwrap();
assert!(report.errors.is_empty(), "{:?}", report.errors);
temp
}
Input 12: outline tests/outcomes.rs fn[judgments_round_trip_and_reject_invalid_fixme_shapes]
- File:
tests/outcomes.rs - Selector:
fn[judgments_round_trip_and_reject_invalid_fixme_shapes] - Kind:
fn tests/outcomes.rs:115–142
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.schema`
#[test]
fn judgments_round_trip_and_reject_invalid_fixme_shapes() {
for value in [
json!(true),
json!(false),
json!({ "FIXME": ["#125", "rust-lang/rust#123"] }),
json!({ "FIXME": ["cancellation races are not tested on Windows"] }),
] {
assert_eq!(Judgment::from_value(&value).unwrap().to_value(), value);
}
for invalid in [
Value::Null,
json!("FIXME"),
json!(["#125"]),
json!({}),
json!({ "FIXME": [] }),
json!({ "FIXME": [""] }),
json!({ "FIXME": [" "] }),
json!({ "FIXME": ["#125", 125] }),
json!({ "FIXME": "#125" }),
json!({ "FIXME": ["#125"], "extra": true }),
json!({ "fixme": ["#125"] }),
] {
assert!(Judgment::from_value(&invalid).is_err(), "{invalid}");
}
}
Input 13: outline tests/outcomes.rs fn[an_acknowledged_implementation_gap_records_its_issue]
- File:
tests/outcomes.rs - Selector:
fn[an_acknowledged_implementation_gap_records_its_issue] - Kind:
fn tests/outcomes.rs:188–281
// {test}`requirements.ci.determination`
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.fixme_implementation_gap`
#[test]
fn an_acknowledged_implementation_gap_records_its_issue() {
let temp = fixture();
let source = fixme(
"requirements.ready",
&["example/queue#125"],
"Capacity-zero insertion does not return Full yet and has no test.",
);
let errors = judge_ready(
temp.path(),
&source,
json!({ "FIXME": ["example/queue#125"] }),
);
assert!(errors.is_empty(), "{errors:?}");
let path = temp.path().join("evidence/requirements.ready.json");
let mut without_source: Value = serde_json::from_slice(&fs::read(&path).unwrap()).unwrap();
without_source["inputs"]
.as_array_mut()
.unwrap()
.retain(|input| input["file"] != "reviewed.rs");
write_record(temp.path(), "ready", without_source);
let report = habeas::validate_repository(temp.path()).unwrap();
assert!(report.errors.is_empty(), "{:?}", report.errors);
fs::write(
temp.path().join("reviewed.rs"),
source.replace("has no test", "has no boundary test"),
)
.unwrap();
let errors = habeas::validate_repository(temp.path()).unwrap().errors;
assert!(
errors
.iter()
.any(|e| e.contains("requirements.ready.json: reference set changed")),
"{errors:?}"
);
assert!(
!errors
.iter()
.any(|e| e.contains("requirements.ready.json:") && e.contains("outline input changed")),
"{errors:?}"
);
fs::write(temp.path().join("reviewed.rs"), &source).unwrap();
// Moving the same acknowledgment to another source changes its location,
// even when no implementation source is a recorded input.
fs::write(temp.path().join("relocated.rs"), &source).unwrap();
fs::write(temp.path().join("reviewed.rs"), "").unwrap();
let errors = habeas::validate_repository(temp.path()).unwrap().errors;
assert!(
errors
.iter()
.any(|e| e.contains("requirements.ready.json: reference set changed")),
"{errors:?}"
);
fs::remove_file(temp.path().join("relocated.rs")).unwrap();
fs::write(temp.path().join("reviewed.rs"), &source).unwrap();
// The strings must be the issues as written after `:github:`.
for judgment in [json!(["#125"]), json!(["FIXME(example/queue#125)"])] {
let errors = judge_ready(temp.path(), &source, json!({ "FIXME": judgment }));
assert!(
errors
.iter()
.any(|error| error.contains("is neither an issue named by a {fixme}")),
"{errors:?}"
);
}
let errors = judge_ready(temp.path(), &source, json!({"FIXME":["example/io#125"]}));
assert!(
errors
.iter()
.any(|error| error.contains("is neither an issue named by a {fixme}")),
"{errors:?}"
);
// Plain FIXME/TODO markers and prose acknowledge nothing.
for source in [
"// FIXME(example/queue#125): capacity-zero insertion does not return Full yet.\n",
"// TODO(example/queue#125): capacity-zero insertion does not return Full yet.\n",
"// Capacity-zero insertion still needs a test; tracked by example/queue#125.\n",
] {
let errors = judge_ready(
temp.path(),
source,
json!({ "FIXME": ["example/queue#125"] }),
);
assert!(
errors
.iter()
.any(|error| error.contains("\"example/queue#125\" is neither an issue")),
"{source}: {errors:?}"
);
}
}
Input 14: outline tests/outcomes.rs fn[an_acknowledged_gap_without_an_issue_records_the_body_words]
- File:
tests/outcomes.rs - Selector:
fn[an_acknowledged_gap_without_an_issue_records_the_body_words] - Kind:
fn tests/outcomes.rs:283–314
// {test}`requirements.ci.determination`
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.fixme_without_issue`
#[test]
fn an_acknowledged_gap_without_an_issue_records_the_body_words() {
let temp = fixture();
let source = fixme(
"requirements.ready",
&[],
"Cancellation races are not\n// tested on Windows.",
);
let errors = judge_ready(
temp.path(),
&source,
json!({ "FIXME": ["Cancellation races are not tested on Windows."] }),
);
assert!(errors.is_empty(), "{errors:?}");
// An invented issue number, or the words not joined by single spaces,
// matches no `{fixme}`.
for entry in [
"example/tasks#1",
"Cancellation races are not tested on Windows.",
] {
let errors = judge_ready(temp.path(), &source, json!({ "FIXME": [entry] }));
assert!(
errors
.iter()
.any(|error| error.contains("is neither an issue")),
"{entry}: {errors:?}"
);
}
}
Input 15: outline tests/outcomes.rs fn[fixme_strings_list_each_issue_of_an_acknowledging_fixme_once]
- File:
tests/outcomes.rs - Selector:
fn[fixme_strings_list_each_issue_of_an_acknowledging_fixme_once] - Kind:
fn tests/outcomes.rs:316–341
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.fixme_example_test_gaps`
#[test]
fn fixme_strings_list_each_issue_of_an_acknowledging_fixme_once() {
let temp = fixture();
let path = "evidence/requirements.timeout.json";
for (judgment, expected) in [
(
json!(["rust-lang/rust#123"]),
"FIXME entries omit \"example/io#125\" named by the acknowledging {fixme} to requirements.timeout at observed.rs:1",
),
(
json!(["example/io#125", "rust-lang/rust#123", "example/io#125"]),
"FIXME entry \"example/io#125\" is listed more than once",
),
] {
replace_judgment(temp.path(), "timeout", json!({ "FIXME": judgment }));
let errors = habeas::validate_repository(temp.path()).unwrap().errors;
assert!(
errors
.iter()
.any(|error| error == &format!("{path}: {expected}")),
"{expected}: {errors:#?}"
);
}
}
Input 16: outline tests/outcomes.rs fn[an_unacknowledged_gap_beside_an_acknowledged_one_is_false]
- File:
tests/outcomes.rs - Selector:
fn[an_unacknowledged_gap_beside_an_acknowledged_one_is_false] - Kind:
fn tests/outcomes.rs:343–361
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.determination`
// {test}`requirements.ci.fixme_with_unacknowledged_gap`
#[test]
fn an_unacknowledged_gap_beside_an_acknowledged_one_is_false() {
let temp = fixture();
let source = fixme(
"requirements.ready",
&["example/queue#125"],
"Capacity-zero insertion does not return Full yet.",
);
let errors = judge_ready(temp.path(), &source, json!(false));
assert!(
errors.iter().any(|error| error.contains(
"evidence/requirements.ready.json: determination is false: The fixture's gaps and their locations."
)),
"{errors:?}"
);
}
Input 17: outline tests/outcomes.rs fn[malformed_fixme_is_invalid_and_reports_the_required_shape]
- File:
tests/outcomes.rs - Selector:
fn[malformed_fixme_is_invalid_and_reports_the_required_shape] - Kind:
fn tests/outcomes.rs:363–388
// {test}`requirements.ci.schema`
// {test}`requirements.ci.outcomes`
// {test}`requirements.index.state`
// {test}`requirements.cli.fixme_summary`
// {test}`requirements.ci.determination`
// {test}`requirements.examples.evidence`
#[test]
fn malformed_fixme_is_invalid_and_reports_the_required_shape() {
let temp = fixture();
replace_judgment(temp.path(), "timeout", json!({ "FIXME": [] }));
let report = habeas::validate_repository(temp.path()).unwrap();
assert!(
report
.errors
.iter()
.any(|error| error.contains("nonempty array"))
);
let status = habeas::status_markdown(temp.path(), false).unwrap();
let row = status
.lines()
.find(|line| line.starts_with("| `requirements.timeout`"))
.unwrap();
assert!(row.contains("Invalid"), "{row}");
assert!(status.contains("nonempty array"), "{status}");
assert!(!status.contains("affects"), "{status}");
}
Input 18: outline tests/references.rs fn[citation_reviews_are_required_current_and_not_orphaned]
- File:
tests/references.rs - Selector:
fn[citation_reviews_are_required_current_and_not_orphaned] - Kind:
fn tests/references.rs:469–642
// {test}`requirements.references.citation_review`
// {test}`requirements.ci.outcomes`
// {test}`requirements.ci.orphans`
// {test}`requirements.ci.errors`
#[test]
fn citation_reviews_are_required_current_and_not_orphaned() {
let temp = project();
let root = temp.path();
let cr = role("cite");
let helper = |body: &str| {
format!(
"// {cr}`rules.ready`\n// :::{cr} habeas:util\n// {body}\n// :::\nfn helper() {{\n work();\n}}\n"
)
};
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
fs::write(root.join("notes.txt"), format!("See {cr}`rules.ready`.\n")).unwrap();
// Citations in the book are reviewed with their declaration instead.
fs::write(
root.join("md/guide.md"),
format!("# Guide\n\nSee {cr}`rules.ready`.\n"),
)
.unwrap();
let path = "evidence/citations/src/lib.rs/fn[helper].json";
let errors_for = |prefix: &str| {
errors(root)
.into_iter()
.filter(|error| error.starts_with(prefix))
.collect::<Vec<_>>()
};
let missing = errors_for("evidence/citations/");
assert!(
has(
&missing,
"evidence/citations/src/lib.rs/fn[helper].json: missing citation review for src/lib.rs fn[helper] at src/lib.rs:1"
),
"{missing:#?}"
);
assert!(
has(
&missing,
"evidence/citations/notes.txt/_root.json: missing citation review for notes.txt <root>"
),
"{missing:#?}"
);
assert!(!has(&missing, "md/guide.md"), "{missing:#?}");
let citations = json!([
{"role": "cite", "name": "rules.ready", "commentary": ""},
{"role": "cite", "name": "habeas:util", "commentary": "Formats output."}
]);
fs::create_dir_all(root.join("evidence/citations/src/lib.rs")).unwrap();
let write = |record: Value| fs::write(root.join(path), record.to_string()).unwrap();
write(review(root, citations.clone(), json!(true)));
assert_eq!(errors_for(path), Vec::<String>::new());
write(review(
root,
json!([null, {"role": "broken", "name": 7, "commentary": 8}]),
json!(true),
));
let malformed = errors_for(path);
assert!(
has(&malformed, "citations[0]: expected a JSON object"),
"{malformed:?}"
);
assert!(
has(&malformed, "citations[1]: unknown role"),
"{malformed:?}"
);
assert!(
has(&malformed, "citations[1]: name must be a string"),
"{malformed:?}"
);
assert!(
has(&malformed, "citations[1]: commentary must be a string"),
"{malformed:?}"
);
// A citation review cannot accept a `{fixme}`, so FIXME is reported; a
// false review is reported with its rationale.
write(review(
root,
citations.clone(),
json!({"FIXME": ["example/rules#4"]}),
));
assert!(
has(
&errors_for(path),
"determination is FIXME, but a citation review cannot accept a"
),
"{:#?}",
errors_for(path)
);
write(review(root, citations.clone(), json!(false)));
assert!(
has(
&errors_for(path),
"determination is false: The citations are sensible."
),
"{:#?}",
errors_for(path)
);
// Changed commentary or citations make the review stale; reflowing does not.
write(review(root, citations.clone(), json!(true)));
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
assert_eq!(errors_for(path), Vec::<String>::new());
fs::write(root.join("src/lib.rs"), helper("Formats all output.")).unwrap();
assert!(
has(&errors_for(path), "citations changed"),
"{:#?}",
errors_for(path)
);
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
// So do an edited item and an edited cited declaration.
fs::write(
root.join("src/lib.rs"),
helper("Formats output.").replace("work()", "rest()"),
)
.unwrap();
assert!(
has(&errors_for(path), "outline input changed"),
"{:#?}",
errors_for(path)
);
fs::write(root.join("src/lib.rs"), helper("Formats output.")).unwrap();
fs::write(
root.join("md/rules.md"),
":::{req} ready\nReady now.\n:::\n",
)
.unwrap();
assert!(
has(&errors_for(path), "input text changed"),
"{:#?}",
errors_for(path)
);
fs::write(root.join("md/rules.md"), ":::{req} ready\nReady.\n:::\n").unwrap();
// The item and each cited declaration must be inputs.
let mut record = review(root, citations.clone(), json!(true));
record["inputs"] = json!([]);
write(record);
let found = errors_for(path);
assert!(
has(&found, "inputs must select the reviewed item"),
"{found:#?}"
);
assert!(
has(
&found,
"inputs must include the cited declaration rules.ready"
),
"{found:#?}"
);
let mut record = review(root, citations.clone(), json!(true));
record["extra"] = json!(1);
write(record);
assert!(has(&errors_for(path), "unexpected field \"extra\""));
// Removing the citations orphans the review.
write(review(root, citations, json!(true)));
fs::write(
root.join("src/lib.rs"),
format!("// {}`rules.ready`\nfn helper() {{}}\n", role("impl")),
)
.unwrap();
assert!(
has(&errors_for(path), "orphaned citation review"),
"{:#?}",
errors_for(path)
);
// The review is not mistaken for misplaced definition evidence.
assert!(!has(&errors(root), "no matching requirement or example"));
}
Referenced definitions
Input 2: requirements selection requirements.ci.review_criteria
requirements.ci.review_criteria:md/requirements/ci.md:23–110
:::{req} review_criteria
The reviewer MUST assess the named subject using its text, referenced requirements,
and terminology definitions. For a requirement, the reviewer MUST assess whether
the reviewed tests adequately check its stated obligations, including relevant
input classes, boundaries, condition combinations, state transitions, and failure
cases. These cases MUST follow from the requirement's obligations; the reviewer
MUST NOT require behavior for inputs the text leaves unspecified. The reviewer
MUST derive expected outcomes from the text, inspect the tests and relevant
helpers or fixtures, and map each obligation assessed here to concrete test
inputs and assertions in the rationale. It MUST separately identify obligations
delegated to a refining requirement or a distributed site's review and any
established testing exemptions. It MUST assess both whether expected results conform
to the text and whether the assertions enforce those results.
For every proposed adequacy gap, the reviewer MUST describe plausible behavior
that violates a stated obligation but would be accepted by the reviewed tests,
and explain which missing scenarios or weak assertions allow it. For an incorrect
expected result, it MUST instead identify the assertion and explain its conflict
with the text. A counterexample MUST identify a requirement-relevant distinction
that the tests miss; another untested value in an already represented input class
MUST NOT by itself establish a gap without explaining why it could expose
different required behavior. It MUST check other relevant tests and helpers before reporting a
gap and distinguish missing information from an established inadequacy. A marking
gap or an ambiguity MUST be identified as such, without requiring a behavioral
counterexample. A judgment of `true` MUST mean the reviewed tests adequately check
the subject under these criteria, including the testing exemptions of
{cite}`requirements.authoring.testing_bar`; it MUST NOT assert implementation
correctness. The reviewer MAY request implementation source to resolve a
specific question and MUST state that question in its rationale. It MUST NOT
derive expected behavior from the implementation or assess implementation
correctness, implementation reachability, or unspecified implementation behavior
as additional tasks.
When another requirement implements part of the subject, the
reviewer MUST assess whether its text carries out that part, and MUST NOT
reassess its implementation, tests, or evidence; that requirement is assessed
separately. When there are no tests, the reviewer MUST apply the testing
exemptions of {cite}`requirements.authoring.testing_bar` and explain any
exemption it establishes.
The reviewer MUST apply these rules in every assessment. MUST and MUST NOT state
obligations; a SHOULD MUST impose an obligation unless the subject's text or a
source comment gives a reason it does not apply, and the reviewer MUST apply the
testing criteria to every applicable SHOULD in a test-adequacy assessment and
explain each exception in the rationale; MAY imposes nothing to
check; examples and sample output in the text illustrate the obligations its
prose states and bind their exact form only where the text says so. When the subject's
text admits two readings its wording supports equally and they lead to different conclusions, such as whether code conforms or which role a citation calls for, the ambiguity MUST be treated as a gap and the rationale MUST name
the readings. A test that verifies the subject without a `{test}` reference to it
MUST be treated as a marking gap; a helper reached from a marked test MUST NOT
need a reference of its own. A gap MUST be
reported only for a specific obligation with relevant sources the reviewer
has read. Before reporting a missing test, the reviewer MUST perform targeted
discovery of relevant tests and identify the missing scenario; an absent test
MUST NOT require an invented source location. Style, performance, logging, how
helpers are factored, robustness the text does not require, and silently ignoring input the text does not mention MUST NOT be treated as gaps, and the reviewer MUST NOT report bugs or issues outside the
subject's text.
For a distributed requirement under {cite}`requirements.references.distributed`,
the reviewer MUST also assess the requirement and its queries. Each obligation
MUST be either one that each site upholds on its own, checked by its review under
{cite}`requirements.references.site_review`, or one that particular code carries
out, assessed as above through its `{impl}` and `{test}` references; an
obligation neither covers MUST be treated as a gap. The reviewer MUST judge whether
each query's conditions are adequate and adequately tested: the site queries
MUST select every place the text's description of a site covers and no place
outside the requirement's stated scope, and each query's `match` and `no_match`
snippets MUST test its conditions as tests of code would, judged as such; a
condition without a snippet of its own MUST NOT by itself be treated as a gap. Because queries are heuristics, the reviewer MUST
judge them by a preponderance of the evidence, asking whether it is more likely
than not that the site queries find the places the requirement applies: a
specific place in the sources that a site query misses or wrongly selects MUST be
treated as a gap, and a form that does not occur in the sources MUST NOT.
Obligations that decide which places are sites, such as a naming rule, MUST be
checked by the reviewer's search of the sources. Violation queries direct site
reviews to likely problems; the reviewer SHOULD note constructs they miss, but
their incompleteness MUST NOT by itself make the determination false. Any other
gap in the queries or snippets MUST be treated as a gap under
{cite}`requirements.ci.outcomes`, even when the code is correct. The reviewer SHOULD run each site query once, scan its matches,
and search briefly for the construct the text describes, and MUST NOT review each
site or treat a site without an `{impl}` reference as a gap.
For an example, the reviewer MUST assess whether tests exist whose setup and
assertions cover its scenario and expected outcomes. The rationale MUST identify
the relevant sources and explain the testing judgment for a
requirement, or the test coverage for an example. Referenced requirements provide
context; they MUST NOT become additional subjects to assess in full.
:::
Input 3: requirements selection requirements.references.roles
requirements.references.roles:md/requirements/references.md:3–49
:::{req} roles
Project text files MAY use the `{impl}`, `{cite}`, and `{test}` roles with a backtick-delimited full requirement or example name, or with a built-in name under {cite}`requirements.references.builtin_definitions`, and MAY use the `{fixme}` role in fenced form. A reference MAY instead be written in fenced form, `:::{role} name` on one line, a body, and a closing fence, following the fence rules of {cite}`requirements.ci.span` and {cite}`requirements.ci.fence_lengths`; the fenced form is the same edge with attached commentary, and the inline form carries none. In a source comment, fence lines MUST be recognized after removing each line's comment delimiters within one comment run under {cite}`requirements.references.outline_comments`, and a fence that does not close within its comment run MUST be a validation error. Each reference is a directed edge between its source and the named definition. A source is a project source item or a requirement or example declaration. The roles MUST mean:
- `{cite}`: the source relies on, supports, or refers to the definition. It is an
edge from the source to the definition.
- `{impl}`: the source implements part of the definition: it makes a decision,
performs a check, produces an output, or handles a case that the definition
specifies. A requirement MAY implement part of another requirement by refining
one of its obligations. Calling code that implements a definition, or
producing a result a caller uses to meet it, MUST NOT by itself count as
implementing it. A check MUST count only if the definition states it, or the
source could not meet one of the definition's obligations without it; source
that checks it is consistent with a definition, such as recognizing a form the
definition specifies in order to decide whether to run other behavior, relies
on that definition and calls for `{cite}`. A requirement stating a convention
for every output of a kind, such as every validation error, is implemented by
the source that carries out the convention as a whole, such as the step that
collects and reports those outputs.
- `{test}`: the source is designed to verify behavior the definition specifies:
a test through its scenario and the assertions about that scenario's outcome,
or a named example through the concrete case it describes.
- `{fixme}`: the source acknowledges a known gap in fulfilling the definition. It
MUST use the fenced form, and its body MUST describe the gap. The body MAY
begin with option lines naming issues that track the gap, one per line, in the
form `:github: <owner>/<repo>#<number>`, such as
`:github: rust-lang/rust#123`. `github` MUST be the only recognized option.
A named `{fixme}` MAY appear only in sources outside the book. Validation MUST report
any other option line, a `:github:` value not in that form, an inline
`{fixme}`, a `{fixme}` in a requirement or example declaration, and a
`{fixme}` whose body, without option lines and comment delimiters, is empty.
An unnamed `{fixme}`, a fence of `:::{fixme}` with no name, MAY appear in any
project text, including a requirement or example body, to tie that place to
the issues it names. It MUST have at least one `:github:` option line and MAY
have a description; it is not a reference edge, acknowledges no gap, needs no
coverage, and does not count as a reference for Rust item coverage. Its
issues are checked under {cite}`requirements.cli.fixme_issues`.
`{impl}`, `{test}`, and `{fixme}` are edges from the definition to the source.
Only requirements and examples are assessed; code is reviewed as part of the
definitions it implements or tests.
```text
{impl}`requirements.references.roles`
{cite}`requirements.references.roles`
{test}`requirements.references.roles`
```
:::
Input 4: requirements selection requirements.authoring.github_reads
requirements.authoring.github_reads:md/requirements/authoring.md:1091–1122
:::{req} github_reads
The harness MUST expose a `github` tool with this interface:
```text
github({ issue: String }) -> Issue
Issue { reference: String, state: "open" | "closed", title: String, body: String }
```
`issue` MUST have the form `<owner>/<repo>#<number>`. The tool MUST read the issue
or pull request through the GitHub API, authenticating with the `GITHUB_TOKEN`
environment variable when that is set, and MUST return its body redacted under
{cite}`requirements.authoring.redaction`. GitHub reads cannot be reproduced
later, so their results MUST NOT be recorded as evidence inputs and MUST NOT
make evidence stale. Every GitHub read by Habeas, including this tool's, the
lookups below, and those of {cite}`requirements.cli.fixme_issues`, MUST go
through one cache under the state root of
{cite}`requirements.configuration.state_location`, keyed by issue, and MUST
reuse a cached result less than one hour old instead of contacting GitHub. A malformed reference, a missing issue, or a failed request
MUST return an explanatory tool error.
When the mandatory inputs contain a `{fixme}` reference under
{cite}`requirements.references.roles`, or the initial request includes one under
{cite}`requirements.authoring.fixme_inputs`, the harness MUST look up the state of
each issue its `:github:` lines name in the same way and MUST supply each state
with the corresponding source input or acknowledgment as `open` or `closed`;
when GitHub cannot be reached, the issue MUST be assumed open. These states MUST
NOT be recorded either. Instead, `habeas status` and `habeas author` MUST treat a recorded FIXME determination as stale, exactly as if one of its inputs had changed, when an issue that one of its acknowledging `{fixme}` references names, or for a site review the `{fixme}` references inside the site, is closed or does not exist; repository validation, which never contacts GitHub, MUST NOT.
The harness MAY take the GitHub API base URL from `HABEAS_GITHUB_API_URL`,
accepting only `http://127.0.0.1:<port>`, so that tests can use a local server.
:::
Input 5: 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.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.
:::