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.cli.status

Requirements index · View definition

evidence Valid

Requirement

habeas status [<selection>] [--all] [--verbose] [--coverage] MUST consider requirements and named examples matched by the definition selection; without a selection it MUST consider every definition. By default, it MUST list matching definitions in full-name order when their evidence is missing, has a false determination, or fails the same evidence and reference checks as habeas::validate(). It MUST summarize FIXME judgments under cite requirements.cli.fixme_summary, with accepted FIXME subjects listed individually only when --verbose or --all is selected. --all MUST list every matching definition with its kind and evidence state. Every form MUST show validation findings, the coverage report under cite requirements.references.coverage.report, using its node-count summary by default and showing individual warnings and coverage-history details only with --coverage, work from within a Cargo and mdBook project, and report invalid arguments or a supplied selection matching no definition clearly. When files that reference discovery does not consider because they are untracked in a Git worktree contain references, habeas status MUST list them with a reminder to stage them with git add. Every form MUST also list, in a “Disagreements” section, each selected definition, citation review, and site review whose recorded rationale states that its assessments disagreed under cite requirements.authoring.confirmation, so those findings are visible although validation accepts them.

Rationale

The {test}-marked tests cover every obligation in requirements.cli.status. I found no unaddressed gap.

  • Selection and default listing.
    • tests/commands.rs#fn[status_lists_nonvalid_requirements_and_all_option_in_name_order] runs status from a nested directory. It asserts rows for the Missing, Invalid (malformed, stale, stale_input, uncovered) and Determination false states, and asserts that the Valid ready and xready rows are absent. It also checks the reason texts.
    • fn[status_and_info_accept_a_definition_selection] and fn[commands_report_invalid_arguments_and_unmatched_selectors] test glob and exact-name selection, and that a glob such as requirements.*ready matches multiple definitions.
    • fn[status_groups_fixme_judgments_by_distinct_exact_issue] runs status with no selection against a fixture of FIXME definitions, and fn[status_lists_nonvalid_requirements_and_all_option_in_name_order] does the same against its fixture. In both, every definition is considered.
    • Full-name order is asserted only for --all. The default listing is checked by presence only. I treated order as shared behavior and not a separate gap.
  • Same evidence and reference checks as validate(). fn[status_applies_workspace_disallow_to_existing_evidence] covers a disallowed evidence input. fn[status_loads_nearest_workspace_file_without_validating_authoring] covers an invalid or malformed workspace file, which status reports as validation findings while it still succeeds. The fn[status_lists_nonvalid_requirements_and_all_option_in_name_order] assertions cover stale text, stale input and uncovered inputs.
  • FIXME summary and --verbose/--all.
    • The fn[status_groups_fixme_judgments_by_distinct_exact_issue] assertions cover the grouping, counts, ordering, exact-string matching and the “without an issue” group placed last. They also check that accepted FIXME subjects are not listed by default and are listed by --all.
    • fn[verbose_status_lists_fixme_judgments_and_globs_scope_issue_groups] covers --verbose listing each subject’s kind and original strings, and selection scoping the counts.
    • tests/outcomes.rs#fn[valid_fixme_remains_visible_in_status_info_and_book] adds that a valid FIXME is summarized without validation findings.
  • --all lists every definition with its kind ((example), (requirement)) and state (Valid). Both fn[status_lists_nonvalid_requirements_and_all_option_in_name_order] and fn[status_and_info_accept_a_definition_selection] assert this.
  • Coverage report. fn[status_preserves_repository_wide_rust_findings_in_every_form] runs every flag, selection and --coverage combination. It asserts the “N nodes have coverage warnings” summary by default and no individual warnings. With --coverage it asserts the “## Coverage warnings” section with file, line, kind and name. The “Coverage history is incomplete” detail is tested through tests/coverage.rs (fn[status_shows_coverage_warnings_and_says_when_history_is_incomplete], fn[incomplete_history_is_noted_even_with_nothing_to_warn_about]). Those tests are marked for the cited coverage.report requirement, so they need no re-assessment here.
  • Working from within a Cargo and mdBook project. This is checked from a nested directory and from outside any project. fn[commands_report_invalid_arguments_and_unmatched_selectors] asserts the “cannot find a project with Cargo.toml and book.toml” error.
  • Invalid arguments and an unmatched selection. fn[commands_report_invalid_arguments_and_unmatched_selectors] asserts the usage error for bad arguments, “invalid definition glob” for a malformed glob, and “no definitions match” for a selection that matches nothing.
  • Untracked files. tests/references.rs#fn[untracked_sources_are_not_validated_until_staged_and_status_lists_them] asserts the “## Untracked files with references” section, the git add reminder, and the untracked file with references listed. It also asserts that an untracked file without references is not listed, and that the section disappears once the file is staged.
  • Disagreements. src/commands.rs#mod[tests]/fn[status_lists_definitions_and_reviews_whose_assessments_disagreed] checks the section for default, --all, --verbose and glob selections. It asserts that definition, citation review and site review rows appear, and that non-disagreeing or unselected ones do not. It also asserts that the section vanishes when no rationale records a disagreement.

