requirements.cli.requirements_review_skill.review_prompt.gaps
Requirements index · View definition
Requirement
The review prompt MUST direct the reviewer to find gaps. For each requirement, the reviewer lists the inputs and states the requirement applies to, its boundaries, its failure cases (including empty, missing, duplicate, and invalid input), and its observable outputs. The reviewer then lists the observable behavior that the brief implies but that no requirement in the group or the book states. The prompt MUST direct the reviewer to treat each case the text does not decide as a gap: it resolves the gap mechanically when only one answer is sensible, and otherwise returns it as a design question.
Rationale
tests/authoring_cli.rs#fn[the_review_prompt_finds_gaps_case_by_case] adequately checks the subject.
What the subject requires. The review prompt must direct the reviewer to do four things:
- For each requirement, list its inputs and states, its boundaries, its failure cases (empty, missing, duplicate, invalid) and its observable outputs.
- List the observable behavior the brief implies that no requirement in the group or the book states.
- Treat each case the text does not decide as a gap.
- Resolve such a gap mechanically when only one answer is sensible, and otherwise return it as a design question.
What the test does. It reads assets/skills/habeas-requirements/references/review-prompt.md through review_prompt(). It extracts the ## Finding gaps section with section, which collapses line wraps, and it panics if the heading is missing. It then calls assert_text to assert that the section contains these three phrases:
- “For each requirement, list the inputs and states it applies to, its boundaries and failure cases (empty, missing, duplicate, invalid), and its observable outputs”.
- “Then list the observable behavior the brief implies that no requirement in the group or the book states”.
- “Each case the text does not decide is a gap: resolve it mechanically if only one answer is sensible, otherwise ask”.
Mapping to the obligations.
- Obligation 1 is covered by the first phrase. It includes all four failure-case kinds and the boundaries.
- Obligation 2 is covered by the second phrase. It names both the group and the book as the places to check.
- Obligations 3 and 4 are covered by the third phrase. It includes the mechanical-versus-ask split.
- The prompt text under
## Finding gapscontains these phrases, so the assertions hold. The wording is imperative, which satisfies “MUST direct”.
Possible objections.
- The test does not assert the prompt’s extra “such as messages, output streams, exit codes, and files” clause. The requirement does not call for it.
- The requirement concerns prompt content, so a phrase-presence check is the right way to test it.
- The assertions are scoped to the right section, so matching text elsewhere in the prompt cannot satisfy them.
- The neighbouring
review_promptandreview_prompt.designtests, which this subject does not govern, cover the “return as a design question” mechanism.
Inputs
Tests
Input 2: outline tests/authoring_cli.rs fn[the_review_prompt_finds_gaps_case_by_case]
- File:
tests/authoring_cli.rs - Selector:
fn[the_review_prompt_finds_gaps_case_by_case] - Kind:
fn tests/authoring_cli.rs:4322–4334
// {test}`requirements.cli.requirements_review_skill.review_prompt.gaps`
#[test]
fn the_review_prompt_finds_gaps_case_by_case() {
assert_text(
"finding gaps",
§ion(review_prompt(), "## Finding gaps"),
&[
"For each requirement, list the inputs and states it applies to, its boundaries and failure cases (empty, missing, duplicate, invalid), and its observable outputs",
"Then list the observable behavior the brief implies that no requirement in the group or the book states",
"Each case the text does not decide is a gap: resolve it mechanically if only one answer is sensible, otherwise ask",
],
);
}
Other sources
Input 1: requirements selection requirements.cli.requirements_review_skill.review_prompt.gaps
requirements.cli.requirements_review_skill.review_prompt.gaps:md/requirements/cli.md:307–310
:::{req} requirements_review_skill.review_prompt.gaps
The review prompt MUST direct the reviewer to find gaps. For each requirement, the reviewer lists the inputs and states the requirement applies to, its boundaries, its failure cases (including empty, missing, duplicate, and invalid input), and its observable outputs. The reviewer then lists the observable behavior that the brief implies but that no requirement in the group or the book states. The prompt MUST direct the reviewer to treat each case the text does not decide as a gap: it resolves the gap mechanically when only one answer is sensible, and otherwise returns it as a design question.
:::
Input 3: outline tests/authoring_cli.rs fn[section]
- File:
tests/authoring_cli.rs - Selector:
fn[section] - Kind:
fn tests/authoring_cli.rs:2929–2954
/// 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"))
}