requirements.ci.fixme_implementation_gap
Requirements index · View definition
Example
A queue requirement says insertion into a full queue returns
Full, including when its capacity is zero. The implementation handles positive capacities but contains this reference:// :::{fixme} requirements.queue.full // :github: example/queue#125 // Capacity-zero insertion does not return Full yet and has no test. // :::The tests cover positive capacities but omit zero-capacity insertion. The reviewer identifies that missing test as a gap and finds no other testing gaps. The judgment is
{"FIXME": ["example/queue#125"]}, with a rationale explaining the zero-capacity gap and locating the comment. The initial request supplies the acknowledgment without the containing implementation source, and the reference-set digest covers its location and body. Recorded inputs cover the reviewed tests. CI accepts the evidence when all other checks pass.![]()
Rationale
The example describes a concrete case: a queue requirement, a {fixme} comment naming example/queue#125 for the zero-capacity gap, and tests that omit zero-capacity insertion. It states the expected outcomes. These are a {"FIXME": ["example/queue#125"]} judgment with a rationale, an acknowledgment supplied without the containing implementation, a reference-set digest covering location and body, recorded inputs for the reviewed tests, and CI acceptance. Two {test} items cover these outcomes.
tests/outcomes.rs#fn[an_acknowledged_implementation_gap_records_its_issue]
- It uses the example’s own comment: a
fixmeon the requirement withexample/queue#125and the body “Capacity-zero insertion does not return Full yet and has no test.” A FIXME judgment naming that issue produces no validation errors. - It removes the implementation-source input (
reviewed.rs) from the record. Validation still passes, so the acknowledgment is accepted without the containing implementation source. - Editing the comment body (“has no test” to “has no boundary test”) produces a
reference set changederror and nooutline input changederror. The digest therefore covers the body and does not depend on recorded implementation inputs. - Moving the same comment to
relocated.rsalso producesreference set changed, so the digest covers the location. - The issue strings
#125,FIXME(example/queue#125)and the wrong repositoryexample/io#125are each rejected with “is neither an issue named by a {fixme}”. The accepted string is therefore the issue as written after:github:. - A plain
FIXMEcomment, aTODOcomment and prose naming the issue are each rejected. Only a{fixme}reference acknowledges the gap.
tests/authoring_cli.rs#fn[ollama_cli_delivers_sources_records_fixme_and_keeps_usage_content_free]
- The initial prompt contains the acknowledgment metadata (
:github: example/app#125, the body “One acknowledged gap.”, and the issue state). It does not contain the implementation sourcepub fn ready(). - The model’s FIXME judgment and its rationale, which cites
src/lib.rs#fn[ready], are stored in the evidence file. - The recorded inputs include the reviewed test
fn[ready_test]and exclude the implementationfn[ready]. habeas::validate_repositoryreports no error for the evidence file with the FIXME determination. After the determination is changed tofalse, it reports an error for that file. This covers CI acceptance of FIXME and rejection of false.
The reviewer’s identification of the zero-capacity gap is model behavior. The tests check the rationale is recorded verbatim and that the judgment is validated. I found no test-adequacy gap against the example’s stated outcomes.
Inputs
Tests
Input 4: outline tests/authoring_cli.rs fn[ollama_cli_delivers_sources_records_fixme_and_keeps_usage_content_free]
- File:
tests/authoring_cli.rs - Selector:
fn[ollama_cli_delivers_sources_records_fixme_and_keeps_usage_content_free] - Kind:
fn tests/authoring_cli.rs:366–676
// {test}`requirements.authoring.complete_initial_bundle`
// {test}`requirements.authoring.invocation`
// {test}`requirements.authoring.additional_read`
// {test}`requirements.authoring.acknowledged_gap`
// {test}`requirements.authoring.configuration_precedence`
// {test}`requirements.authoring.rig_configuration_mapping`
// {test}`requirements.authoring.configuration_storage`
// {test}`requirements.authoring.initial_prompt`
// {test}`requirements.ci.review_criteria`
// {test}`requirements.authoring.delivered_inputs`
// {test}`requirements.authoring.usage_storage`
// {test}`requirements.authoring.usage_inputs`
// {test}`requirements.authoring.usage_requests`
// {test}`requirements.authoring.mandatory_inputs`
// {test}`requirements.authoring.github_reads`
// {test}`requirements.authoring.invocation`
// {test}`requirements.configuration.serialization`
// {test}`requirements.ci.fixme_implementation_gap`
// {test}`requirements.authoring.finish_search.empty`
// {test}`requirements.authoring.finish_search.completion`
#[test]
// {test}`requirements.authoring.persistence`
// {test}`requirements.authoring.reporting`
fn ollama_cli_delivers_sources_records_fixme_and_keeps_usage_content_free() {
let server = Server::start(vec![
reply(vec![
call("list", "list_files", json!({})),
call(
"search",
"ripgrep",
json!({"path":"extra.txt","pattern":"needle"}),
),
call(
"read",
"habeas",
json!({"file":"extra.txt","line_start":10}),
),
call(
"repeat",
"habeas",
json!({"file":"extra.txt","line_start":10}),
),
call(
"missing",
"habeas",
json!({"file":"absent.txt","line_start":1}),
),
]),
json!({"__finish_latest_search":true}),
reply(vec![call(
"submit",
"submit_judgment",
json!({
"determination":{"FIXME":["example/app#125"]},"rationale":"SECRET_RATIONALE: `src/lib.rs#fn[ready]` documents the gap."}),
)]),
]);
let fixture = Fixture::new(&server.endpoint);
let user_config = fixture.config.join("habeas/config.toml");
let configured = fs::read(&user_config).unwrap();
let output = fixture.run(&["author-evidence", SUBJECT]);
assert!(
output.status.success(),
"{}",
String::from_utf8_lossy(&output.stderr)
);
// The user configuration, with its environment-resolved key, is not
// rewritten.
assert_eq!(fs::read(&user_config).unwrap(), configured);
let requests = server.finish();
assert_eq!(requests.len(), 3);
for request in &requests {
assert!(request.headers.starts_with("POST /api/chat HTTP/1.1\r\n"));
assert!(request.headers.to_ascii_lowercase().contains(&format!(
"authorization: bearer {}",
AUTH.to_ascii_lowercase()
)));
assert_eq!(request.body["model"], MODEL);
assert_eq!(request.body["options"]["temperature"], 0.25);
assert_eq!(request.body["options"]["num_ctx"], 4096);
assert_eq!(request.body["think"], false);
assert_eq!(request.body["stream"], false);
}
let prompt = prompt_text(&requests[0].body);
for text in [
"Assess whether a project's tests adequately check one requirement.",
REQUIREMENT,
"SECRET_DEFINITION_TEXT",
"fn ready_test()",
"You MUST end by calling submit_judgment",
] {
assert!(prompt.contains(text), "prompt missing {text}");
}
assert!(!prompt.contains("pub fn ready()"), "{prompt}");
assert!(!prompt.contains("OLD_RATIONALE_MUST_NOT_REACH_MODEL"));
let mut tools = requests[0].body["tools"]
.as_array()
.unwrap()
.iter()
.map(|tool| tool["function"]["name"].as_str().unwrap())
.collect::<Vec<_>>();
tools.sort();
assert_eq!(
tools,
[
"ast_grep",
"finish_search",
"github",
"habeas",
"list_files",
"next_page",
"outline",
"references",
"ripgrep",
"submit_judgment"
]
);
let results = requests[1].body["messages"]
.as_array()
.unwrap()
.iter()
.filter(|message| message["role"] == "tool")
.collect::<Vec<_>>();
assert_eq!(results.len(), 5);
assert!(results.iter().any(|message| {
message["content"]
.as_str()
.unwrap()
.contains("SECRET_SOURCE_PAYLOAD")
}));
assert!(
results
.iter()
.any(|message| message["content"].as_str().unwrap().contains("absent.txt"))
);
let evidence: Value = serde_json::from_slice(&fs::read(&fixture.evidence).unwrap()).unwrap();
assert_eq!(
evidence["determination"],
json!({"FIXME":["example/app#125"]})
);
assert_eq!(
evidence["rationale"],
"SECRET_RATIONALE: `src/lib.rs#fn[ready]` documents the gap."
);
assert_eq!(evidence["requirement"], REQUIREMENT);
let inputs = evidence["inputs"].as_array().unwrap();
assert!(
inputs
.iter()
.any(|input| input["file"] == "src/lib.rs" && input["item"] == "fn[ready_test]"),
"{inputs:#?}"
);
// The acknowledgment reaches the model as metadata, without the
// containing implementation. Its body is protected by the reference set.
assert!(prompt.contains(":github: example/app#125"));
assert!(prompt.contains("One acknowledged gap."));
// GitHub is unreachable, so the issue is supplied as open, but the state
// is not recorded.
assert!(
prompt.contains("\"reference\": \"example/app#125\"")
&& prompt.contains("\"state\": \"open\""),
"{prompt}"
);
assert!(!evidence.to_string().contains("github_issues"));
assert!(!fixture.usage().to_string().contains("github_issues"));
assert!(
!inputs
.iter()
.any(|input| input["file"] == "src/lib.rs" && input["item"] == "fn[ready]"),
"{inputs:#?}"
);
// CI accepts the FIXME judgment: its evidence has no validation error.
let report = habeas::validate_repository(&fixture.project).unwrap();
let label = format!("evidence/{SUBJECT}.json");
assert!(
!report.errors.iter().any(|error| error.contains(&label)),
"{:#?}",
report.errors
);
// The same record with a false determination is rejected.
let mut rejected = evidence.clone();
rejected["determination"] = json!(false);
let accepted = fs::read(&fixture.evidence).unwrap();
fs::write(&fixture.evidence, rejected.to_string()).unwrap();
let report = habeas::validate_repository(&fixture.project).unwrap();
assert!(
report.errors.iter().any(|error| error.contains(&label)),
"{:#?}",
report.errors
);
fs::write(&fixture.evidence, accepted).unwrap();
assert!(
inputs
.iter()
.any(|input| input["definition"] == "terms.readiness")
);
let extra = inputs
.iter()
.filter(|input| input["file"] == "extra.txt")
.collect::<Vec<_>>();
// The search only locates lines and records nothing; the reads cover
// lines 10-12, one plain-text line node each, and the repeated delivery
// is recorded once, by selector and hash only.
assert_eq!(
extra,
habeas::outline_inputs_for_lines(&fixture.project, "extra.txt", 10, 12)
.unwrap()
.iter()
.collect::<Vec<_>>(),
"repeated delivery is deduplicated in evidence"
);
assert!(
!evidence["inputs"]
.to_string()
.contains("SECRET_SOURCE_PAYLOAD")
);
assert!(
!inputs
.iter()
.any(|input| input["file"] == "absent.txt" || input["file"] == ".")
);
let usage = fixture.usage();
assert_eq!(usage["outcome"], "completed");
assert_eq!(usage["determination"], "FIXME");
assert_eq!(usage["evidence_written"], true);
assert_eq!(usage["request_count"], 3);
assert_eq!(usage["tool_call_count"], 7);
assert_eq!(usage["tool_calls"]["habeas"], 3);
assert_eq!(usage["tool_failures"]["habeas"], 1);
// The directory listing counts as a tool call but is not an input.
assert_eq!(usage["tool_calls"]["list_files"], 1);
assert_eq!(usage["tool_calls"]["ripgrep"], 1);
assert_eq!(usage["tool_calls"]["finish_search"], 1);
let usage_inputs = usage["inputs"].as_array().unwrap();
assert!(
!usage_inputs
.iter()
.any(|input| input["origin"] == "list_files"),
"{usage_inputs:?}"
);
// Search snippets count toward usage, without becoming evidence inputs.
assert!(
usage_inputs.iter().any(|input| input["origin"] == "ripgrep"
&& input["kind"] == "search"
&& input["bytes"].as_u64().unwrap() > 0
&& input["lines"].as_u64().unwrap() > 0),
"{usage_inputs:?}"
);
assert!(
usage_inputs
.iter()
.any(|input| input["origin"] == "habeas" && input["unique"] == true),
"{usage_inputs:?}"
);
assert_eq!(usage["tokens"]["input"], 33);
assert_eq!(usage["tokens"]["output"], 21);
assert_eq!(usage["tokens"]["complete"], true);
assert!(
usage["inputs"]
.as_array()
.unwrap()
.iter()
.any(|input| input["origin"] == "habeas"
&& input["unique"] == false
&& input["sent_in_request"] == 1)
);
assert!(
usage["inputs"]
.as_array()
.unwrap()
.iter()
.any(|input| input["origin"] == "mandatory"
&& input["kind"] == "definition"
&& input["bytes"].as_u64().unwrap() > 0)
);
let serialized = usage.to_string();
for secret in [
"SECRET_REQUIREMENT_TEXT",
"SECRET_DEFINITION_TEXT",
"SECRET_SOURCE_PAYLOAD",
"SECRET_RATIONALE",
AUTH,
"#125",
] {
assert!(
!serialized.contains(secret),
"usage contains source or credential content: {secret}"
);
}
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(stdout.contains(MODEL) && stdout.contains("Evidence:") && stdout.contains("Usage:"));
// By default the report names the subject and backend and identifies the
// evidence file it wrote.
assert!(
stdout.starts_with(&format!("{SUBJECT}: ollama / {MODEL}")),
"{stdout}"
);
let evidence = stdout
.lines()
.find_map(|line| line.strip_prefix("Evidence: "))
.unwrap();
assert!(
evidence.ends_with(&format!("evidence/{SUBJECT}.json")),
"{stdout}"
);
assert_eq!(
fs::canonicalize(evidence).unwrap(),
fs::canonicalize(fixture.project.join(format!("evidence/{SUBJECT}.json"))).unwrap()
);
}
Input 5: 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:?}"
);
}
}
Referenced definitions
Input 2: requirements selection requirements.ci.outcomes
requirements.ci.outcomes:md/requirements/ci.md:112–149
:::{req} outcomes
Every assessment judgment MUST use one of these outcomes, applying
{cite}`requirements.ci.review_criteria`:
- `true`: the reviewed tests adequately check a requirement or example under
{cite}`requirements.ci.review_criteria`, including applicable testing
exemptions and obligations assessed by a refining requirement or a site's
own review. For a citation or site review, the review finds no gap under its
own task.
- `false`: the sources do not support the subject, or information is missing,
and the gaps are not all acknowledged by `{fixme}` references to it.
- `FIXME`: some aspects remain unmet or untested, and `{fixme}` references to
the subject acknowledge every one of those gaps. The reviewer MUST explain the
gaps and their source locations in the rationale and record their issue
references or other identifying content from the supplied acknowledgments or
inputs.
The JSON `determination` MUST be `true`, `false`, or an object containing exactly
`"FIXME"` with a nonempty array of nonempty strings, such as
`{"FIXME": ["example/queue#125", "rust-lang/rust#123"]}`. A gap MUST count as
acknowledged only by a `{fixme}` reference under
{cite}`requirements.references.roles` whose body describes that gap and that
references the assessed definition, or, for a site review, the distributed requirement from within that site; a citation review MUST NOT accept a `{fixme}`; a plain
`FIXME` comment, another marker such as `TODO`, or prose MUST NOT. The strings
MUST list each distinct issue reference the acknowledging `{fixme}` references
name in their option lines, as written after `:github:`, and, for a `{fixme}`
naming no issue, its body's words, without comment delimiters, joined by single
spaces. A `{fixme}` reference describing a gap that the review establishes no
longer exists within its task's scope MUST itself be treated as a gap. A reference
describing only an implementation defect MUST NOT create a test-adequacy gap or
require implementation review; it MUST acknowledge a testing gap only when its
body describes that same gap. A `{fixme}` naming a GitHub issue that
{cite}`requirements.authoring.github_reads` reports closed MUST NOT count as
acknowledging its gap. A FIXME judgment MUST be grounded in recorded evidence
inputs or, for an acknowledgment supplied under
{cite}`requirements.authoring.fixme_inputs`, the reference-set digest covering
that acknowledgment.
:::
Input 3: requirements selection requirements.ci.determination
requirements.ci.determination:md/requirements/ci.md:19–21
:::{req} determination
For requirement and example evidence, both `true` and `FIXME` MUST satisfy the determination check in `habeas::validate()`. A false determination MUST fail validation and be reported with its rationale. Each definition's determination MUST be checked on its own; a false determination MUST NOT fail the definitions it implements, tests, or cites. All other evidence checks MUST still pass: FIXME MUST NOT excuse malformed, missing, or stale evidence or uncovered references. Validation MUST check the recorded outcome, schema, input freshness, and reference coverage without inference or reassessing whether a source comment adequately acknowledges a gap.
:::
Other sources
Input 1: requirements selection requirements.ci.fixme_implementation_gap
requirements.ci.fixme_implementation_gap:md/requirements/ci.md:357–378
:::{example} fixme_implementation_gap
A queue requirement says insertion into a full queue returns `Full`, including
when its capacity is zero. The implementation handles positive capacities but
contains this reference:
```text
// :::{fixme} requirements.queue.full
// :github: example/queue#125
// Capacity-zero insertion does not return Full yet and has no test.
// :::
```
The tests cover positive capacities but omit zero-capacity insertion. The
reviewer identifies that missing test as a gap and finds no other testing gaps.
The judgment is `{"FIXME": ["example/queue#125"]}`, with a rationale explaining the zero-capacity
gap and locating the comment. The initial request supplies the acknowledgment
without the containing implementation source, and the reference-set digest
covers its location and body. Recorded inputs cover the reviewed tests.
CI accepts the evidence when all other checks pass.
{cite}`requirements.ci.outcomes`
{cite}`requirements.ci.determination`
:::