Inputs

Tests

Input 5: outline src/commands.rs mod[tests]/fn[status_lists_definitions_and_reviews_whose_assessments_disagreed]
  • File: src/commands.rs
  • Selector: mod[tests]/fn[status_lists_definitions_and_reviews_whose_assessments_disagreed]
  • Kind: fn
  • src/commands.rs:487–575
    // {test}`requirements.cli.status`
    // {test}`requirements.authoring.confirmation`
    #[test]
    fn status_lists_definitions_and_reviews_whose_assessments_disagreed() {
        let chapter = format!(
            "{}\n:::{{req}} other\nOther MUST hold.\n:::\n",
            crate::sites::tests::RULE
        );
        let source = format!(
            "{}// {{cite}}`requirements.other`\nfn cited() {{}}\n",
            crate::sites::tests::SOURCE
        );
        let temp = crate::sites::tests::project(&chapter, &source);
        let root = temp.path();
        write_record(
            root,
            "evidence/requirements.rule.json",
            serde_json::json!(true),
            true,
        );
        write_record(
            root,
            "evidence/requirements.other.json",
            serde_json::json!(true),
            false,
        );
        write_record(
            root,
            &crate::sites::review_path("requirements.rule", "src/lib.rs", "fn[check_two]"),
            serde_json::json!(true),
            true,
        );
        write_record(
            root,
            &crate::sites::review_path("requirements.rule", "src/lib.rs", "fn[check_one]"),
            serde_json::json!(false),
            false,
        );
        write_record(
            root,
            &crate::citations::review_path("src/lib.rs", "fn[cited]"),
            serde_json::json!({"FIXME": ["example/queue#1"]}),
            true,
        );
        let definition = "- `requirements.rule` (requirement): `true`\n";
        let site = "- `sites:requirements.rule/src/lib.rs#fn[check_two]`: `true`\n";
        let citation = "- `citations:src/lib.rs#fn[cited]`: `FIXME`\n";
        for (all, glob, verbose, expected) in [
            (false, None, false, &[definition, citation, site][..]),
            (true, None, false, &[definition, citation, site]),
            (false, None, true, &[definition, citation, site]),
            (false, Some("requirements.rule"), false, &[definition, site]),
            (false, Some("requirements.other"), false, &[citation]),
        ] {
            let status = status_markdown_with_options(root, all, glob, verbose).unwrap();
            let section = status
                .split_once("\n## Disagreements\n")
                .unwrap_or_else(|| panic!("{glob:?}: {status}"))
                .1;
            let section = section.split("\n## ").next().unwrap();
            let rows = section
                .lines()
                .filter(|line| line.starts_with("- "))
                .map(|line| format!("{line}\n"))
                .collect::<Vec<_>>();
            assert_eq!(rows, expected, "{all} {glob:?}: {status}");
            assert!(!section.contains("requirements.other` ("), "{status}");
            assert!(!section.contains("check_one"), "{status}");
        }
        // Without a disagreement, there is no section.
        write_record(
            root,
            "evidence/requirements.rule.json",
            serde_json::json!(true),
            false,
        );
        let status =
            status_markdown_with_options(root, false, Some("requirements.rule"), false).unwrap();
        assert!(status.contains("## Disagreements"), "{status}");
        write_record(
            root,
            &crate::sites::review_path("requirements.rule", "src/lib.rs", "fn[check_two]"),
            serde_json::json!(true),
            false,
        );
        let status =
            status_markdown_with_options(root, false, Some("requirements.rule"), false).unwrap();
        assert!(!status.contains("## Disagreements"), "{status}");
    }
Input 6: outline tests/commands.rs fn[status_loads_nearest_workspace_file_without_validating_authoring]
  • File: tests/commands.rs
  • Selector: fn[status_loads_nearest_workspace_file_without_validating_authoring]
  • Kind: fn
  • tests/commands.rs:223–269
