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.test-coverage.index.summary

Requirements index · View definition

evidence Valid

Requirement

The coverage index MUST display the combined view selected under cite requirements.test-coverage.index.selection and cite requirements.test-coverage.index.freshness. It MUST show the number of selected test attempts and summarize coverage excluded because it is stale, unavailable, or from a historical build configuration. Detailed test identities, run provenance, and per-test execution data MUST remain in the saved coverage artifacts rather than being included in the generated book.

For first-party Rust files under cite requirements.references.rust_item_coverage, the summary MUST compute line coverage from the union of instrumented file-and-line locations in the selected fresh records, including their associated child-process records. Each location MUST count once in the denominator and count as covered when any selected record has a positive execution count for it. Percentages MUST be computed from those union counts rather than averaged across process reports. A view with no instrumented lines MUST show coverage as unavailable. The index MUST visibly identify incomplete coverage and MUST NOT imply that every current test has coverage merely because all available records are valid.

Rationale

The four supplied {test} items in src/execution_coverage/book.rs cover each obligation of requirements.test-coverage.index.summary. I judged adequacy from the supplied test source and did not request implementation source.

  • Combined view and selected-attempt count. filtered_runs_union_latest_attempts_and_invalidate_with_saved_source asserts “2 selected test attempts” for two tests. It asserts “1 selected test attempts” after a newer build configuration is recorded. It also asserts that the {coverage-index} placeholder is not left in the output.
  • Exclusion summaries.
    • Stale: maps_distinguish_no_runs_zero_hits_stale_and_incomplete_coverage asserts “1 stale test attempts”. filtered_runs_union_latest_attempts_and_invalidate_with_saved_source asserts “stale coverage; recollect”.
    • Unavailable: the first test asserts “1 unavailable test attempts” and “missing or unreadable coverage”. The second asserts the same text for failed and interrupted newest attempts.
    • Historical: the second test asserts “historical build configuration” when a newer build-b record exists.
    • A stale-only view, an incomplete view and a no-run view each show “Coverage unavailable”, so excluded records do not leak into the totals.
  • Union across processes. gaps_union_process_locations_and_omit_per_test_reports has a parent and a child process on the same file. The parent has lines (1,2) and (2,0). The child has (1,0) and (3,u64::MAX). It asserts “2/4 (50.0%)” overall and “2/3” for code.rs. That checks that each location counts once in the denominator and that any positive count covers it. gaps_omit_test_data_and_preserve_saved_profiles_and_sources also adds a child process, and the union assertions there check the same behavior.
  • Union rather than averaging. In filtered_runs_union_latest_attempts_and_invalidate_with_saved_source, two tests cover complementary lines. The assertion is “2/2 (100.0%)”, where an average of per-process percentages would give 50%. The “3/3 (100.0%)” assertion in gaps_omit_test_data_and_preserve_saved_profiles_and_sources gives the same protection.
  • No instrumented lines. maps_distinguish_no_runs_zero_hits_stale_and_incomplete_coverage records an empty-lines run. It asserts “Coverage unavailable”, “No usable instrumented lines”, no “Line coverage:” text and no “NaN”.
  • Incomplete coverage.
    • gaps_omit_test_data_and_preserve_saved_profiles_and_sources asserts that the index says it does “not establish that all current tests were measured”.
    • maps_distinguish_no_runs_zero_hits_stale_and_incomplete_coverage asserts “missing or unreadable coverage” for five failure modes, plus “Coverage history is incomplete” for unreadable metadata.
  • Detail omission. gaps_omit_test_data_and_preserve_saved_profiles_and_sources loops over every generated chapter. It asserts that none contains “Test process coverage”, “Captured source”, “habeas-coverage-test”, “Test runs and provenance” or “binary / one”. It also asserts that no chapter name or path is a test or source page. Saved attempt.json, run.json and profiles are asserted unchanged.
  • Rust-file scope. The requirements.references.rust_item_coverage clause only scopes the files measured. The tests use .rs fixtures.

I found no required behavior that these tests would accept being violated.

Inputs

Tests

