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.guidance.doctests

Requirements index · View definition

evidence Valid

Requirement

Habeas’s bundled agent instructions MUST direct agents to run Cargo doctests separately with cargo test --doc --workspace.

Rationale

The requirement requirements.test-coverage.guidance.doctests has one obligation. Habeas’s bundled agent instructions MUST direct agents to run Cargo doctests separately with cargo test --doc --workspace. It has no boundary or failure cases, and it states no other conditions.

Where the guidance lives. The requirement is implemented in the SOP agent-sops/approved-implementation.sop.md (declared through :impl:). It is also carried by three bundled skills: assets/skills/habeas/SKILL.md (section “Testing and coverage artifacts”), assets/skills/habeas-evidence/SKILL.md, and assets/skills/habeas-bootstrap-requirements/SKILL.md.

How the test covers it. tests/authoring_cli.rs#fn[bundled_skills_default_to_process_coverage_and_keep_artifacts_disposable] carries {test} for the subject and makes these assertions:

  • For each of the three skills, the whitespace-collapsed bundled text (SKILL.md plus its reference files, via bundled_skill) must contain the exact command string `cargo test --doc --workspace`.
  • The habeas home skill must contain “Run doctests separately with cargo test --doc --workspace”. This checks the “separately” directive and the exact command.
  • habeas-evidence and habeas-bootstrap-requirements must each contain “run doctests separately with cargo test --doc --workspace”.
  • The approved-implementation.sop.md SOP, read with include_str!, must contain “Run doctests separately with cargo test --doc --workspace”.

The assert_text helper asserts contains for every phrase and fails with a labelled message. A bundled instruction that dropped the doctest direction, changed the command (for example to omit --workspace), or dropped “separately” would fail one of these assertions.

Scope. The requirement does not say that every skill must mention doctests, so I did not require tests for habeas-requirements and habeas-refactor. A search found no doctest guidance in them, and the requirement’s implementation anchor is the SOP. The test covers the SOP and every skill that carries the guidance. The same test also covers the sibling requirements guidance and guidance.artifacts. They are outside this assessment.

I found no untested obligation and no mis-specified assertion.

Inputs

Tests

Input 2: outline tests/authoring_cli.rs fn[bundled_skills_default_to_process_coverage_and_keep_artifacts_disposable]
// {test}`requirements.test-coverage.guidance`
// {test}`requirements.test-coverage.guidance.doctests`
// {test}`requirements.test-coverage.guidance.artifacts`
#[test]
fn bundled_skills_default_to_process_coverage_and_keep_artifacts_disposable() {
    for name in ["habeas", "habeas-evidence", "habeas-bootstrap-requirements"] {
        let text = bundled_skill(name)
            .split_whitespace()
            .collect::<Vec<_>>()
            .join(" ");
        for required in [
            "`habeas coverage`",
            "`cargo nextest`",
            "focused runs",
            "`cargo test --doc --workspace`",
            "disposable",
            "Cargo target directory",
        ] {
            assert!(text.contains(required), "{name} omits {required}");
        }
        assert!(
            text.contains("by default") || text.contains("default to"),
            "{name}"
        );
        assert!(
            text.to_lowercase().contains("never stage or commit"),
            "{name}"
        );
        if name != "habeas" {
            assert!(text.contains("Follow the habeas skill's \"Testing and coverage artifacts\""));
        }
    }
    let home = bundled_skill("habeas");
    assert_text(
        "default coverage directive",
        &collapse(&home),
        &[
            "Use `habeas coverage` by default for every Rust unit and integration test run, including focused runs (`habeas coverage -- -E 'test(name)'`)",
            "The workflow uses `cargo nextest` for parallel process runs and retains independent process coverage",
            "Run doctests separately with `cargo test --doc --workspace`",
        ],
    );
    for name in ["habeas-evidence", "habeas-bootstrap-requirements"] {
        assert_text(
            name,
            &collapse(&bundled_skill(name)),
            &[
                "Follow the habeas skill's \"Testing and coverage artifacts\": default to `habeas coverage` for unit, integration and focused runs through `cargo nextest`",
                "run doctests separately with `cargo test --doc --workspace`",
            ],
        );
    }
    assert_text(
        "approved implementation SOP",
        &collapse(include_str!("../agent-sops/approved-implementation.sop.md")),
        &[
            "Use `cargo habeas coverage -- <nextest arguments>` for every Rust unit and integration test run, including focused or filtered runs",
            "It executes parallel processes through `cargo nextest` and retains coverage for each process",
            "Run doctests separately with `cargo test --doc --workspace`",
            "profiles, reports, and source snapshots under the Cargo target directory are disposable build output: never stage or commit them to Git",
        ],
    );
    for required in [
        "Profiles, reports, and captured source",
        "cargo install cargo-nextest --locked",
        "rustup component add llvm-tools-preview",
        "target/habeas/coverage/",
    ] {
        assert!(home.contains(required), "coverage home omits {required}");
    }
}

Other sources

Input 1: requirements selection requirements.test-coverage.guidance.doctests
:::{req} guidance.doctests
Habeas's bundled agent instructions MUST direct agents to run Cargo doctests
separately with `cargo test --doc --workspace`.
:::