// {test}`requirements.configuration.workspace_location`
// {test}`requirements.configuration.evidence_paths`
// {test}`requirements.configuration.workspace_structure`
// {test}`requirements.configuration.loading`
// {test}`requirements.authoring.deterministic_validation`
// {test}`requirements.cli.status`
// {test}`requirements.ci.errors`
#[test]
fn status_loads_nearest_workspace_file_without_validating_authoring() {
    let temp = fixture();
    let nested = temp.path().join("src/nested");
    fs::write(temp.path().join("habeas.toml"), "version = 99\n").unwrap();
    fs::write(
        nested.join("habeas.toml"),
        "version = 1\n[authoring]\nconfigs = 'invalid but unused'\n",
    )
    .unwrap();
    let output = habeas(&nested, &["status"]);
    assert!(output.status.success(), "{output:?}");

    // An invalid workspace file is one validation finding: `status` and
    // `info` still run and report the checks that do not depend on it.
    for args in [["status"].as_slice(), ["info", "requirements.*"].as_slice()] {
        let output = habeas(temp.path(), args);
        assert!(output.status.success(), "{args:?}: {output:?}");
        let text = String::from_utf8(output.stdout).unwrap();
        assert!(
            text.contains("habeas.toml: version: expected version = 1"),
            "{args:?}: {text}"
        );
        assert!(
            text.contains("evidence/requirements.malformed.json: invalid JSON"),
            "{args:?}: {text}"
        );
    }

    fs::write(temp.path().join("habeas.toml"), "version = 1\n").unwrap();
    fs::write(nested.join("habeas.toml"), "version = [\n").unwrap();
    let output = habeas(&nested, &["status"]);
    assert!(output.status.success(), "{output:?}");
    let text = String::from_utf8(output.stdout).unwrap();
    assert!(
        text.contains(&nested.join("habeas.toml").display().to_string())
            && text.contains("evidence/requirements.malformed.json: invalid JSON"),
        "{text}"
    );
}
Input 7: outline tests/commands.rs fn[status_applies_workspace_disallow_to_existing_evidence]
// {test}`requirements.configuration.evidence_paths`
// {test}`requirements.ci.input_containment`
// {test}`requirements.cli.status`
// {test}`requirements.authoring.deterministic_validation`
#[test]
fn status_applies_workspace_disallow_to_existing_evidence() {
    let temp = fixture();
    fs::write(
        temp.path().join("habeas.toml"),
        "version = 1\n[evidence]\nallow = ['src']\ndisallow = ['src/main.rs']\n",
    )
    .unwrap();
    let output = habeas(temp.path(), &["status", "requirements.ready"]);
    assert!(output.status.success(), "{output:?}");
    let text = String::from_utf8(output.stdout).unwrap();
    assert!(
        text.contains("Invalid") && text.contains("disallowed"),
        "{text}"
    );
    assert!(text.contains("src/main.rs"), "{text}");
}
Input 8: outline tests/commands.rs fn[status_groups_fixme_judgments_by_distinct_exact_issue]
// {test}`requirements.cli.status`
// {test}`requirements.cli.fixme_summary`
#[test]
fn status_groups_fixme_judgments_by_distinct_exact_issue() {
    let temp = fixme_fixture();
    let output = habeas(temp.path(), &["status"]);
    assert!(output.status.success(), "{output:?}");
    let text = String::from_utf8(output.stdout).unwrap();
    let summaries: Vec<_> = text
        .lines()
        .filter(|line| line.contains("affects"))
        .collect();
    assert_eq!(summaries.len(), 4, "{text}");
    for (line, reference, count) in [
        (summaries[0], "example/app#123", "affects 2 judgments"),
        (summaries[1], "example/app#45", "affects 2 judgments"),
        (summaries[2], "Rust-Lang/rust#456", "affects 1 judgment"),
        (summaries[3], "rust-lang/rust#456", "affects 1 judgment"),
    ] {
        assert!(line.contains(reference) && line.contains(count), "{text}");
    }
    assert!(
        text.lines()
            .any(|line| line.contains("1 judgment") && line.contains("without an issue")),
        "{text}"
    );
    // Strings that are not exactly `owner/repo#N` name no issue.
    assert!(!text.contains("`#123`"), "{text}");
    assert!(!text.contains("github.com"), "{text}");
    assert!(
        text.find("without an issue").unwrap() > text.find(summaries[3]).unwrap(),
        "{text}"
    );
    for name in ["alpha", "beta", "case", "unlinked"] {
        assert!(!text.contains(&format!("rules.{name}")), "{text}");
    }

    let output = habeas(temp.path(), &["status", "--all"]);
    assert!(output.status.success(), "{output:?}");
    let all = String::from_utf8(output.stdout).unwrap();
    for name in ["alpha", "beta", "case", "unlinked"] {
        assert!(
            all.lines().any(
                |line| line.starts_with(&format!("| `rules.{name}`")) && line.contains("FIXME")
            ),
            "{all}"
        );
    }
    for summary in summaries {
        assert!(all.contains(summary), "{all}");
    }
}
Input 9: outline tests/commands.rs fn[verbose_status_lists_fixme_judgments_and_globs_scope_issue_groups]
  • File: tests/commands.rs
  • Selector: fn[verbose_status_lists_fixme_judgments_and_globs_scope_issue_groups]
  • Kind: fn
  • tests/commands.rs:346–400
