requirements.cli.skill_structure.requirements
Requirements index · View definition
Requirement
Under
, the
habeas-requirementsskill MUST be the home of drafting, reviewing, and agreeing requirements, the requirement review criteria, the procedure for choosing references, and the criteria the assessment applies to code and tests.
Rationale
The one marked test, tests/authoring_cli.rs#fn[the_requirements_skill_is_home_of_drafting_review_references_and_criteria], adequately checks requirements.cli.skill_structure.requirements. I did not read the skill files themselves, so the test’s phrases are taken as given and I did not confirm they match the shipped text.
Obligations derived from the requirement
- The
habeas-requirementsskill is the home of drafting, reviewing, and agreeing requirements. - It is the home of the requirement review criteria.
- It is the home of the procedure for choosing references.
- It is the home of the criteria the assessment applies to code and tests.
- “Home” comes from the cited parent,
requirements.cli.skill_structure: each topic is stated in full in exactly one skill. So each topic must be present inhabeas-requirementsand absent from the other skills.
How the test covers them
- Drafting, reviewing, agreeing (obligation 1): The test looks through the parsed numbered steps of the Workflow section, using
workflow_steps("habeas-requirements"). It asserts that some step contains “Draft. Write drafts”, “Review. Sort the new and changed requirements”, and “Gate:”. The assertion message names each topic. - Choosing references (obligation 3):
section(raw, "## Choosing references")must contain “A root is”. - Assessment criteria for code and tests (obligation 4):
section(raw, "## What the review checks")must contain “obligations, boundaries, and failure cases no test runs and asserts” and “The supervising agent must still check that the code fulfills each applicable requirement”. These are the test-adequacy and code-fulfilment criteria. - Requirement review criteria (obligation 2): The
## Criteriasection ofreferences/review-prompt.mdin that skill must contain Compound:, Checkable: and One reading:. This also exercises the rule that a skill includes itsreferences/files. - Exactly one home (obligation 5):
assert_home("habeas-requirements")runs two checks.- It asserts that the skill’s combined text, SKILL.md plus references, contains every marker from
home_markers. Those markers cover drafting, reviewing, the Gate, the root definition, “## What the review checks”, “# Requirement group review”, and the Compound criterion. - It asserts that none of the other four skills contains any of those markers. Failure messages say “{other} restates {home}’s {marker}”.
- It asserts that the skill’s combined text, SKILL.md plus references, contains every marker from
Supporting tests
Other marked tests add to this one. bundled_skills_refer_to_a_topic_home_instead_of_restating_it and bundled_skills_direct_the_reference_procedure_and_report_items_without_one check that other skills only point to the home and do not restate the reference procedure. bundled_skills_direct_behavior_review_against_requirements checks the review criteria in more detail. This test does not depend on them.
Assessment
- Each obligation has a concrete assertion on specific text.
- The absence check against the other skills is enforced.
- “Stated in full” can only be approximated by distinctive marker phrases for a prose requirement like this one. The markers are spread across the topics and sit in the right sections, so a skill that dropped or moved a topic would fail.
- I found no unmarked test or wrong expectation.
- No
{fixme}acknowledgments apply.
Inputs
Implementation
Input 11: outline assets/skills/habeas-requirements/SKILL.md section[Habeas%20requirements]/section[Workflow]
- File:
assets/skills/habeas-requirements/SKILL.md - Selector:
section[Habeas%20requirements]/section[Workflow] - Kind:
section assets/skills/habeas-requirements/SKILL.md:12–86
## Workflow
- [ ] 1. Check the starting point. Run `git status` on the book's source
directory. If it has uncommitted edits you did not make in this task, ask
the user whether they belong to it. Read the relevant requirements, code,
and tests; `habeas info <selection>` prints a requirement's text and state.
If the change adds, alters, or removes no observable behavior (a comment typo, a
dependency bump, a speed-up), or an existing requirement already specifies
it (most bug fixes), tell the user which requirement covers it, or that
none is needed, and go to step 6.
- [ ] 2. Draft. Write drafts from the request straight into the chapter as
uncommitted, unstaged edits, with no draft marker; Git tracks what is in
progress. For a new chapter, add it to `SUMMARY.md` and `git add -N` it so
reviewers and Habeas see it. Ask the user only what the request can't
answer; the review in step 3 finds the rest. Drafts may be high-level,
compound, or incomplete. Cover each observable outcome and failure case
of the change without committing to an implementation. Reuse existing
requirements by full name, and propose a new one only for behavior none
covers; one general requirement, such as "invalid arguments MUST be
reported with usage", can cover many branches. Note the open product
choices; reviewers get them in step 3.
- [ ] 3. Review. Sort the new and changed requirements into groups that one
reviewer should see together: requirements that cite each other or
describe one feature. For each group, start a read-only subagent, all in
parallel. Tell it to read this skill's `references/review-prompt.md` and
the habeas skill's `SKILL.md` by absolute path, and give it the group's
full names and a brief: what the user asked for, the decisions already
made, and the open choices already noted, which it should not re-raise.
If you can't start subagents, review each group yourself against the
prompt, one group at a time. Apply the revised text the reviews return,
and reconcile reviews that clash, such as two that split the same
requirement differently; a clash whose resolution changes what is
promised becomes a design question.
- [ ] 4. Present each group to the user: its exact text, including any `{sites}`
and `{violations}` queries, and the design questions the review returned,
each with its options and your recommendation. Show text that was already
agreed or that the user supplied as a diff against that text, then a
"Mechanical:" list of the changes. Show the edits reviewers made outside
their group the same way, and list added `{example}`s, which each need a
test. Don't raise mechanical changes to new text as questions. Apply the
user's decisions. If a decision adds an obligation no reviewer saw,
review that group again.
**Gate:** no implementation or test code, and no commit, until the user
has agreed to, rejected, or deferred every group. Exact text the user supplied, or explicit agreement
earlier in the conversation, counts; a general request to build the
feature does not. If you cannot ask the user in this session, stop,
leave the drafts uncommitted, and report them with the design
questions.
- [ ] 5. Commit. Revert drafts the user rejected or deferred (`git restore -p`)
and list them in your report. Check with `git diff` that the book holds
exactly the agreed text, then commit it, all groups together, before any
code; leave out unrelated edits found in step 1. For a change to agreed
text, the message gives the reason and the rationale that prompted it,
relative to the prior commit (habeas-evidence, "Rules"). This commit fails
validation until evidence is authored; that is expected, as only the pull
request as a whole must pass. Report the full names. In a design session
with no code to write, stop here.
- [ ] 6. Implement and test. Add references as "Choosing references" says, then
check the work against "What the review checks". When a requirement was
split, move the `{impl}` and `{test}` of each split-off part to its new
name.
- [ ] 7. Next, follow the habeas-evidence skill to author evidence and fix what
it reports. When assessments disagree, follow its "Disagreeing
assessments".
Every change to agreed text, including a rewording for precision or removing a
requirement, goes through steps 3 to 5 before it is committed. If
implementation shows that agreed text must change, stop work that depends on it and take the changed requirements
through steps 3 to 5 first. Behavior no requirement covers goes back to step 2.
Renaming or moving a committed requirement is a habeas-refactor task, agreed
with the user and committed before its text changes. Restructuring code in
place, including renaming an item, needs no requirement review, but references
move with the code and the evidence is reassessed; moving code to another file
or outline node is a habeas-refactor task.
Input 12: outline assets/skills/habeas-requirements/SKILL.md section[Habeas%20requirements]/section[Choosing%20references]
- File:
assets/skills/habeas-requirements/SKILL.md - Selector:
section[Habeas%20requirements]/section[Choosing%20references] - Kind:
section assets/skills/habeas-requirements/SKILL.md:87–143
## Choosing references
The reviewer starts from a requirement's `{impl}` and `{test}` items and follows
what they *reach*: what an item calls, the types it uses, and the trait methods
it calls, transitively. Callers don't count. An item *carries out* part of a
requirement when it makes a decision, performs a check, produces an output, or
handles a case the requirement specifies; a type does when the requirement
constrains its fields, variants, serialized form, or validation. A *root* is an
item that carries out part of a requirement and that no other `{impl}` item for
it reaches. Roots are per requirement: a helper reached from one requirement's
root may be a root of another.
For each requirement or example an item could reference (an item may carry
several):
1. A test designed to verify it gets `{test}`. Helpers the test calls need
nothing; setup a test happens to exercise does not count.
2. Otherwise a root gets `{impl}`. Leave what it reaches unmarked.
3. Otherwise, code that should be re-checked when the requirement changes gets
`{cite}`.
4. Otherwise, if the item is still uncovered after `habeas author` has run
(see Gotchas), and it serves other code and carries out no requirement
itself, it gets
`` // {cite}`habeas:util` ``. That includes code a library calls, such as a
trait implementation it requires.
Edge cases:
- Code that only checks consistency with a requirement, such as recognizing a
form it defines to decide whether to run other behavior, gets `{cite}`. A
dispatcher that only routes to the implementation gets `{cite}` of what it
dispatches to, or nothing.
- A requirement that refines another's obligation can `{impl}` it.
- A site of a distributed requirement needs no reference to it, but a site that
is a root of another requirement gets `{impl}` of that one.
- If a behavior follows only from several requirements together, mark each with
`{impl}` where it applies and add fenced commentary saying how they combine.
For example, `^C` quits because one requirement maps `^C` to `q` and another
says q stops managed forwards; a reference alone would not say why `^C` is
accepted.
- For internal code with an invariant worth checking, such as a cache that must
not change results, propose a requirement stating the invariant and
`{impl}` it. Don't propose grouping requirements that state no checkable
obligation, such as one covering an area's internal helpers.
- An item that neither carries out a requirement nor serves other code needs a
requirement or is not needed: report it to the user with a proposed
requirement, or as dead code if nothing reaches it. Don't delete it unasked.
- Don't remove an existing `{impl}` from code a root reaches unless the user
asks: the user may want it as a root, and removing it changes what the
assessment reads.
`{cite}` implements nothing; a citation review checks project citations' roles
and built-ins' stated criteria. Execution-coverage exceptions use
`habeas:coverage` with an assessed prose justification, as the habeas skill's
"Testing and coverage artifacts" explains. To defer a requirement gap the user agrees to,
use `{fixme}` as the habeas-evidence skill's `references/fixme.md` describes.
Input 13: outline assets/skills/habeas-requirements/SKILL.md section[Habeas%20requirements]/section[What%20the%20review%20checks]
- File:
assets/skills/habeas-requirements/SKILL.md - Selector:
section[Habeas%20requirements]/section[What%20the%20review%20checks] - Kind:
section assets/skills/habeas-requirements/SKILL.md:144–180
## What the review checks
Before running `habeas author`, check the change against what each
requirement's assessment treats as a gap:
- obligations, boundaries, and failure cases no test runs and asserts. A test
may be omitted only for code with no logic of its own, or code that needs
network services, real time, or process-wide state no project test sets up;
temporary files don't qualify, and an obligation that a value stays
unchanged, distinct, or present always needs a test;
- assertions whose expected results contradict the requirement, or assertions
too weak to rule out plausible requirement-violating behavior;
- a standalone test designed to verify the subject without `{test}`; helpers
reached from marked tests need no reference of their own;
- an applicable SHOULD with inadequate tests, and text with two equally
supported readings that lead to different testing judgments.
An example's review checks that tests' setup and assertions cover its scenario
and each expected outcome. One acknowledged gap does not excuse others.
Derive expected behavior from the requirement, then map each obligation assessed
here to concrete test inputs and assertions. Follow helpers, fixtures, snapshots,
and parameterized tests before claiming an assertion is absent. For a proposed
adequacy gap, explain what requirement-violating behavior those tests would
accept, and check whether another reviewed test rules it out. Identify delegated
obligations and established testing exemptions separately.
The model initially receives the subject and its context, test sources, and
comment-only `{fixme}` acknowledgments. An `{impl}` reference or anchor alone
does not supply implementation source. `references` locates sources without
reading them; its `roles` filter can select implementations. A `habeas` source
read is recorded. The model requests implementation only for a specific question;
its passing judgment establishes test adequacy, not implementation correctness.
The supervising agent must still check that the code fulfills each applicable
requirement and introduces no additional end-user-observable behavior without an
agreed requirement.
Tests
Input 3: outline tests/authoring_cli.rs fn[the_requirements_skill_is_home_of_drafting_review_references_and_criteria]
- File:
tests/authoring_cli.rs - Selector:
fn[the_requirements_skill_is_home_of_drafting_review_references_and_criteria] - Kind:
fn tests/authoring_cli.rs:3359–3397
// {test}`requirements.cli.skill_structure.requirements`
#[test]
fn the_requirements_skill_is_home_of_drafting_review_references_and_criteria() {
let raw = skill_md("habeas-requirements");
for (phrase, topic) in [
("Draft. Write drafts", "drafting"),
("Review. Sort the new and changed requirements", "reviewing"),
("**Gate:**", "agreeing"),
] {
assert!(
workflow_steps("habeas-requirements")
.iter()
.any(|(_, text)| text.contains(phrase)),
"{topic}"
);
}
assert_text(
"choosing references",
§ion(raw, "## Choosing references"),
&["A *root* is"],
);
assert_text(
"what the review checks",
§ion(raw, "## What the review checks"),
&[
"obligations, boundaries, and failure cases no test runs and asserts",
"The supervising agent must still check that the code fulfills each applicable requirement",
],
);
assert_text(
"requirement review criteria",
§ion(
skill_file("habeas-requirements", "references/review-prompt.md"),
"## Criteria",
),
&["**Compound:**", "**Checkable:**", "**One reading:**"],
);
assert_home("habeas-requirements");
}
Referenced definitions
Input 2: requirements selection requirements.cli.skill_structure
requirements.cli.skill_structure:md/requirements/cli.md:444–451
:::{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.requirements
requirements.cli.skill_structure.requirements:md/requirements/cli.md:469–473
:::{req} skill_structure.requirements
Under {cite}`requirements.cli.skill_structure`, the `habeas-requirements` skill MUST be the home of drafting, reviewing, and agreeing requirements, the requirement review criteria, the procedure for choosing references, and the criteria the assessment applies to code and tests.
:::
Input 4: outline tests/authoring_cli.rs fn[assert_home]
- File:
tests/authoring_cli.rs - Selector:
fn[assert_home] - Kind:
fn tests/authoring_cli.rs:3092–3105
/// 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[assert_text]
- File:
tests/authoring_cli.rs - Selector:
fn[assert_text] - Kind:
fn tests/authoring_cli.rs:3011–3016
// {cite}`habeas:util`
fn assert_text(label: &str, text: &str, phrases: &[&str]) {
for phrase in phrases {
assert!(text.contains(phrase), "{label} lacks {phrase:?}");
}
}
Input 6: outline tests/authoring_cli.rs fn[workflow_steps]
- File:
tests/authoring_cli.rs - Selector:
fn[workflow_steps] - Kind:
fn tests/authoring_cli.rs:2956–2989
/// The numbered steps of a bundled skill's "Workflow" section, each with its
/// number and collapsed text, including its indented continuation lines.
// {cite}`habeas:util`
fn workflow_steps(name: &str) -> Vec<(u32, String)> {
let (_, rest) = skill_md(name)
.split_once("\n## Workflow\n")
.unwrap_or_else(|| panic!("{name} has no workflow"));
let mut steps: Vec<(u32, Vec<&str>)> = Vec::new();
let mut open = false;
for line in rest.lines() {
if line.starts_with("## ") {
break;
}
let numbered = line
.strip_prefix("- [ ] ")
.and_then(|step| step.split_once(". "))
.and_then(|(number, text)| Some((number.parse().ok()?, text)));
if let Some((number, text)) = numbered {
steps.push((number, vec![text]));
open = true;
continue;
}
if !line.is_empty() && !line.starts_with(' ') {
open = false;
}
if open {
steps.last_mut().unwrap().1.push(line);
}
}
steps
.into_iter()
.map(|(number, lines)| (number, collapse(&lines.join("\n"))))
.collect()
}
Input 7: 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"))
}
Input 8: outline tests/authoring_cli.rs fn[home_markers]
- File:
tests/authoring_cli.rs - Selector:
fn[home_markers] - Kind:
fn tests/authoring_cli.rs:3040–3090
/// 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 9: outline tests/authoring_cli.rs fn[assert_phrases]
- File:
tests/authoring_cli.rs - Selector:
fn[assert_phrases] - Kind:
fn tests/authoring_cli.rs:3030–3033
// {cite}`habeas:util`
fn assert_phrases(name: &str, phrases: &[&str]) {
assert_text(name, &bundled_skill(name), phrases);
}
Input 10: outline tests/authoring_cli.rs fn[bundled_skill]
- File:
tests/authoring_cli.rs - Selector:
fn[bundled_skill] - Kind:
fn tests/authoring_cli.rs:2909–2918
/// 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 14: outline md/reference.md section[How%20it%20works]/section[References]/section[Choosing%20references]
- File:
md/reference.md - Selector:
section[How%20it%20works]/section[References]/section[Choosing%20references] - Kind:
section md/reference.md:606–617
### Choosing references
For each definition a source item could reference, choose by this procedure. An item may carry several references.
1. If the item is a test or test helper designed to verify the definition, use `{test}`.
2. Otherwise, if fulfilling the definition depends on the item, use `{impl}`. For code, this means it makes a decision, performs a check, produces an output, or handles a case the definition specifies. For a type, it means the definition constrains its shape: its fields, variants, serialized form, or validation.
3. Otherwise, if the item should be re-checked or kept in sync when the definition changes, use `{cite}`.
4. If the item has no reference after applying steps 1 to 3 to every definition, and no assessment reads it, cite the built-in `habeas:util` when it serves other code. An item that does neither carries out behavior that needs a requirement, or is not needed.
For internal code, state any invariant worth checking, such as a cache that must not change results, as an ordinary requirement and implement it. Otherwise cite `habeas:util` for an item that only serves other code. An item that does neither needs a requirement, or is not needed. Do not write grouping requirements that state no checkable obligation just to give internal helpers something to reference.
{cite}`requirements.references.procedure` {cite}`requirements.cli.internal_detail_guidance`
Input 15: outline tests/authoring_cli.rs fn[bundled_skills_direct_the_reference_procedure_and_report_items_without_one]
- File:
tests/authoring_cli.rs - Selector:
fn[bundled_skills_direct_the_reference_procedure_and_report_items_without_one] - Kind:
fn tests/authoring_cli.rs:4557–4621
// {test}`requirements.cli.internal_detail_guidance`
// {test}`requirements.cli.behavior_review_guidance`
#[test]
fn bundled_skills_direct_the_reference_procedure_and_report_items_without_one() {
// habeas-requirements is the home of the reference procedure; its steps
// come in order.
assert_text_in_order(
"choosing references",
§ion(skill_md("habeas-requirements"), "## Choosing references"),
&[
"a type does when the requirement constrains its fields, variants, serialized form, or validation",
"For each requirement or example an item could reference",
"1. A test designed to verify it gets `{test}`",
"2. Otherwise a root gets `{impl}`",
"3. Otherwise, code that should be re-checked when the requirement changes gets `{cite}`",
"and it serves other code and carries out no requirement itself, it gets `` // {cite}`habeas:util` ``",
"That includes code a library calls, such as a trait implementation it requires",
"propose a requirement stating the invariant and `{impl}` it",
"Don't propose grouping requirements that state no checkable obligation",
"An item that neither carries out a requirement nor serves other code needs a requirement or is not needed: report it to the user with a proposed requirement, or as dead code if nothing reaches it. Don't delete it unasked",
],
);
// The other skills refer to the procedure rather than restate it.
assert_phrases(
"habeas-evidence",
&[
"choose references by \"Choosing references\" in the habeas-requirements skill",
"| the item only serves other code | add `` // {cite}`habeas:util` `` |",
],
);
assert_phrases(
"habeas-bootstrap-requirements",
&[
"\"Choosing references\" in the habeas-requirements skill",
"write a requirement for the invariant they check",
"An item that neither carries out a requirement nor serves other code goes on the gap list: it needs a requirement or is not needed",
],
);
for name in SKILLS
.into_iter()
.filter(|name| *name != "habeas-requirements")
{
assert!(
!bundled_skill(name).contains("fields, variants, serialized form, or validation"),
"{name} restates the reference procedure"
);
}
for name in SKILLS {
let text = bundled_skill(name);
for grouping in [
"internal.config_parsing",
"catch-all",
"internal-detail requirement",
] {
assert!(!text.contains(grouping), "{name} suggests {grouping:?}");
}
let reference_guidance = text.replace("no explanation can waive them", "");
for waiver in ["may waive", "can waive", "waiver applies", "is exempt"] {
assert!(
!reference_guidance.to_lowercase().contains(waiver),
"{name} offers a waiver"
);
}
}
}
Input 16: outline tests/authoring_cli.rs fn[bundled_skills_direct_behavior_review_against_requirements]
- File:
tests/authoring_cli.rs - Selector:
fn[bundled_skills_direct_behavior_review_against_requirements] - Kind:
fn tests/authoring_cli.rs:4623–4720
// {test}`requirements.cli.behavior_review_guidance`
#[test]
fn bundled_skills_direct_behavior_review_against_requirements() {
// The three outcomes.
assert_phrases(
"habeas-evidence",
&[
"A judgment is one of three outcomes",
"`true`: the reviewed tests adequately check the definition, with no gap under",
"`false`: there is a gap that no `{fixme}` reference acknowledges",
"FIXME: `{fixme}` references acknowledge every remaining gap",
],
);
// Every observable branch, and no unspecified behavior.
assert_phrases(
"habeas-requirements",
&[
"Every end-user-observable result of the code, including errors and input handling, must follow from a requirement the user agreed to",
],
);
assert_phrases(
"habeas-bootstrap-requirements",
&[
"distinct observable branches",
"every observable branch has been reviewed",
],
);
assert_phrases(
"habeas-evidence",
&["Behavior with no requirement needs one agreed with the user"],
);
// The requirement and example review criteria, including test adequacy and
// justified absence of tests; habeas-requirements is their home.
assert_text(
"what the review checks",
§ion(skill_md("habeas-requirements"), "## What the review checks"),
&[
"assertions whose expected results contradict the requirement",
"a standalone test designed to verify the subject without `{test}`",
"The supervising agent must still check that the code fulfills each applicable requirement",
"obligations, boundaries, and failure cases no test runs and asserts",
"A test may be omitted only for code with no logic of its own, or code that needs network services, real time, or process-wide state no project test sets up",
"an obligation that a value stays unchanged, distinct, or present always needs a test",
"An example's review checks that tests' setup and assertions cover its scenario and each expected outcome",
"One acknowledged gap does not excuse others",
],
);
assert_phrases(
"habeas-evidence",
&[
"A false rationale names one of the gaps listed in \"What the review checks\" in the habeas-requirements skill",
],
);
// The three outcomes and the documented-gap convention; habeas-evidence is
// the home of FIXME judgments.
assert_phrases(
"habeas-evidence",
&[
"| false judgment | read the rationale",
"A FIXME judgment, such as `{\"FIXME\": [\"rust-lang/rust#123\"]}`, means `{fixme}` references to the definition acknowledge every remaining gap",
"Validation accepts it like `true` when all other checks pass",
"// :github: rust-lang/rust#123",
"A plain `FIXME` or `TODO` comment does not count",
],
);
assert_phrases(
"habeas-requirements",
&["To defer a requirement gap the user agrees to, use `{fixme}`"],
);
// Roots get `{impl}`, tests `{test}`, and `{cite}` only for related code.
assert_text(
"choosing references",
§ion(skill_md("habeas-requirements"), "## Choosing references"),
&[
"1. A test designed to verify it gets `{test}`",
"2. Otherwise a root gets `{impl}`. Leave what it reaches unmarked",
"`{cite}` implements nothing; a citation review checks project citations' roles and built-ins' stated criteria",
],
);
assert_phrases(
"habeas-bootstrap-requirements",
&["`{test}` on tests and `{impl}` on roots; code a root or test reaches needs none"],
);
// Interacting requirements, and a citation alone is not an explanation.
assert_phrases(
"habeas-requirements",
&[
"If a behavior follows only from several requirements together, mark each with `{impl}` where it applies and add fenced commentary saying how they combine",
"a reference alone would not say why `^C` is accepted",
],
);
assert_phrases(
"habeas-bootstrap-requirements",
&[
"Where one behavior follows from several requirements, mark each with `{impl}` where it applies and explain how they combine",
],
);
}