Input 5: outline src/execution_coverage/book.rs mod[tests]/fn[gaps_union_process_locations_and_omit_per_test_reports]
    // {test}`requirements.test-coverage.index.file_map`
    // {test}`requirements.test-coverage.index.file_map.table`
    // {test}`requirements.test-coverage.index.file_map.combined`
    // {test}`requirements.test-coverage.index.file_map.test`
    // {test}`requirements.test-coverage.index.summary`
    // {test}`requirements.test-coverage.index.file_map.combined.details`
    // {test}`requirements.test-coverage.index.file_map.notes`
    // {test}`requirements.test-coverage.index.details`
    #[test]
    fn gaps_union_process_locations_and_omit_per_test_reports() {
        let (temp, mut book) = fixture();
        let root = temp.path();
        fs::write(
            root.join("code.rs"),
            "fn one() {}\nfn two() {}\nfn three() {}\n// not instrumented\n",
        )
        .unwrap();
        fs::write(root.join("zero.rs"), "fn zero() {}\n").unwrap();
        fs::write(root.join("unmeasured.rs"), "// no instrumentation\n").unwrap();
        fs::write(root.join("executable.rs"), "fn unmeasured() {}\n").unwrap();
        let path = record(root, "one", 1, "a", &[(1, 2), (2, 0)]);
        let run_path = path.parent().unwrap().parent().unwrap().join("run.json");
        let mut run: Run = load(&run_path).unwrap();
        for file in ["zero.rs", "unmeasured.rs", "executable.rs"] {
            run.sources
                .insert(file.into(), fs::read_to_string(root.join(file)).unwrap());
        }
        save(&run_path, &run).unwrap();
        let mut attempt: Attempt = load(&path.join("attempt.json")).unwrap();
        attempt.processes[0]
            .lines
            .insert("zero.rs".into(), BTreeMap::from([(1, 0)]));
        fs::write(path.join("2-child.profraw"), "child profile fixture").unwrap();
        attempt.processes.push(Process {
            functions: Some(vec![]),
            pid: 2,
            profiles: vec!["2-child.profraw".into()],
            diagnostic: None,
            lines: BTreeMap::from([("code.rs".into(), BTreeMap::from([(1, 0), (3, u64::MAX)]))]),
        });
        save(&path.join("attempt.json"), &attempt).unwrap();
        populate(&mut book, root).unwrap();
        let index = &book.chapters().next().unwrap().content;
        assert!(index.contains("Line coverage: **2/4 (50.0%)**"));
        let map = map_html(index);
        assert!(file_card(map, "code.rs").contains("2/3 instrumented lines covered"));
        assert!(file_card(map, "code.rs").contains("66.7%"));
        assert!(file_card(map, "code.rs").contains("--gap-covered: 66.666667%"));
        let notes_path = super::super::notes::path(Path::new("reports/coverage.md"), "code.rs");
        let href = crate::chapter_href(Path::new("reports/coverage.md"), &notes_path, None);
        assert!(file_card(map, "code.rs").contains(&format!("href=\"{href}\"")));
        let notes = book
            .chapters()
            .find(|chapter| chapter.path.as_ref() == Some(&notes_path))
            .unwrap();
        assert!(notes.content.contains("File: <code>code.rs</code>"));
        assert!(file_card(map, "zero.rs").contains("0.0%"));
        assert!(file_card(map, "zero.rs").contains("--gap-covered: 0.000000%"));
        assert!(
            !map.contains("data-file=\"unmeasured.rs\""),
            "a non-executable file has no gap"
        );
        let unmeasured = file_card(map, "executable.rs")
            .split("</tr>")
            .next()
            .unwrap();
        assert!(unmeasured.contains("not measured"));
        assert!(!unmeasured.contains('%'));
        assert!(!unmeasured.contains("gap-coverage-bar"));
        assert!(map.contains("<th>File</th><th>Coverage</th>"));
        assert_eq!(
            map.matches("class=\"gap-file-row habeas-coverage-file\"")
                .count(),
            3
        );
        let mut html = String::new();
        pulldown_cmark::html::push_html(
            &mut html,
            pulldown_cmark::Parser::new_ext(index, pulldown_cmark::Options::all()),
        );
        assert!(html.contains("Unresolved coverage gaps"));
        assert!(!html.contains("habeas-coverage-test"));
        assert!(!html.contains("Test runs and provenance"));
        assert!(!html.contains("binary / one"));
        assert!(
            book.chapters()
                .skip(1)
                .all(|chapter| chapter.name.starts_with("File notes:"))
        );
    }