// {test}`requirements.cli.status`
// {test}`requirements.cli.fixme_summary`
// {test}`requirements.references.definition_globs`
#[test]
fn verbose_status_lists_fixme_judgments_and_globs_scope_issue_groups() {
    let temp = fixme_fixture();
    let output = habeas(temp.path(), &["status", "--verbose"]);
    assert!(output.status.success(), "{output:?}");
    let text = String::from_utf8(output.stdout).unwrap();
    for name in ["alpha", "beta", "case", "unlinked"] {
        assert!(text.contains(&format!("rules.{name}")), "{text}");
    }
    for detail in [
        "requirement",
        "example",
        "#123 is not a qualified issue",
        "https://github.com/rust-lang/rust/issues/456",
        "Unlinked extra detail",
        "An unrelated note",
        "&lt;script&gt;alert(1)&lt;/script&gt;",
    ] {
        assert!(text.contains(detail), "{text}");
    }
    assert!(!text.contains("<script>"), "{text}");

    let output = habeas(temp.path(), &["status", "rules.case", "--verbose"]);
    assert!(output.status.success(), "{output:?}");
    let filtered = String::from_utf8(output.stdout).unwrap();
    assert!(
        filtered.contains("example/app#45") && filtered.contains("affects 1 judgment"),
        "{filtered}"
    );
    assert!(filtered.contains("rules.case"), "{filtered}");
    for excluded in [
        "rules.alpha",
        "rules.beta",
        "rules.unlinked",
        "example/app#123",
        "rust-lang/rust",
    ] {
        assert!(!filtered.contains(excluded), "{filtered}");
    }

    let output = habeas(temp.path(), &["status", "--verbose", "rules.unlinked"]);
    assert!(output.status.success(), "{output:?}");
    let unlinked = String::from_utf8(output.stdout).unwrap();
    assert!(unlinked.contains("rules.unlinked"), "{unlinked}");
    assert!(
        unlinked
            .lines()
            .any(|line| line.contains("1 judgment") && line.contains("without an issue")),
        "{unlinked}"
    );
    assert!(!unlinked.contains("affects"), "{unlinked}");
}
Input 10: outline tests/commands.rs fn[status_lists_nonvalid_requirements_and_all_option_in_name_order]
  • File: tests/commands.rs
  • Selector: fn[status_lists_nonvalid_requirements_and_all_option_in_name_order]
  • Kind: fn
  • tests/commands.rs:402–458
// {test}`requirements.cli.status`
#[test]
fn status_lists_nonvalid_requirements_and_all_option_in_name_order() {
    let temp = fixture();
    let nested = temp.path().join("src/nested");
    let output = habeas(&nested, &["status"]);
    assert!(output.status.success(), "{:?}", output);
    let text = String::from_utf8(output.stdout).unwrap();
    for (name, state) in [
        ("absent", "Missing"),
        ("malformed", "Invalid"),
        ("pending", "Determination false"),
        ("stale", "Invalid"),
        ("stale_input", "Invalid"),
        ("uncovered", "Invalid"),
    ] {
        assert!(
            text.lines().any(|line| {
                line.starts_with(&format!("| `requirements.{name}`"))
                    && line.contains(&format!("| {state}"))
            }),
            "{text}"
        );
    }
    assert!(!text.contains("| `requirements.ready`"), "{text}");
    assert!(!text.contains("| `requirements.xready`"), "{text}");
    assert!(text.contains("missing for requirement"), "{text}");
    assert!(text.contains("determination is false"), "{text}");
    assert!(text.contains("requirement text changed"), "{text}");
    assert!(text.contains("outline input changed"), "{text}");
    assert!(text.contains("invalid JSON"), "{text}");
    assert!(text.contains("no input covers"), "{text}");

    let output = habeas(&nested, &["status", "--all"]);
    assert!(output.status.success(), "{:?}", output);
    let all = String::from_utf8(output.stdout).unwrap();
    assert!(all.contains("| `requirements.case` (example)"), "{all}");
    let names = [
        "absent",
        "malformed",
        "pending",
        "ready",
        "stale",
        "stale_input",
        "uncovered",
        "xready",
    ];
    let positions = names
        .map(|name| all.find(&format!("| `requirements.{name}`")).unwrap())
        .to_vec();
    assert!(positions.windows(2).all(|pair| pair[0] < pair[1]), "{all}");
    assert!(
        all.lines()
            .any(|line| { line.starts_with("| `requirements.ready`") && line.contains("| Valid") }),
        "{all}"
    );
}
Input 11: outline tests/commands.rs fn[status_preserves_repository_wide_rust_findings_in_every_form]
  • File: tests/commands.rs
  • Selector: fn[status_preserves_repository_wide_rust_findings_in_every_form]
  • Kind: fn
  • tests/commands.rs:460–513
