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.requirements_review_skill.review_prompt.criteria

Requirements index · View definition

evidence Valid

Requirement

The review prompt’s criteria MUST direct the reviewer to find each of the following:

  • text that a careful reviewer could read two ways;
  • obligations that a reviewer could not judge from the requirement text, the code, and the tests, or that nothing would fail for if they were broken;
  • text that prescribes an implementation instead of an outcome.

Rationale

Obligations. The requirement says the review prompt’s criteria must direct the reviewer to find three things:

  1. text a careful reviewer could read two ways;
  2. obligations that can’t be judged from the requirement text, the code and the tests, or that nothing would fail for if they were broken;
  3. text that prescribes an implementation instead of an outcome.

Test. tests/authoring_cli.rs#fn[the_review_prompt_criteria_find_ambiguous_uncheckable_and_prescriptive_text] takes the ## Criteria section of the real bundled prompt, assets/skills/habeas-requirements/references/review-prompt.md. It uses section(review_prompt(), "## Criteria"). section extracts the body up to the next same-or-higher heading outside code fences. collapse joins wrapped lines, so phrases match across line breaks. The test then asserts three phrases with assert_text:

  • Checkable: “a reviewer can judge the obligation from the requirement text, the code, and the tests, and something would fail if it were broken”. This covers obligation 2, both the “cannot judge” and the “nothing would fail” halves.
  • One reading: “text a careful reviewer could read two ways is a finding”. This covers obligation 1.
  • Outcome, not implementation: “the text says what must hold, not how”. This covers obligation 3.

Mapping. Each of the three obligations has an assertion on the distinct criterion that carries it. The phrases are long and specific, so a removed or weakened criterion would fail the test. I read the actual Criteria section, and it contains all three bullets with these exact phrases. assert_text fails with a labelled message on any missing phrase. The requirement concerns the prompt’s text content, so a phrase-presence check is the appropriate test for it.

Gaps. None. Another test also asserts these bullet names, but this one is marked with {test} and is sufficient on its own. The Compound and Distributed criteria are outside this requirement.

Inputs

Implementation

Input 3: outline assets/skills/habeas-requirements/references/review-prompt.md section[Requirement%20group%20review]/section[Criteria]
## Criteria

- **Compound:** a requirement that lists several independent forms, checks, or
  outputs is usually one requirement per item. A sentence beginning "It MUST
  also" is a strong hint. Test: could one part be implemented, change, or fail
  while another holds? Then split it. Move shared detail, such as a template or
  a format, into its own requirement that the others cite.
- **Checkable:** a reviewer can judge the obligation from the requirement text,
  the code, and the tests, and something would fail if it were broken.
- **One reading:** text a careful reviewer could read two ways is a finding.
- **Outcome, not implementation:** the text says what must hold, not how.
- **Distributed:** for a requirement with `{sites}` or `{violations}` queries,
  apply the Do and Don't lists in the habeas skill's
  `references/distributed-requirements.md`.

Tests

Input 2: outline tests/authoring_cli.rs fn[the_review_prompt_criteria_find_ambiguous_uncheckable_and_prescriptive_text]
// {test}`requirements.cli.requirements_review_skill.review_prompt.criteria`
#[test]
fn the_review_prompt_criteria_find_ambiguous_uncheckable_and_prescriptive_text() {
    assert_text(
        "criteria",
        &section(review_prompt(), "## Criteria"),
        &[
            "**Checkable:** a reviewer can judge the obligation from the requirement text, the code, and the tests, and something would fail if it were broken",
            "**One reading:** text a careful reviewer could read two ways is a finding",
            "**Outcome, not implementation:** the text says what must hold, not how",
        ],
    );
}

Other sources

Input 1: requirements selection requirements.cli.requirements_review_skill.review_prompt.criteria
:::{req} requirements_review_skill.review_prompt.criteria
The review prompt's criteria MUST direct the reviewer to find each of the following:

- text that a careful reviewer could read two ways;
- obligations that a reviewer could not judge from the requirement text, the code, and the tests, or that nothing would fail for if they were broken;
- text that prescribes an implementation instead of an outcome.
:::
Input 4: 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"))
}