Input 6: outline src/execution_coverage/book.rs mod[tests]/fn[maps_distinguish_no_runs_zero_hits_stale_and_incomplete_coverage]
    // {test}`requirements.test-coverage.index.file_map`
    // {test}`requirements.test-coverage.index.file_map.table`
    // {test}`requirements.test-coverage.index.file_map.combined`
    // {test}`requirements.test-coverage.index.file_map.test`
    // {test}`requirements.test-coverage.index.file_map.combined.measurement`
    // {test}`requirements.test-coverage.index.summary`
    #[test]
    fn maps_distinguish_no_runs_zero_hits_stale_and_incomplete_coverage() {
        let (temp, book) = fixture();
        let root = temp.path();
        let mut no_runs = book.clone();
        populate(&mut no_runs, root).unwrap();
        let index = &no_runs.chapters().next().unwrap().content;
        assert!(index.contains("Coverage unavailable"));
        assert!(index.contains("gap counts unavailable"));
        assert!(!map_html(index).contains("data-file="));
        assert!(index.contains("Run `habeas coverage`"));

        let empty_path = record(root, "empty", 0, "empty", &[]);
        let mut empty = book.clone();
        populate(&mut empty, root).unwrap();
        let empty_index = &empty.chapters().next().unwrap().content;
        assert!(empty_index.contains("Coverage unavailable"));
        assert!(!empty_index.contains("Line coverage:"));
        assert!(!empty_index.contains("NaN"));
        assert!(!map_html(empty_index).contains("data-file="));
        assert!(empty_index.contains("No usable instrumented lines"));
        fs::remove_dir_all(empty_path.parent().unwrap().parent().unwrap()).unwrap();
        let path = record(root, "zero", 1, "a", &[(1, 0), (2, 0)]);
        let mut zero = book.clone();
        populate(&mut zero, root).unwrap();
        assert!(
            file_card(
                map_html(&zero.chapters().next().unwrap().content),
                "code.rs"
            )
            .contains("0.0%")
        );

        let mut attempt: Attempt = load(&path.join("attempt.json")).unwrap();
        attempt.processes[0]
            .lines
            .get_mut("code.rs")
            .unwrap()
            .insert(1, 1);
        for failure in [
            "no processes",
            "attempt diagnostic",
            "process diagnostic",
            "missing source",
            "empty profile",
        ] {
            let mut missing = attempt.clone();
            match failure {
                "no processes" => missing.processes.clear(),
                "attempt diagnostic" => missing.diagnostics.push("export incomplete".into()),
                "process diagnostic" => {
                    missing.processes[0].diagnostic = Some("unreadable profile".into());
                }
                "missing source" => {
                    missing.processes[0]
                        .lines
                        .insert("uncaptured.rs".into(), BTreeMap::from([(1, 1)]));
                }
                "empty profile" => fs::write(path.join("1-1.profraw"), "").unwrap(),
                _ => unreachable!(),
            }
            save(&path.join("attempt.json"), &missing).unwrap();
            let mut unavailable = book.clone();
            populate(&mut unavailable, root).unwrap();
            let index = &unavailable.chapters().next().unwrap().content;
            assert!(index.contains("Coverage unavailable"), "{failure}");
            assert!(!map_html(index).contains("data-file="), "{failure}");
            assert!(
                index.contains("missing or unreadable coverage"),
                "{failure}"
            );
            fs::write(path.join("1-1.profraw"), "retained profile fixture").unwrap();
        }
        save(&path.join("attempt.json"), &attempt).unwrap();
        fs::write(root.join("code.rs"), "changed source\n").unwrap();
        fs::write(root.join("new.rs"), "fn newly_added() {}\n").unwrap();
        let mut stale = book.clone();
        populate(&mut stale, root).unwrap();
        let index = &stale.chapters().next().unwrap().content;
        assert!(index.contains("Coverage unavailable"));
        assert!(!map_html(index).contains("data-file="));
        assert!(index.contains("1 stale test attempts"));
        attempt.processes.push(Process {
            functions: Some(vec![]),
            pid: 2,
            profiles: vec!["missing-child.profraw".into()],
            diagnostic: None,
            lines: BTreeMap::from([("code.rs".into(), BTreeMap::from([(2, 1)]))]),
        });
        save(&path.join("attempt.json"), &attempt).unwrap();
        let mut incomplete = book.clone();
        populate(&mut incomplete, root).unwrap();
        let index = &incomplete.chapters().next().unwrap().content;
        assert!(index.contains("Coverage unavailable"));
        assert!(!map_html(index).contains("data-file="));
        assert!(index.contains("missing or unreadable coverage"));

        fs::write(root.join("code.rs"), "fn one() {}\nfn two() {}\n").unwrap();
        fs::remove_file(root.join("new.rs")).unwrap();
        let mut unreadable = book.clone();
        populate(&mut unreadable, root).unwrap();
        let index = &unreadable.chapters().next().unwrap().content;
        assert!(index.contains("1 unavailable test attempts"));
        assert!(index.contains("Coverage unavailable"));
        assert!(!map_html(index).contains("data-file="));
        // Unreadable metadata cannot establish latest-per-test selection.
        fs::write(path.join("attempt.json"), "not JSON").unwrap();
        let mut uncertain = book;
        populate(&mut uncertain, root).unwrap();
        let index = &uncertain.chapters().next().unwrap().content;
        assert!(index.contains("Coverage history is incomplete"));
        assert!(index.contains("gap counts unavailable"));
        assert!(!map_html(index).contains("data-file="));
    }