// {test}`requirements.cli.status`
// {test}`requirements.references.rust_item_coverage`
// {test}`requirements.references.definition_globs`
// {test}`requirements.references.coverage.report`
#[test]
fn status_preserves_repository_wide_rust_findings_in_every_form() {
    let temp = fixture();
    let nested = temp.path().join("src/nested");
    // `main` is read by an evidence record; this item is read by none.
    fs::write(temp.path().join("src/extra.rs"), "fn unread() {}\n").unwrap();
    for flags in [
        [].as_slice(),
        ["--all"].as_slice(),
        ["--verbose"].as_slice(),
        ["--all", "--verbose"].as_slice(),
    ] {
        for selection in [None, Some("requirements.ready")] {
            for coverage in [false, true] {
                let mut args = vec!["status"];
                args.extend_from_slice(flags);
                args.extend(selection);
                if coverage {
                    args.push("--coverage");
                }
                let output = habeas(&nested, &args);
                assert!(output.status.success(), "{args:?}: {output:?}");
                let text = String::from_utf8(output.stdout).unwrap();
                if coverage {
                    assert!(text.contains("## Coverage warnings"), "{args:?}: {text}");
                    assert!(
                    text.contains(
                        "src/extra.rs:1: function unread has no recent coverage: it has no requirement or example reference, and no recent evidence record or review read it"
                    ),
                    "{args:?}: {text}"
                );
                } else {
                    assert!(
                        text.contains(
                            "1 nodes have coverage warnings. Use `status --coverage` to see them."
                        ),
                        "{args:?}: {text}"
                    );
                    assert!(!text.contains("has no recent coverage"), "{args:?}: {text}");
                    assert!(!text.contains("## Coverage warnings"), "{args:?}: {text}");
                }
                assert!(
                    !text.contains("function main has no recent coverage"),
                    "{args:?}: {text}"
                );
                assert!(!text.contains("attestation"), "{args:?}: {text}");
            }
        }
    }
}
Input 12: outline tests/commands.rs fn[commands_report_invalid_arguments_and_unmatched_selectors]
// {test}`requirements.cli.status`
// {test}`requirements.cli.info`
// {test}`requirements.references.definition_globs`
#[test]
fn commands_report_invalid_arguments_and_unmatched_selectors() {
    let temp = fixture();
    for args in [
        ["status", "--wrong"].as_slice(),
        ["status", "--all", "extra", "more"].as_slice(),
        ["info"].as_slice(),
        ["info", "ready", "extra"].as_slice(),
    ] {
        let output = habeas(temp.path(), args);
        assert!(!output.status.success(), "{args:?}: {output:?}");
        assert!(
            String::from_utf8_lossy(&output.stderr).contains("Usage: habeas"),
            "{args:?}: {output:?}"
        );
    }
    for command in ["info", "status"] {
        let invalid = habeas(temp.path(), &[command, "["]);
        assert!(!invalid.status.success());
        assert!(
            String::from_utf8_lossy(&invalid.stderr).contains("invalid definition glob"),
            "{command}: {invalid:?}"
        );
    }
    let unmatched = habeas(temp.path(), &["info", "nothing.*"]);
    assert!(!unmatched.status.success());
    assert!(
        String::from_utf8_lossy(&unmatched.stderr).contains("no definitions match"),
        "{unmatched:?}"
    );
    let status = habeas(temp.path(), &["status", "requirements.*ready", "--all"]);
    assert!(status.status.success(), "{status:?}");
    let status = String::from_utf8(status.stdout).unwrap();
    assert!(
        status.contains("`requirements.ready` (requirement)"),
        "{status}"
    );
    assert!(
        status.contains("`requirements.xready` (requirement)"),
        "{status}"
    );
    assert!(!status.contains("| `requirements.pending`"), "{status}");
    let no_status = habeas(temp.path(), &["status", "nothing.*"]);
    assert!(!no_status.status.success());
    assert!(String::from_utf8_lossy(&no_status.stderr).contains("no definitions match"));

    let outside_project = TempDir::new().unwrap();
    let status = habeas(outside_project.path(), &["status"]);
    assert!(!status.status.success(), "{status:?}");
    assert!(
        String::from_utf8_lossy(&status.stderr)
            .contains("cannot find a project with Cargo.toml and book.toml"),
        "{status:?}"
    );
}
Input 13: outline tests/commands.rs fn[status_and_info_accept_a_definition_selection]
// {test}`requirements.cli.status`
// {test}`requirements.cli.info`
// {test}`requirements.cli.definition_glob_search`
#[test]
fn status_and_info_accept_a_definition_selection() {
    let temp = fixture();
    for (command, usage) in [("status", "[SELECTION]"), ("info", "<SELECTION>")] {
        let help = habeas(temp.path(), &[command, "--help"]);
        assert!(help.status.success(), "{help:?}");
        let help = String::from_utf8(help.stdout).unwrap();
        assert!(help.contains(usage), "{help}");
        assert!(
            help.contains("A full requirement or example name, or a definition glob"),
            "{help}"
        );
    }
    let status = habeas(temp.path(), &["status", "requirements.c*", "--all"]);
    assert!(status.status.success(), "{status:?}");
    let status = String::from_utf8(status.stdout).unwrap();
    assert!(
        status.contains("| `requirements.case` (example)"),
        "{status}"
    );
    assert!(!status.contains("| `requirements.ready`"), "{status}");
    let info = habeas(temp.path(), &["info", "requirements.case"]);
    assert!(info.status.success(), "{info:?}");
    let info = String::from_utf8(info.stdout).unwrap();
    assert!(info.starts_with("# `requirements.case`\n"), "{info}");
    assert!(!info.contains("# `requirements.ready`"), "{info}");
}
Input 14: outline tests/outcomes.rs fn[valid_fixme_remains_visible_in_status_info_and_book]
// {test}`requirements.cli.status`
// {test}`requirements.cli.fixme_summary`
// {test}`requirements.cli.info`
// {test}`requirements.index.state`
// {test}`requirements.index.detail_format`
// {test}`requirements.index.detail_pages`
// {test}`requirements.examples.index`
#[test]
fn valid_fixme_remains_visible_in_status_info_and_book() {
    let temp = fixture();
    for all in [false, true] {
        let status = habeas::status_markdown(temp.path(), all).unwrap();
        assert_eq!(status.contains("requirements.timeout"), all, "{status}");
        assert!(status.contains("FIXME"));
        assert!(status.contains("example/io#125"));
        assert!(status.contains("rust-lang/rust#123"));
        assert!(status.contains("affects 1 judgment"), "{status}");
        assert!(!status.contains("## Validation findings"));
    }
    let verbose = habeas::status_markdown_with_options(temp.path(), false, None, true).unwrap();
    assert!(verbose.contains("requirements.timeout"), "{verbose}");
    assert!(verbose.contains("example"), "{verbose}");
    let info = habeas::info_markdown(temp.path(), "requirements.timeout").unwrap();
    assert!(info.contains("## FIXME references"));
    assert!(info.contains("rust-lang/rust#123"));

    let mut book = Book::new();
    book.push_item(Chapter::new(
        "Requirements",
        fs::read_to_string(temp.path().join("md/requirements.md")).unwrap(),
        "requirements.md",
        Vec::new(),
    ));
    book.push_item(Chapter::new(
        "Index",
        ":::{requirements-index}\n:::\n".to_owned(),
        "requirements-index.md",
        Vec::new(),
    ));
    habeas::preprocess_book(&mut book, temp.path()).unwrap();
    let index = book
        .chapters()
        .find(|chapter| chapter.name == "Index")
        .unwrap();
    assert!(index.content.contains("FIXME"));
    let detail = index
        .sub_items
        .iter()
        .find_map(|item| match item {
            BookItem::Chapter(chapter) if chapter.name == "requirements.timeout" => Some(chapter),
            _ => None,
        })
        .unwrap();
    assert!(detail.content.contains("evidence-FIXME"));
    assert!(detail.content.contains("## FIXME references"));
    assert!(detail.content.contains("rust-lang/rust#123"));
}
Input 15: outline tests/references.rs fn[untracked_sources_are_not_validated_until_staged_and_status_lists_them]
  • File: tests/references.rs
  • Selector: fn[untracked_sources_are_not_validated_until_staged_and_status_lists_them]
  • Kind: fn
  • tests/references.rs:702–746
