requirements.cli.requirements_review_skill.review_prompt.compound
Requirements index · View definition
Requirement
The review prompt’s criteria MUST count as compound a requirement that lists several independent forms, checks, or outputs. They MUST count a sentence beginning “It MUST also” as a sign of a compound requirement. They MUST direct the reviewer to split a compound requirement into one requirement for each obligation that could be implemented, could change, or could fail on its own, and to move shared detail, such as a template or format, into its own requirement that the others cite.
Rationale
tests/authoring_cli.rs#fn[the_review_prompt_splits_compound_requirements] checks all four obligations of the subject. It reads the ## Criteria section of the bundled references/review-prompt.md through review_prompt() and section(). section() collapses line wrapping with collapse, so phrases that span wrapped lines still match. assert_text then asserts that each phrase is present and fails with a labelled message if one is missing.
- Several independent forms, checks, or outputs count as compound. The test asserts “Compound: a requirement that lists several independent forms, checks, or outputs”. The prompt’s Criteria bullet has that text.
- “It MUST also” is a sign. The test asserts
A sentence beginning "It MUST also" is a strong hint. The wording “strong hint” fits “count as a sign”. - Split by obligation that can be implemented, change, or fail on its own. The test asserts “could one part be implemented, change, or fail while another holds? Then split it”. This covers the three independence criteria and the direction to split.
- Move shared detail into its own requirement that the others cite. The test asserts “Move shared detail, such as a template or a format, into its own requirement that the others cite”.
The check is a text-presence check, which suits a requirement about prompt wording. Two things could pass it while still violating the requirement:
- The phrases could appear in the wrong section.
section()limits the search to## Criteria, and the prompt’sCriteriasection does contain this bullet. - The phrases could be negated. The phrases are specific and directive, so this is implausible.
The Examples section’s compound example is checked separately by the_review_prompt_works_a_mechanical_example_and_a_design_question. It illustrates the criteria and is not part of this requirement’s obligations. I found no gap.
Inputs
Tests
Input 2: outline tests/authoring_cli.rs fn[the_review_prompt_splits_compound_requirements]
- File:
tests/authoring_cli.rs - Selector:
fn[the_review_prompt_splits_compound_requirements] - Kind:
fn tests/authoring_cli.rs:4281–4294
// {test}`requirements.cli.requirements_review_skill.review_prompt.compound`
#[test]
fn the_review_prompt_splits_compound_requirements() {
assert_text(
"criteria",
§ion(review_prompt(), "## Criteria"),
&[
"**Compound:** a requirement that lists several independent forms, checks, or outputs",
"A sentence beginning \"It MUST also\" is a strong hint",
"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",
],
);
}
Other sources
Input 1: requirements selection requirements.cli.requirements_review_skill.review_prompt.compound
requirements.cli.requirements_review_skill.review_prompt.compound:md/requirements/cli.md:288–291
:::{req} requirements_review_skill.review_prompt.compound
The review prompt's criteria MUST count as compound a requirement that lists several independent forms, checks, or outputs. They MUST count a sentence beginning "It MUST also" as a sign of a compound requirement. They MUST direct the reviewer to split a compound requirement into one requirement for each obligation that could be implemented, could change, or could fail on its own, and to move shared detail, such as a template or format, into its own requirement that the others cite.
:::
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"))
}