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.skill_structure.bootstrap

Requirements index · View definition

evidence Valid

Requirement

Under cite requirements.cli.skill_structure, the habeas-bootstrap-requirements skill MUST be the home of deriving an initial requirement set from existing code.

Rationale

Obligations. requirements.cli.skill_structure.bootstrap has two parts. The habeas-bootstrap-requirements skill must contain the direction for deriving an initial requirement set from existing code. Under the parent requirements.cli.skill_structure, that skill must be the only home for the topic, so no other skill may state it in full.

Test. tests/authoring_cli.rs#fn[the_bootstrap_skill_is_home_of_deriving_an_initial_requirement_set] is marked {test} for the subject. It covers both parts.

  • Content. The test reads the skill’s SKILL.md with skill_md. For each of ## Inventories, ## Proposing requirements, ## Tagging and ## Report, it calls section, which asserts the heading exists. The four headings cover the derivation workflow. The inventories come first, then proposing, tagging and reporting.
  • Home. assert_home("habeas-bootstrap-requirements") checks the markers from home_markers: “every first-party runnable test or test case”, “## Proposing requirements” and “Independent recount:”. It uses assert_phrases over the whole skill (SKILL.md plus references/) to assert the home states each one. It then loops over every other skill in SKILLS and asserts none contains any of those markers, with the message “{other} restates {home}’s {marker}”. This enforces the “exactly one skill, its home” condition from the parent for this topic.

Failures it would catch. The test fails in three cases:

  • The bootstrap skill drops one of the workflow sections.
  • The bootstrap skill drops the marker phrases.
  • Another skill, such as habeas, habeas-requirements, habeas-evidence or habeas-refactor, copies a bootstrap marker.

Gaps. I found none. The requirement is broad and says nothing more specific about content. The headings and markers are a reasonable proxy for it. Cross-reference behaviour belongs to the sibling requirement skill_structure.refer, which has its own test. There are no acknowledgments, and none are needed.

Inputs

Tests

Input 3: outline tests/authoring_cli.rs fn[the_bootstrap_skill_is_home_of_deriving_an_initial_requirement_set]
// {test}`requirements.cli.skill_structure.bootstrap`
#[test]
fn the_bootstrap_skill_is_home_of_deriving_an_initial_requirement_set() {
    let raw = skill_md("habeas-bootstrap-requirements");
    for heading in [
        "## Inventories",
        "## Proposing requirements",
        "## Tagging",
        "## Report",
    ] {
        section(raw, heading);
    }
    assert_home("habeas-bootstrap-requirements");
}

Referenced definitions

Input 2: requirements selection requirements.cli.skill_structure
:::{req} skill_structure
Habeas's bundled agent skills MUST jointly give the direction that the requirements on them specify. A skill consists of its `SKILL.md` and the files under its `references/` directory. Each topic MUST be stated in full in exactly one skill, its home.
:::

Other sources

