Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

requirements.ci.determination

Requirements index · View definition

evidence Valid

Requirement

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.

Rationale

I judged this from the supplied test sources only. I did not request any implementation source.

Obligations derived from requirements.ci.determination, with the tests that cover each:

  1. true and FIXME satisfy the determination check.

    • tests/commands.rs#fn[fixme_fixture] writes FIXME records for two requirements and an example. Their issue lists mix linked and unlinked entries. It asserts that validate_repository returns no errors.
    • tests/outcomes.rs#fn[an_acknowledged_implementation_gap_records_its_issue] and fn[an_acknowledged_gap_without_an_issue_records_the_body_words] assert empty errors for FIXME records that match their {fixme} references.
    • tests/outcomes.rs#fn[fixme_examples_pass_without_test_references_but_true_examples_do_not] asserts a clean report for the example fixture. src/evidence.rs#mod[tests]/fn[a_false_determination_fails_only_its_own_record_with_its_rationale] asserts a clean outcome for a true record.
    • tests/authoring_batch.rs#fn[batch_fills_evidence_preserves_current_records_and_reauthors_only_changed_inputs] also validates clean with a FIXME record.
  2. A false determination fails validation and is reported with its rationale.

    • src/evidence.rs#mod[tests]/fn[a_false_determination_fails_only_its_own_record_with_its_rationale] asserts the exact error evidence/rules.refined.json: determination is false: Work remains: the refinement is untested. The rationale is trimmed.
    • tests/outcomes.rs#fn[an_unacknowledged_gap_beside_an_acknowledged_one_is_false] asserts the error with its rationale.
    • fn[fixme_examples_pass_without_test_references_but_true_examples_do_not] asserts “determination is false” for an example record.
    • src/evidence.rs#mod[tests]/fn[collects_missing_orphan_format_false_and_changed_line_errors] asserts “determination is false”.
  3. Each definition is checked on its own.

    • In fn[a_false_determination_fails_only_its_own_record_with_its_rationale], the false record rules.refined implements, tests and cites rules.ready. The assertion report.errors == [only the refined record's error] shows rules.ready is unaffected.
  4. FIXME does not excuse malformed, missing or stale evidence, or uncovered references.

    • tests/outcomes.rs#fn[fixme_does_not_excuse_missing_or_malformed_evidence] covers a FIXME record with an unknown field and a wrong example text. It also covers a deleted record, which gives “missing for example”.
    • fn[fixme_does_not_hide_stale_inputs_or_uncovered_references] covers a changed input (“outline input changed”) and an uncovered reference (“no input covers”).
    • fn[malformed_fixme_is_invalid_and_reports_the_required_shape] covers a malformed FIXME shape ({"FIXME": []}).
  5. Validation checks the recorded outcome, schema, freshness and coverage without inference.

    • fn[an_acknowledged_implementation_gap_records_its_issue] checks that FIXME entries must match the issues named by {fixme} references. Wrong forms, an unrelated issue, and plain FIXME/TODO comments or prose are all rejected.
    • The same test shows a reference-set change is detected and is not treated as an input-change error.
    • fn[an_acknowledged_gap_without_an_issue_records_the_body_words] rejects an invented issue number and a body-words entry that does not match the words joined by single spaces.

I found no requirement-violating behavior that these tests would accept. The requirement’s wording is clear enough that I found no ambiguity gap.

Inputs

Tests

Input 2: outline src/evidence.rs mod[tests]/fn[collects_missing_orphan_format_false_and_changed_line_errors]
  • File: src/evidence.rs
  • Selector: mod[tests]/fn[collects_missing_orphan_format_false_and_changed_line_errors]
  • Kind: fn
  • src/evidence.rs:2566–2667
    // {test}`requirements.integration.report_api`
    // {test}`requirements.ci.errors`
    // {test}`requirements.ci.diagnostics`
    // {test}`requirements.ci.input_containment`
    // {test}`requirements.ci.definition_errors`
    // {test}`requirements.ci.orphans`
    // {test}`requirements.ci.coverage`
    // {test}`requirements.ci.determination`
    // {test}`requirements.ci.outline_inputs`
    // {test}`requirements.ci.requirement_text`
    // {test}`requirements.ci.schema`
    #[test]
    fn collects_missing_orphan_format_false_and_changed_line_errors() {
        let temp = fixture();
        fs::write(
            temp.path().join("md/requirements.md"),
            "# Requirements\n\n:::{req} one\nFirst.\n:::\n\n:::{req} two\nSecond.\n:::\n\n:::{req} three\nThird.\n:::\n\n:::{req} one\nDuplicate.\n:::\n\n:::{req} empty\n  \n:::\n",
        )
        .unwrap();
        fs::write(
            temp.path().join("evidence/requirements.one.json"),
            json!({
                "requirement": "Old text.",
                "determination": false,
                "rationale": "Work remains.",
                "inputs": [
                    {
                        "file": "src/main.rs",
                        "item": "",
                        "hash": "0".repeat(64)
                    },
                    {
                        "file": "",
                        "item": 0,
                        "hash": "ABC"
                    },
                    {
                        "file": "src/main.rs",
                        "item": "fn[missing]",
                        "hash": "0".repeat(64)
                    },
                    {
                        "file": "src/main.rs",
                        "line_start": 1,
                        "line_end": 1,
                        "text": ["// first line"]
                    },
                    {
                        "requirements": "requirements.two",
                        "matches": ["requirements.two"],
                        "text": [1]
                    }
                ]
            })
            .to_string(),
        )
        .unwrap();
        fs::write(
            temp.path().join("evidence/requirements.three.json"),
            json!({"requirement": 3, "inputs": {}}).to_string(),
        )
        .unwrap();
        fs::write(
            temp.path().join("evidence/ghost.json"),
            json!({
                "requirement": "Ghost.",
                "determination": true,
                "rationale": "A valid but orphaned file.",
                "inputs": []
            })
            .to_string(),
        )
        .unwrap();
        fs::write(temp.path().join("evidence/broken.json"), "{").unwrap();

        let report = validate_repository(temp.path()).unwrap();
        let errors = report.errors.join("\n");
        for detail in [
            "no matching requirement",
            "invalid JSON",
            "missing for requirement",
            "requirement text changed",
            "- Old text.",
            "+ First.",
            "determination is false",
            "inputs[0]: outline input changed: src/main.rs <root> (now lines 1-2) no longer has the recorded hash",
            "inputs[1]: file must be a nonempty path",
            "inputs[1]: item must be a string",
            "inputs[1]: hash must be a lowercase hexadecimal SHA-256 digest",
            "inputs[2]: src/main.rs: no outline node matches \"fn[missing]\"",
            "inputs[3]: unexpected field \"line_start\"",
            "inputs[3]: missing field \"item\"",
            "inputs[4]: text[0] must be a string",
            "requirement must be a string",
            "missing field \"determination\"",
            "inputs must be an array",
            "duplicate requirement requirements.one; first declared at md/requirements.md:3",
            "requirement requirements.empty has no text",
        ] {
            assert!(errors.contains(detail), "missing {detail:?} in:\n{errors}");
        }
    }
Input 3: outline src/evidence.rs mod[tests]/fn[a_false_determination_fails_only_its_own_record_with_its_rationale]
  • File: src/evidence.rs
  • Selector: mod[tests]/fn[a_false_determination_fails_only_its_own_record_with_its_rationale]
  • Kind: fn
  • src/evidence.rs:3184–3222
    // {test}`requirements.ci.determination`
    #[test]
    // {test}`requirements.references.evidence_coverage`
    fn a_false_determination_fails_only_its_own_record_with_its_rationale() {
        let temp = fixture();
        let chapter = "# Rules\n\n:::{req} ready\nReady.\n:::\n\n:::{req} refined\nRefines {impl}`rules.ready`, {test}`rules.ready`, and {cite}`rules.ready`.\n:::\n";
        fs::write(temp.path().join("md/rules.md"), chapter).unwrap();
        fs::write(
            temp.path().join("evidence/rules.ready.json"),
            json!({
                "requirement": "Ready.",
                "determination": true,
                "rationale": "The refining requirement was examined.",
                "inputs": crate::inputs::outline_inputs_for_lines(temp.path(), "md/rules.md", 8, 8)
                    .unwrap()
            })
            .to_string(),
        )
        .unwrap();
        fs::write(
            temp.path().join("evidence/rules.refined.json"),
            json!({
                "requirement": chapter.lines().nth(7).unwrap(),
                "determination": false,
                "rationale": "  Work remains: the refinement is untested.  ",
                "inputs": []
            })
            .to_string(),
        )
        .unwrap();
        let report = validate_repository(temp.path()).unwrap();
        assert_eq!(
            report.errors,
            [
                "evidence/rules.refined.json: determination is false: Work remains: the refinement is untested."
            ],
            "the implemented, tested, and cited requirement is unaffected"
        );
    }
Input 4: outline tests/authoring_batch.rs fn[batch_fills_evidence_preserves_current_records_and_reauthors_only_changed_inputs]
  • File: tests/authoring_batch.rs
  • Selector: fn[batch_fills_evidence_preserves_current_records_and_reauthors_only_changed_inputs]
  • Kind: fn
  • tests/authoring_batch.rs:531–686
// {test}`requirements.authoring.batch`
// {test}`requirements.authoring.concurrency`
// {test}`requirements.authoring.usage_storage`
// {test}`requirements.ci.determination`
// {test}`requirements.authoring.progress`
// {test}`requirements.configuration.loading`
// {test}`requirements.authoring.configuration`
// {test}`requirements.authoring.refresh`
// {test}`requirements.authoring.persistence`
#[test]
fn batch_fills_evidence_preserves_current_records_and_reauthors_only_changed_inputs() {
    let server = Server::start(true, None);
    let fixture = Fixture::new(&server.endpoint, Some(2));
    let source = fixture.project.join("src/lib.rs");
    fs::write(
        &source,
        format!(
            "{}\n// {{test}}`requirements.alpha`\n#[test]\nfn alpha_requirement() {{ assert_eq!(alpha(), 1); }}\n",
            fs::read_to_string(&source).unwrap().replace(
                "pub fn beta()",
                "// :::{fixme} requirements.beta\n// :github: example/app#123\n// Beta has no test yet.\n// :::\npub fn beta()",
            )
        ),
    )
    .unwrap();
    let output = fixture.run(&["author", "--all", "--config", "mock"]);
    assert!(
        output.status.success(),
        "{}",
        String::from_utf8_lossy(&output.stderr)
    );
    assert_eq!(server.subjects().len(), 6);
    let report = habeas::validate_repository(&fixture.project).unwrap();
    assert!(report.errors.is_empty(), "{:?}", report.errors);
    assert!(!fixture.project.join("evidence/rust").exists());
    let mut beta = fixture.evidence("requirements.beta");
    beta["determination"] = json!({"FIXME":["example/app#123"]});
    beta["rationale"] = "The source explicitly acknowledges the missing beta test.".into();
    fs::write(
        fixture.project.join("evidence/requirements.beta.json"),
        serde_json::to_vec_pretty(&beta).unwrap(),
    )
    .unwrap();
    let example = fixture.evidence("requirements.alpha_case");
    let gamma = fixture.evidence("requirements.gamma");
    let gamma_case = fixture.evidence("requirements.gamma_case");
    for (record, name) in [(&example, "alpha_case"), (&gamma_case, "gamma_case")] {
        assert!(record.get("requirement").is_none(), "{record}");
        assert!(
            record["example"]
                .as_str()
                .unwrap()
                .contains(name.split('_').next().unwrap()),
            "{record}"
        );
    }
    let usage = fixture.usage();
    assert_eq!(usage.len(), 6);
    assert!(
        usage
            .iter()
            .all(|run| run["outcome"] == "completed" && run["evidence_written"] == true)
    );
    {
        let requests = server.requests.0.lock().unwrap();
        assert_eq!(
            requests.peak, 2,
            "the configured concurrency bounds in-flight requests"
        );
        assert!(
            requests.first_pair_overlapped,
            "a second assessment must start before the first model response"
        );
    }

    fs::write(&fixture.config, "invalid TOML [").unwrap();
    let no_op = fixture.run(&["author", "--all"]);
    assert!(
        no_op.status.success(),
        "{}",
        String::from_utf8_lossy(&no_op.stderr)
    );
    fs::remove_file(&fixture.config).unwrap();
    let no_config = fixture.run(&["author", "--all"]);
    assert!(
        no_config.status.success(),
        "{}",
        String::from_utf8_lossy(&no_config.stderr)
    );
    #[cfg(unix)]
    {
        let no_op_terminal = fixture.run_in_pty(false, "xterm-256color");
        assert!(
            no_op_terminal.status.success(),
            "{}",
            String::from_utf8_lossy(&no_op_terminal.stderr)
        );
        assert_eq!(
            String::from_utf8_lossy(&no_op_terminal.stdout).trim(),
            "0 authored; 6 skipped as current; 0 failed"
        );
        assert!(!String::from_utf8_lossy(&no_op_terminal.stderr).contains("0/0 finished"));
    }
    assert_eq!(server.subjects().len(), 6);
    assert_eq!(fixture.usage().len(), 6);

    fs::write(&fixture.config, &fixture.config_text).unwrap();
    let changed = fs::read_to_string(&source)
        .unwrap()
        .replace("-> u8 { 1 }", "-> u8 { 1_u8 }");
    fs::write(&source, changed).unwrap();
    let unread_change = fixture.run(&["author", "--all"]);
    assert!(unread_change.status.success(), "{unread_change:?}");
    assert_eq!(server.subjects().len(), 6);
    fs::write(
        &source,
        fs::read_to_string(&source).unwrap().replace(
            "fn alpha_requirement() { assert_eq!(alpha(), 1); }",
            "fn alpha_requirement() { assert_eq!(alpha(), 1_u8); }",
        ),
    )
    .unwrap();
    #[cfg(unix)]
    let updated = fixture.run_in_pty(false, "xterm-256color");
    #[cfg(not(unix))]
    let updated = fixture.run(&["author", "--all"]);
    #[cfg(unix)]
    {
        let escape = regex::Regex::new(r"\x1b\[[0-?]*[ -/]*[@-~]").unwrap();
        let raw = String::from_utf8_lossy(&updated.stderr);
        let plain = escape.replace_all(&raw, "");
        assert!(plain.contains("1/1 finished"), "{plain}");
        assert!(!plain.contains("6/6 finished"), "{plain}");
    }
    assert!(
        updated.status.success(),
        "{}",
        String::from_utf8_lossy(&updated.stderr)
    );
    assert_eq!(server.subjects().len(), 7);
    assert_eq!(
        server.subjects().last().unwrap(),
        "requirement requirements.alpha"
    );
    assert_eq!(fixture.usage().len(), 7);
    assert_eq!(
        String::from_utf8_lossy(&updated.stdout).trim(),
        "1 authored; 5 skipped as current; 0 failed; policy once"
    );
    assert_eq!(fixture.evidence("requirements.beta"), beta);
    assert_eq!(fixture.evidence("requirements.alpha_case"), example);
    assert_eq!(fixture.evidence("requirements.gamma"), gamma);
    assert_eq!(fixture.evidence("requirements.gamma_case"), gamma_case);
    let report = habeas::validate_repository(&fixture.project).unwrap();
    assert!(report.errors.is_empty(), "{:?}", report.errors);
}
Input 5: outline tests/authoring_batch.rs fn[batch_preserves_current_false_judgments_and_reauthors_stale_ones]
// {test}`requirements.authoring.batch`
// {test}`requirements.ci.determination`
// {test}`requirements.authoring.refresh`
#[test]
fn batch_preserves_current_false_judgments_and_reauthors_stale_ones() {
    let server = Server::start(false, None);
    let fixture = Fixture::new(&server.endpoint, Some(2));
    let source = fixture.project.join("src/lib.rs");
    let original = fs::read_to_string(&source).unwrap();
    fs::write(
        &source,
        format!(
            "{original}\n// {{test}}`requirements.gamma`\n#[test]\nfn gamma_requirement() {{ assert_eq!(gamma(), 3); }}\n"
        ),
    )
    .unwrap();
    let output = fixture.run(&["author", "--all"]);
    assert!(
        output.status.success(),
        "{}",
        String::from_utf8_lossy(&output.stderr)
    );
    assert_eq!(server.subjects().len(), 6);
    let mark_false = |name: &str| {
        let path = fixture.project.join(format!("evidence/{name}.json"));
        let mut record = fixture.evidence(name);
        record["determination"] = json!(false);
        record["rationale"] = json!("The tests omit a boundary case.");
        fs::write(&path, serde_json::to_vec_pretty(&record).unwrap()).unwrap();
        fs::read(path).unwrap()
    };
    let alpha = mark_false("requirements.alpha");
    mark_false("requirements.gamma");

    let current = fixture.run(&["author", "--all"]);
    assert!(
        current.status.success(),
        "{}",
        String::from_utf8_lossy(&current.stderr)
    );
    assert_eq!(server.subjects().len(), 6, "{:?}", server.subjects());
    assert_eq!(
        String::from_utf8_lossy(&current.stdout).trim(),
        "0 authored; 6 skipped as current; 0 failed"
    );
    assert_eq!(
        fs::read(fixture.project.join("evidence/requirements.alpha.json")).unwrap(),
        alpha
    );
    assert_eq!(
        fixture.evidence("requirements.gamma")["determination"],
        false
    );

    fs::write(
        &source,
        fs::read_to_string(&source).unwrap().replace(
            "fn gamma_requirement() { assert_eq!(gamma(), 3); }",
            "fn gamma_requirement() { assert_eq!(gamma(), 3_u8); }",
        ),
    )
    .unwrap();
    let stale = fixture.run(&["author", "--all"]);
    assert!(
        stale.status.success(),
        "{}",
        String::from_utf8_lossy(&stale.stderr)
    );
    let subjects = server.subjects();
    assert_eq!(subjects.len(), 7, "{subjects:?}");
    assert_eq!(subjects[6], "requirement requirements.gamma");
    assert_eq!(
        String::from_utf8_lossy(&stale.stdout).trim(),
        "1 authored; 5 skipped as current; 0 failed; policy once"
    );
    assert_eq!(
        fixture.evidence("requirements.gamma")["determination"],
        true
    );
    assert_eq!(
        fs::read(fixture.project.join("evidence/requirements.alpha.json")).unwrap(),
        alpha
    );
    let forced = fixture.run(&["author", "requirements.alpha", "--force"]);
    assert!(forced.status.success(), "{forced:?}");
    assert_eq!(server.subjects().len(), 8);
    assert_eq!(
        fixture.evidence("requirements.alpha")["determination"],
        true
    );
}
Input 6: outline tests/commands.rs fn[fixme_fixture]
// {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 7: outline tests/outcomes.rs fn[fixme_examples_pass_without_test_references_but_true_examples_do_not]
  • File: tests/outcomes.rs
  • Selector: fn[fixme_examples_pass_without_test_references_but_true_examples_do_not]
  • Kind: fn
  • tests/outcomes.rs:144–168
// {test}`requirements.ci.determination`
// {test}`requirements.examples.evidence`
// {test}`requirements.ci.fixme_example_test_gaps`
#[test]
fn fixme_examples_pass_without_test_references_but_true_examples_do_not() {
    let temp = fixture();
    let report = habeas::validate_repository(temp.path()).unwrap();
    assert!(report.errors.is_empty(), "{:?}", report.errors);
    replace_judgment(temp.path(), "timeout", json!(true));
    let report = habeas::validate_repository(temp.path()).unwrap();
    assert!(
        report
            .errors
            .iter()
            .any(|error| error.contains("no {test} reference"))
    );
    replace_judgment(temp.path(), "timeout", json!(false));
    let report = habeas::validate_repository(temp.path()).unwrap();
    assert!(
        report
            .errors
            .iter()
            .any(|error| error.contains("determination is false"))
    );
}
Input 8: outline tests/outcomes.rs fn[an_acknowledged_implementation_gap_records_its_issue]
// {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 9: 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 10: outline tests/outcomes.rs fn[an_unacknowledged_gap_beside_an_acknowledged_one_is_false]
// {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 11: outline tests/outcomes.rs fn[malformed_fixme_is_invalid_and_reports_the_required_shape]
// {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 12: outline tests/outcomes.rs fn[fixme_does_not_excuse_missing_or_malformed_evidence]
// {test}`requirements.ci.determination`
#[test]
fn fixme_does_not_excuse_missing_or_malformed_evidence() {
    let temp = fixture();
    let errors = |root: &Path| habeas::validate_repository(root).unwrap().errors;
    assert!(errors(temp.path()).is_empty(), "{:?}", errors(temp.path()));
    let path = temp.path().join("evidence/requirements.timeout.json");
    let original: Value = serde_json::from_str(&fs::read_to_string(&path).unwrap()).unwrap();

    // A malformed record judged FIXME: an unknown field and a wrong example
    // text are each still reported.
    let mut malformed = original.clone();
    malformed["extra"] = json!(1);
    malformed["example"] = json!("Timeout handling does not retry.");
    fs::write(&path, serde_json::to_string_pretty(&malformed).unwrap()).unwrap();
    let found = errors(temp.path());
    for expected in ["unexpected field \"extra\"", "example text changed"] {
        assert!(
            found.iter().any(
                |error| error.starts_with("evidence/requirements.timeout.json")
                    && error.contains(expected)
            ),
            "missing {expected:?}: {found:#?}"
        );
    }

    // A definition whose gap a {fixme} acknowledges still needs evidence.
    fs::remove_file(&path).unwrap();
    let found = errors(temp.path());
    assert!(
        found
            .iter()
            .any(|error| error
                .starts_with("evidence/requirements.timeout.json: missing for example")),
        "{found:#?}"
    );
}
Input 13: outline tests/outcomes.rs fn[fixme_does_not_hide_stale_inputs_or_uncovered_references]
// {test}`requirements.ci.outline_inputs`
// {test}`requirements.ci.determination`
// {test}`requirements.references.evidence_coverage`
// {test}`requirements.ci.fixme_stale_input`
// {test}`requirements.index.state`
// {test}`requirements.cli.fixme_summary`
#[test]
fn fixme_does_not_hide_stale_inputs_or_uncovered_references() {
    let temp = fixture();
    let observed = temp.path().join("observed.rs");
    let source = fs::read_to_string(&observed).unwrap();
    fs::write(&observed, source.replace("= 1;", "= 2;")).unwrap();
    let report = habeas::validate_repository(temp.path()).unwrap();
    assert!(
        report
            .errors
            .iter()
            .any(|error| error.contains("outline input changed: observed.rs <root>")),
        "{:?}",
        report.errors
    );
    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("example/io#125"), "{status}");
    assert!(status.contains("outline input changed"), "{status}");
    fs::write(
        temp.path().join("other.txt"),
        "{test}`requirements.timeout`",
    )
    .unwrap();
    let report = habeas::validate_repository(temp.path()).unwrap();
    assert!(
        report
            .errors
            .iter()
            .any(|error| error.contains("no input covers") && error.contains("other.txt:1"))
    );
}

Other sources

Input 1: requirements selection requirements.ci.determination
:::{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.
:::