// {test}`requirements.references.discovery`
// {test}`requirements.references.rust_item_coverage`
// {test}`requirements.cli.status`
#[test]
fn untracked_sources_are_not_validated_until_staged_and_status_lists_them() {
    let temp = project();
    let root = temp.path();
    let source = format!(
        "// {}`rules.missing`\nfn referenced() {{}}\n\nfn uncited() {{}}\n",
        role("impl")
    );
    fs::write(root.join("src/extra.rs"), &source).unwrap();
    // An untracked file without references needs no reminder.
    fs::write(root.join("notes.txt"), "No references here.\n").unwrap();
    git(root, &["init", "--quiet"]);
    git(root, &["add", "md", "book.toml", "Cargo.toml"]);

    let untracked = errors(root);
    assert!(!has(&untracked, "src/extra.rs"), "{untracked:#?}");
    let status = habeas::status_markdown(root, false).unwrap();
    let section = &status[status
        .find("## Untracked files with references")
        .unwrap_or_else(|| panic!("{status}"))..];
    assert!(section.contains("git add"), "{status}");
    assert!(section.contains("- `src/extra.rs`"), "{status}");
    assert!(!section.contains("notes.txt"), "{status}");

    // Staging the new file brings its references and items back.
    git(root, &["add", "src/extra.rs"]);
    let errors = errors(root);
    assert!(has(&errors, "src/extra.rs:1"), "{errors:#?}");
    assert!(has(&errors, "rules.missing"), "{errors:#?}");
    assert!(
        has(
            &errors,
            "src/extra.rs:4: function uncited has no recent coverage: it has no requirement or example reference, and no recent evidence record or review read it"
        ),
        "{errors:#?}"
    );
    let status = habeas::status_markdown(root, false).unwrap();
    assert!(
        !status.contains("Untracked files with references"),
        "{status}"
    );
}