Input 1: requirements selection requirements.cli.skill_structure.bootstrap
:::{req} skill_structure.bootstrap
Under {cite}`requirements.cli.skill_structure`, the `habeas-bootstrap-requirements` skill MUST be the home of deriving an initial requirement set from existing code.
:::
Input 4: outline tests/authoring_cli.rs fn[assert_home]
/// Asserts that `home` states each of its markers and no other skill does.
// {cite}`habeas:util`
fn assert_home(home: &str) {
    assert_phrases(home, home_markers(home));
    for other in SKILLS.into_iter().filter(|other| *other != home) {
        let text = bundled_skill(other);
        for marker in home_markers(home) {
            assert!(
                !text.contains(marker),
                "{other} restates {home}'s {marker:?}"
            );
        }
    }
}
Input 5: outline tests/authoring_cli.rs fn[section]
/// The collapsed body of a Markdown section, from the line after `heading` to
/// the next heading of the same or a higher level outside a code fence.
// {cite}`habeas:util`
fn section(raw: &str, heading: &str) -> String {
    let level = heading.chars().take_while(|c| *c == '#').count();
    let mut lines = raw.lines().skip_while(|line| *line != heading);
    assert!(lines.next().is_some(), "no section {heading:?}");
    let mut fence: Option<usize> = None;
    let mut body = Vec::new();
    for line in lines {
        let ticks = line.trim_start().chars().take_while(|c| *c == '`').count();
        match fence {
            Some(open) if ticks >= open && line.trim().chars().all(|c| c == '`') => fence = None,
            Some(_) => {}
            None if ticks >= 3 => fence = Some(ticks),
            None => {
                let hashes = line.chars().take_while(|c| *c == '#').count();
                if hashes > 0 && hashes <= level && line[hashes..].starts_with(' ') {
                    break;
                }
            }
        }
        body.push(line);
    }
    collapse(&body.join("\n"))
}
Input 6: outline tests/authoring_cli.rs fn[skill_md]
/// A bundled skill's raw `SKILL.md`.
// {cite}`habeas:util`
fn skill_md(name: &str) -> &'static str {
    skill_files(name)[0].1
}
Input 7: outline tests/authoring_cli.rs fn[home_markers]
/// Phrases that state part of a topic in full, by the skill that is its home.
// {cite}`habeas:util`
fn home_markers(home: &str) -> &'static [&'static str] {
    match home {
        "habeas" => &[
            "| Task | Skill |",
            "A selection is a full name or a glob in which `*` matches any characters",
            "Its full name is the chapter path relative to that directory",
            "Fence a reference to attach commentary",
            "`:::{violations} <name>` selects constructs likely to break it",
            "Each site-query match makes a site",
            "omit a leading `reqs/` and a trailing `/index` or `/README`",
            "silently defines nothing",
            "needs a longer outer fence such as `::::{req}`",
            "Profiles, reports, and captured source under the Cargo target directory",
            "Install prerequisites",
        ],
        "habeas-requirements" => &[
            "Write drafts from the request straight into the chapter",
            "For each group, start a read-only subagent",
            "**Gate:** no implementation or test code",
            "A *root* is an item that carries out part of a requirement",
            "## What the review checks",
            "# Requirement group review",
            "**Compound:** a requirement that lists several independent forms",
        ],
        "habeas-evidence" => &[
            "A judgment is one of three outcomes",
            "`habeas author --all` assesses every definition whose evidence is missing, stale, or invalid",
            "## Fixing findings",
            "An item has recent coverage when it has its own reference, or when a recent version of an existing evidence record or review read it",
            "A FIXME judgment, such as",
            "gets a citation review. For project requirements and examples it checks that",
            "For built-ins it checks their permitted forms and stated criteria",
            "A site the requirement does not apply to is judged true",
            "The goal is that independent assessments of the same subject reach the same determination",
            "describing the change relative to the prior commit rather than the drafts that led to it",
        ],
        "habeas-bootstrap-requirements" => &[
            "every first-party runnable test or test case",
            "## Proposing requirements",
            "Independent recount:",
        ],
        "habeas-refactor" => &[
            "habeas refactor --dry-run",
            "`--map 'src/config.rs#fn[load]=src/config/load.rs#fn[load]'`",
            "\"Would leave ... unchanged\" lists records a mapping affects that fail a check",
        ],
        _ => panic!("unknown skill {home}"),
    }
}
Input 8: outline tests/authoring_cli.rs fn[assert_phrases]
// {cite}`habeas:util`
fn assert_phrases(name: &str, phrases: &[&str]) {
    assert_text(name, &bundled_skill(name), phrases);
}
Input 9: outline tests/authoring_cli.rs fn[bundled_skill]
/// A bundled skill: its `SKILL.md` together with its reference files,
/// collapsed.
// {cite}`habeas:util`
fn bundled_skill(name: &str) -> String {
    let files = skill_files(name)
        .iter()
        .map(|(_, text)| *text)
        .collect::<Vec<_>>();
    collapse(&files.join("\n"))
}
Input 10: outline tests/authoring_cli.rs const[SKILLS]
/// The bundled skills, by name.
// {cite}`habeas:util`
const SKILLS: [&str; 5] = [
    "habeas",
    "habeas-requirements",
    "habeas-evidence",
    "habeas-bootstrap-requirements",
    "habeas-refactor",
];