Input 7: outline src/execution_coverage/book.rs mod[tests]/fn[filtered_runs_union_latest_attempts_and_invalidate_with_saved_source]
    // {test}`requirements.test-coverage.index`
    // {test}`requirements.test-coverage.processes.reports`
    // {test}`requirements.test-coverage.storage.configuration`
    // {test}`requirements.test-coverage.index.selection`
    // {test}`requirements.test-coverage.index.summary`
    // {test}`requirements.test-coverage.index.details`
    // {test}`requirements.test-coverage.index.freshness`
    // {test}`requirements.test-coverage.index.render_only`
    // {test}`requirements.test-coverage.index.file_map.combined.measurement`
    #[test]
    fn filtered_runs_union_latest_attempts_and_invalidate_with_saved_source() {
        let (temp, book) = fixture();
        let root = temp.path();
        record(root, "one", 1, "build-a", &[(1, 1), (2, 0)]);
        record(root, "two", 2, "build-a", &[(1, 0), (2, 1)]);
        let mut combined = book.clone();
        populate(&mut combined, root).unwrap();
        assert!(
            combined
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("2/2 (100.0%)")
        );
        assert!(
            combined
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("2 selected test attempts")
        );
        assert!(
            !combined
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("{coverage-index}")
        );
        // A failing newest attempt replaces the earlier success, even with no data.
        let newest = record(root, "one", 3, "build-a", &[]);
        let mut attempt: Attempt = load(&newest.join("attempt.json")).unwrap();
        attempt.diagnostics.push("profile missing".into());
        for outcome in ["failed", "interrupted"] {
            attempt.outcome = outcome.into();
            save(&newest.join("attempt.json"), &attempt).unwrap();
            let mut combined = book.clone();
            populate(&mut combined, root).unwrap();
            assert!(
                combined
                    .chapters()
                    .next()
                    .unwrap()
                    .content
                    .contains("gap counts unavailable")
            );
            assert!(
                combined
                    .chapters()
                    .next()
                    .unwrap()
                    .content
                    .contains("missing or unreadable coverage")
            );
            assert!(
                combined
                    .chapters()
                    .next()
                    .unwrap()
                    .content
                    .contains("2 selected test attempts")
            );
        }
        fs::write(root.join("code.rs"), "changed source\n").unwrap();
        let mut stale = book.clone();
        populate(&mut stale, root).unwrap();
        assert!(
            stale
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("gap counts unavailable")
        );
        assert!(
            stale
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("stale coverage; recollect")
        );
        let saved = load_saved(root, Some(root.join("target")));
        assert!(
            saved
                .records
                .iter()
                .all(|record| record.run.sources["code.rs"].contains("fn one() {}"))
        );
        record(root, "one", 4, "build-b", &[(1, 1)]);
        let mut other = book;
        populate(&mut other, root).unwrap();
        assert!(
            other
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("historical build configuration")
        );
        assert!(
            other
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("1/1 (100.0%)")
        );
        assert!(
            other
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("1 selected test attempts")
        );
    }