Referenced definitions

Input 2: requirements selection requirements.cli.fixme_summary
:::{req} fixme_summary
`habeas status` MUST group the selected requirement and example judgments marked
FIXME by issue reference and report how many distinct judgments each issue
affects. A recorded FIXME string of the form `owner/repo#N` under
{cite}`requirements.ci.outcomes` MUST identify that issue, compared exactly; any
other string is a gap description without an issue.

A judgment MUST count at most once for each issue, even when that issue occurs
repeatedly or in several FIXME strings. A judgment naming several issues MUST
count in each corresponding group. Judgments with no issue string MUST be counted once in a separate "FIXME without an issue" group.
Issue groups MUST be ordered by decreasing affected-judgment count, then by
reference; the group without an issue MUST follow them. A supplied
selection MUST restrict these counts to the selected subjects.

`--verbose` MUST list the full name and kind of every judgment in each issue
group and in the group without an issue, along with its original FIXME strings.
The summary MUST include valid FIXME determinations even when other evidence
checks fail; grouping MUST NOT hide their validation findings. Malformed
determinations MUST remain validation errors under {cite}`requirements.ci.outcomes`.
:::
Input 3: requirements selection requirements.references.coverage.report
:::{req} coverage.report
`habeas status`, and `habeas author` after it finishes, MUST report the number
of nodes without recent coverage under
{cite}`requirements.references.coverage.history`, except items inside a module
named `tests`, using the following summary:

```text
N nodes have coverage warnings. Use `status --coverage` to see them.
```

The summary MUST report zero when no nodes have warnings. Default output MUST
NOT list individual coverage warnings or coverage-history details, including
with `status --all` or `status --verbose`.
`habeas status --coverage` MUST list every warning, naming its file, line, kind,
and name, and report incomplete coverage history when applicable.
A warning MUST NOT fail validation, and repository validation MUST NOT read
Git history.
:::
Input 4: requirements selection requirements.authoring.confirmation
:::{req} confirmation
Under the `confirm` policy of {cite}`requirements.authoring.policy`, authoring
MUST assess each subject in an independent second conversation whenever the
first assessment's determination is `true` or FIXME. The assessments agree when
their outcomes are the same kind; then the first assessment MUST be recorded.
When they disagree, the harness MUST verify the less favorable assessment, where
`false` is less favorable than FIXME and FIXME than `true`, in a third
independent conversation under {cite}`requirements.authoring.verifier_prompt`,
and record the outcome {cite}`requirements.authoring.verifier_outcome` derives.
For a site review, assessments that differ only in `applies` MUST also count as
disagreeing, the one with `applies` true being less favorable. The recorded
rationale MUST state that the assessments disagreed and what the verification
concluded, so the disagreement remains visible for review under
{cite}`requirements.cli.flip_guidance`. Each conversation MUST have its own
usage record. Citation reviews under
{cite}`requirements.references.citation_review` and site reviews under
{cite}`requirements.references.site_review` that a command selects MUST be
confirmed in the same way, with the review's target as the subject.
:::
Input 16: definition requirements.references.definition_selection
:::{definition} definition_selection
:phrase: definition selection

A full requirement or example name, or a definition glob, identifying the
requirements and named examples it matches under
{cite}`requirements.references.definition_globs`. A name without `*` selects
exactly that definition.
:::

Other sources