Input 8: outline src/execution_coverage/book.rs mod[tests]/fn[gaps_omit_test_data_and_preserve_saved_profiles_and_sources]
    // {test}`requirements.test-coverage.index.summary`
    // {test}`requirements.test-coverage.index.details`
    // {test}`requirements.test-coverage.processes.reports`
    #[test]
    fn gaps_omit_test_data_and_preserve_saved_profiles_and_sources() {
        let (temp, book) = fixture();
        let root = temp.path();
        fs::write(root.join("passing.rs"), "fn passing() {}\n").unwrap();
        let first = record(root, "one", 100, "a", &[(1, 1), (2, 0)]);
        fs::write(first.join("2-2.profraw"), "child profile fixture").unwrap();
        let mut attempt: Attempt = load(&first.join("attempt.json")).unwrap();
        attempt.processes.push(Process {
            functions: Some(vec![]),
            pid: 2,
            profiles: vec!["2-2.profraw".into()],
            lines: BTreeMap::from([("code.rs".into(), BTreeMap::from([(1, 0), (2, 7)]))]),
            diagnostic: None,
        });
        // A passing file must not appear in the gaps table.
        attempt.processes[0]
            .lines
            .insert("passing.rs".into(), BTreeMap::from([(1, 1)]));
        attempt.processes[0]
            .functions
            .as_mut()
            .unwrap()
            .push(super::super::FunctionExecution {
                file: "passing.rs".into(),
                line: 1,
                column: 1,
                count: 1,
            });
        save(&first.join("attempt.json"), &attempt).unwrap();
        let run_path = first.parent().unwrap().parent().unwrap().join("run.json");
        let mut run: Run = load(&run_path).unwrap();
        run.sources
            .insert("passing.rs".into(), "fn passing() {}\n".into());
        save(&run_path, &run).unwrap();
        record(root, "two", 200, "a", &[(1, 1), (2, 0)]);
        let captured_attempt = fs::read(first.join("attempt.json")).unwrap();
        let captured_run = fs::read(&run_path).unwrap();
        let mut combined = book.clone();
        populate(&mut combined, root).unwrap();
        let index = combined.chapters().next().unwrap();
        assert!(index.content.contains("3/3 (100.0%)"));
        assert!(
            index
                .content
                .contains("not establish that all current tests were measured")
        );
        assert!(!map_html(&index.content).contains("data-file=\"passing.rs\""));
        assert!(
            combined
                .chapters()
                .all(|chapter| chapter.name != "File notes: passing.rs")
        );
        for chapter in combined.chapters() {
            for omitted in [
                "Test process coverage",
                "Captured source",
                "habeas-coverage-test",
                "Test runs and provenance",
                "application/json",
                "habeasRenderCoverage",
                "binary / one",
                "binary / two",
                "fn passing() {}",
            ] {
                assert!(
                    !chapter.content.contains(omitted),
                    "report includes {omitted}"
                );
            }
            assert!(!chapter.name.starts_with("binary /"));
            assert!(
                !chapter
                    .path
                    .as_ref()
                    .unwrap()
                    .to_string_lossy()
                    .ends_with("-source.md")
            );
            assert!(chapter.name == "Coverage gaps" || chapter.name.starts_with("File notes:"));
        }
        fs::write(root.join("code.rs"), "rebuilt source\n").unwrap();
        let mut historical = book;
        populate(&mut historical, root).unwrap();
        assert!(
            historical
                .chapters()
                .next()
                .unwrap()
                .content
                .contains("Coverage unavailable")
        );
        assert_eq!(
            fs::read(first.join("attempt.json")).unwrap(),
            captured_attempt
        );
        assert_eq!(fs::read(&run_path).unwrap(), captured_run);
        assert_eq!(
            fs::read_to_string(first.join("1-1.profraw")).unwrap(),
            "retained profile fixture"
        );
        assert_eq!(
            fs::read_to_string(first.join("2-2.profraw")).unwrap(),
            "child profile fixture"
        );
        // Archived reports use the saved source, even though freshness excludes
        // these attempts from the current workspace's gaps report.
        let saved = load_saved(root, Some(root.join("target")));
        let archived = saved
            .records
            .iter()
            .find(|record| record.attempt.test == "one")
            .unwrap();
        assert!(!archived.fresh);
        let captured_lines = |locations: BTreeMap<(String, u32), u64>| {
            locations
                .into_iter()
                .map(|((file, line), count)| {
                    let source_line = archived.run.sources[&file]
                        .lines()
                        .nth(line as usize - 1)
                        .unwrap();
                    ((file, line), (source_line.to_owned(), count))
                })
                .collect::<BTreeMap<_, _>>()
        };
        let individual = |process: &Process| {
            captured_lines(
                process
                    .lines
                    .iter()
                    .flat_map(|(file, lines)| {
                        lines
                            .iter()
                            .map(move |(&line, &count)| ((file.clone(), line), count))
                    })
                    .collect(),
            )
        };
        let parent = individual(&archived.attempt.processes[0]);
        let child = individual(&archived.attempt.processes[1]);
        let combined = captured_lines(union(std::iter::once(archived)));
        assert_eq!(parent[&("code.rs".into(), 1)], ("fn one() {}".into(), 1));
        assert_eq!(parent[&("code.rs".into(), 2)], ("fn two() {}".into(), 0));
        assert_eq!(child[&("code.rs".into(), 1)], ("fn one() {}".into(), 0));
        assert_eq!(child[&("code.rs".into(), 2)], ("fn two() {}".into(), 7));
        assert_eq!(combined[&("code.rs".into(), 2)], ("fn two() {}".into(), 7));
        assert_eq!(parent.values().filter(|(_, count)| *count > 0).count(), 2);
        assert_eq!(combined.values().filter(|(_, count)| *count > 0).count(), 3);
        assert!(
            combined
                .values()
                .all(|(source, _)| !source.contains("rebuilt source"))
        );
    }