Input 1: requirements selection requirements.cli.status
:::{req} status
`habeas status [<selection>] [--all] [--verbose] [--coverage]` MUST consider requirements and named examples matched by the {term}`requirements.references.definition_selection`; without a selection it MUST consider every definition. By default, it MUST list matching definitions in full-name order when their evidence is missing, has a false determination, or fails the same evidence and reference checks as `habeas::validate()`. It MUST summarize FIXME judgments under {cite}`requirements.cli.fixme_summary`, with accepted FIXME subjects listed individually only when `--verbose` or `--all` is selected. `--all` MUST list every matching definition with its kind and evidence state. Every form MUST show validation findings, the coverage report under {cite}`requirements.references.coverage.report`, using its node-count summary by default and showing individual warnings and coverage-history details only with `--coverage`, work from within a Cargo and mdBook project, and report invalid arguments or a supplied selection matching no definition clearly. When files that reference discovery does not consider because they are untracked in a Git worktree contain references, `habeas status` MUST list them with a reminder to stage them with `git add`. Every form MUST also list, in a "Disagreements" section, each selected definition, citation review, and site review whose recorded rationale states that its assessments disagreed under {cite}`requirements.authoring.confirmation`, so those findings are visible although validation accepts them.
:::
Input 17: outline tests/coverage.rs fn[status_shows_coverage_warnings_and_says_when_history_is_incomplete]
  • File: tests/coverage.rs
  • Selector: fn[status_shows_coverage_warnings_and_says_when_history_is_incomplete]
  • Kind: fn
  • tests/coverage.rs:231–283
// {test}`requirements.references.coverage.shallow_clone`
// {test}`requirements.references.coverage.history`
// {test}`requirements.references.coverage.report`
#[test]
fn status_shows_coverage_warnings_and_says_when_history_is_incomplete() {
    let temp = project();
    let root = temp.path();
    record(root, "rules.check", &["fn[parse]"]);
    commit(root, "first");
    let status = habeas::status_markdown(root, false).unwrap();
    assert!(
        status.contains("2 nodes have coverage warnings. Use `status --coverage` to see them."),
        "{status}"
    );
    assert!(!status.contains("has no recent coverage"), "{status}");
    assert!(!status.contains("## Coverage warnings"), "{status}");
    let status = coverage_status(root);
    assert!(status.contains("## Coverage warnings"), "{status}");
    assert!(
        status.contains("src/lib.rs:3: function render has no recent coverage"),
        "{status}"
    );
    assert!(
        !status.contains("function parse has no recent coverage"),
        "{status}"
    );
    assert!(!status.contains("history is incomplete"), "{status}");
    record(root, "rules.check", &[]);
    commit(root, "second");
    let clone = tempfile::tempdir().unwrap();
    let target = clone.path().join("shallow");
    let output = Command::new("git")
        .args([
            "clone",
            "--quiet",
            "--depth",
            "1",
            &format!("file://{}", root.display()),
        ])
        .arg(&target)
        .output()
        .unwrap();
    assert!(output.status.success(), "{output:?}");
    let status = coverage_status(&target);
    assert!(
        status.contains("Coverage history is incomplete"),
        "{status}"
    );
    assert!(
        status.contains("function parse has no recent coverage"),
        "{status}"
    );
}
Input 18: outline tests/coverage.rs fn[incomplete_history_is_noted_even_with_nothing_to_warn_about]
  • File: tests/coverage.rs
  • Selector: fn[incomplete_history_is_noted_even_with_nothing_to_warn_about]
  • Kind: fn
  • tests/coverage.rs:347–394
// {test}`requirements.references.coverage.history`
// {test}`requirements.references.coverage.shallow_clone`
// {test}`requirements.references.coverage.report`
#[test]
fn incomplete_history_is_noted_even_with_nothing_to_warn_about() {
    let temp = project();
    let root = temp.path();
    record(
        root,
        "rules.check",
        &["fn[parse]", "fn[render]", "fn[helper]"],
    );
    commit(root, "first");
    commit(root, "second");
    let clone = tempfile::tempdir().unwrap();
    let target = clone.path().join("shallow");
    let output = Command::new("git")
        .args(["clone", "--quiet", "--depth", "1"])
        .arg(format!("file://{}", root.display()))
        .arg(&target)
        .output()
        .unwrap();
    assert!(output.status.success(), "{output:?}");
    assert!(warned(&target).is_empty());
    assert_eq!(
        habeas::coverage_warnings(&target).unwrap(),
        habeas::CoverageWarnings {
            items: Vec::new(),
            incomplete: true
        }
    );
    let status = habeas::status_markdown(&target, false).unwrap();
    assert!(
        status.contains("0 nodes have coverage warnings. Use `status --coverage` to see them."),
        "{status}"
    );
    assert!(!status.contains("history is incomplete"), "{status}");
    let status = coverage_status(&target);
    assert!(
        status.contains("Coverage history is incomplete"),
        "{status}"
    );
    assert!(warned(root).is_empty());
    assert_eq!(
        habeas::coverage_warnings(root).unwrap(),
        habeas::CoverageWarnings::default()
    );
}