Referenced definitions

Input 2: requirements selection requirements.test-coverage.index.selection
:::{req} index.selection
The coverage index MUST combine the most recent recorded test attempt for each
nextest binary and test name among the retained runs. "Most recent" MUST refer
to when the attempt started, including failed or interrupted attempts. A newer
filtered run MUST update only the tests it executes, leaving other compatible
test records available to the combined view. A newer attempt with missing or
unreadable coverage MUST be shown as unavailable rather than replaced with an
older successful attempt. Results from incompatible instrumented build
configurations MUST NOT be combined under
{cite}`requirements.test-coverage.storage.configuration`.

The main combined view MUST use the instrumented build configuration of the
most recently started recorded test attempt. Latest-per-test selection MUST
occur within that configuration. Records from other configurations MUST be
identified as excluded historical coverage. Configuration selection MUST use
recorded metadata without building or executing tests.
:::
Input 3: requirements selection requirements.test-coverage.index.freshness
:::{req} index.freshness
Only records whose captured source inputs match the current project source and
whose build configurations are compatible MAY contribute execution counts to
the combined view of {cite}`requirements.test-coverage.index.selection`.
Records invalidated by a source change, or whose compatibility cannot be
established, MUST be identified as stale or unavailable and excluded from the
combined coverage totals. Their per-process reports and matching captured source
MUST remain retained in the build artifacts until those artifacts are removed.
:::
Input 4: requirements selection requirements.references.rust_item_coverage
:::{req} rust_item_coverage
During repository validation, Habeas MUST parse every first-party Rust source file: every `.rs` file among the sources reference discovery considers under {cite}`requirements.references.discovery`, except those under the project-root `vendor` directory. Each explicitly declared function or method, including trait methods and test helpers, and each struct, enum, and union is an item that can be covered. An item is covered when it has a valid `{impl}`, `{cite}`, or `{test}` reference to a defined requirement or named example, or a valid citation of the built-in `habeas:util` under {cite}`requirements.references.util`, in a Rust comment attached to it or within its body; or when its outline node, or an outline node containing it, is recorded with its current hash as an outline input of an evidence record, a citation review, or a site review. Outline inputs recorded from selected search snippets under {cite}`requirements.authoring.finish_search.inputs` MUST count alongside mandatory inputs and additional reads. Comments belong to items under {cite}`requirements.references.outline_comments`; a comment before a field, variant, or attribute inside an item belongs to that item. A named example MUST reference a requirement under {cite}`requirements.examples.definition`. A reference in a string literal, on an enclosing module or impl block, or only in an evidence input MUST NOT count for the items it encloses. Habeas MUST report a Rust parse failure instead of silently skipping the file. Only {cite}`requirements.references.coverage.tests` and {cite}`requirements.references.coverage.examples` make an uncovered item a validation error; other items without recent coverage are warned about under {cite}`requirements.references.coverage.report`.
:::

Other sources

Input 1: requirements selection requirements.test-coverage.index.summary
:::{req} index.summary
The coverage index MUST display the combined view selected under
{cite}`requirements.test-coverage.index.selection` and
{cite}`requirements.test-coverage.index.freshness`. It MUST show the number of
selected test attempts and summarize coverage excluded because it is stale,
unavailable, or from a historical build configuration. Detailed test identities,
run provenance, and per-test execution data MUST remain in the saved coverage
artifacts rather than being included in the generated book.

For first-party Rust files under
{cite}`requirements.references.rust_item_coverage`, the summary MUST compute
line coverage from the union of instrumented file-and-line locations in the
selected fresh records, including their associated child-process records.
Each location MUST count once in the denominator and count as covered when any
selected record has a positive execution count for it. Percentages MUST be
computed from those union counts rather than averaged across process reports.
A view with no instrumented lines MUST show coverage as unavailable. The index
MUST visibly identify incomplete coverage and MUST NOT imply that every current
test has coverage merely because all available records are valid.
:::