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.distributed_guidance.reviews

Requirements index · View definition

evidence Valid

Requirement

The bundled skills MUST tell agents that sites need no reference to the requirement, that habeas author --all authors site reviews under cite requirements.references.site_review, and that a false site review is addressed by fixing the site, or by tightening the queries or the requirement text when the site should not be covered or the text admits more than one reading, under cite requirements.cli.flip_guidance, not by re-running the review.

Rationale

The subject asks the bundled skills to tell agents three things. The single test, tests/authoring_cli.rs#fn[bundled_skills_explain_site_references_and_site_reviews], checks each one against the real bundled skill files.

  1. Sites need no reference. The test asserts that the Don’t section of the habeas skill’s references/distributed-requirements.md contains “Don’t reference the distributed requirement from a site just because it is a site; sites need none.”
  2. habeas author --all authors site reviews. It asserts this in three places:
    • the Do list: “Let habeas author --all author the site reviews.”
    • the Review section: “habeas author --all authors a site review for each site”.
    • the habeas-evidence skill’s references/reviews.md, in the “Site reviews” section: “authored by habeas author --all”.
  3. How a false site review is addressed. Three assertions cover this:
    • The Don’t list must say “Don’t re-run a false site review for a different result; fix the site, or tighten the queries or the text”. This is the “not by re-running” clause.
    • The references/reviews.md “Site reviews” section is checked in order for “1. If it does apply, fix the code at the site.” and then step 2. Step 2 reads “If the site should not be covered, narrow the site query or tighten the text describing sites; if the obligation’s text admits a reading under which the site fails, tighten that text”. This covers fixing the site, tightening the queries or the text when the site should not be covered, and tightening the text when it admits a reading under which the site fails.
    • The phrase “take them through habeas-requirements steps 3 to 5” must follow. This ties the change to the requirements.cli.flip_guidance process of review, agreement and commit.

The helpers make these assertions meaningful. section extracts the named Markdown section and collapses its whitespace, so phrases wrapped across source lines still match. skill_file panics if the file is missing. assert_text fails if a phrase is absent. assert_text_in_order requires each phrase to appear after the previous one. I read the actual Site reviews section in assets/skills/habeas-evidence/references/reviews.md, and it contains the asserted text.

The {cite} clauses to requirements.references.site_review and requirements.cli.flip_guidance are context. They point to behavior owned by those requirements, so this test does not need to re-test it. The skill wording “admits a reading under which the site fails” is slightly narrower than the requirement’s “admits more than one reading”. I don’t treat that as an adequacy gap, because the test pins the skill’s tighten-the-text direction and the requirement’s wording is satisfied in substance.

I found no obligation of the subject that goes untested, and the test is correctly marked with {test}.

Inputs

Implementation

Input 5: outline assets/skills/habeas-evidence/references/reviews.md section[Citation%20and%20site%20reviews]/section[Site%20reviews]
## Site reviews

A distributed requirement (the habeas skill's
`references/distributed-requirements.md`) gets a site review for each site,
authored by `habeas author --all` or, for one requirement,
`habeas author sites:<full-name>`. A site the requirement does not apply to is
judged true, so a false review means the reviewer found the requirement applies
and is broken:

1. If it does apply, fix the code at the site.
2. If the site should not be covered, narrow the site query or tighten the text
   describing sites; if the obligation's text admits a reading under which the
   site fails, tighten that text. Both edit the requirement, so take them
   through habeas-requirements steps 3 to 5 (subagent review, the user's agreement, commit).

If `habeas info <full-name>` reports many sites the requirement does not apply
to, the site query selects too much.

Tests

Input 4: outline tests/authoring_cli.rs fn[bundled_skills_explain_site_references_and_site_reviews]
// {test}`requirements.cli.distributed_guidance.reviews`
#[test]
fn bundled_skills_explain_site_references_and_site_reviews() {
    assert_text(
        "Do list",
        &section(distributed_reference(), "## Do"),
        &["Let `habeas author --all` author the site reviews."],
    );
    assert_text(
        "Don't list",
        &section(distributed_reference(), "## Don't"),
        &[
            "Don't reference the distributed requirement from a site just because it is a site; sites need none.",
            "Don't re-run a false site review for a different result; fix the site, or tighten the queries or the text",
        ],
    );
    assert_text(
        "distributed review",
        &section(distributed_reference(), "## Review"),
        &["`habeas author --all` authors a site review for each site"],
    );
    assert_text_in_order(
        "site reviews",
        &section(
            skill_file("habeas-evidence", "references/reviews.md"),
            "## Site reviews",
        ),
        &[
            "authored by `habeas author --all`",
            "1. If it does apply, fix the code at the site.",
            "2. If the site should not be covered, narrow the site query or tighten the text describing sites; if the obligation's text admits a reading under which the site fails, tighten that text",
            "take them through habeas-requirements steps 3 to 5",
        ],
    );
}

Referenced definitions

Input 2: requirements selection requirements.references.site_review
:::{req} site_review
Every site of a distributed requirement under
{cite}`requirements.references.distributed` MUST have a site review: an
assessment of whether that site upholds the requirement, recorded at
`evidence/sites/<full-name>/<file>/<selector>.json`, where `<file>` and
`<selector>` are encoded as under
{cite}`requirements.references.citation_review`. The review MUST use the prompt
defined by {cite}`requirements.authoring.site_prompt`. Mandatory inputs, under
{cite}`requirements.authoring.mandatory_inputs`, MUST be the site's outline
node, the requirement's complete declaration, and each declaration the
requirement cites. The record MUST contain the requirement's full name, the
site's file and selector, `queries`, the sorted names of the queries with a
match at the site, `applies`, `determination`, `rationale`, and `inputs`, with
determinations under {cite}`requirements.ci.outcomes`. `applies` MUST be a
Boolean recording whether the requirement applies to the site. A site to which
the requirement does not apply MUST be judged `true`, and the rationale MUST
explain why it does not apply. `habeas info` MUST report, for each selected
distributed requirement, how many of its sites the requirement does not apply
to.

Validation MUST require a current, accepted review for every site, MUST report a
false review with its rationale, and MUST report stale, missing, or orphaned
reviews; a review is orphaned when its file and selector no longer name a site
of the requirement. A `{fixme}` naming the requirement inside a site
acknowledges a gap at that site only: it MUST be an input to that site's review
and MUST NOT contribute to the requirement's own review, coverage, or reference
set. A review MUST become stale when the site's hash, the requirement's
declaration, a cited declaration, its `queries`, or the `{fixme}` references
naming the requirement inside the site, with the words of their bodies, change.
Each site review's determination MUST be checked on its own, independently of
the requirement's evidence. Authoring with `--all` MUST include site reviews,
`habeas author sites:<full-name>` MUST author the site reviews of the named
requirement, and `habeas author sites:<full-name>/<file>#<selector>` MUST author
the review of the one site it names, under
{cite}`requirements.authoring.refresh`, where omitting `#<selector>` names the
file's root node. `habeas status` MUST report missing, stale, invalid, and false
site reviews with their requirement, file, and selector, and `habeas info` MUST
list each selected requirement's sites with their determinations.
:::
Input 3: requirements selection requirements.cli.flip_guidance
:::{req} flip_guidance
The `habeas-evidence` skill MUST state the goal that independent assessments
of the same subject reach the same determination, because the requirement, code,
and tests leave no gap a careful reviewer could find and no reading a careful
reviewer could take differently, and the other bundled skills MUST refer to it
rather than restate it. The skills MUST tell agents that assessments of the
same subject that disagree are findings against that goal. They MUST direct agents to read both
rationales and decide whether one assessment found a real gap or the requirement
text admits more than one reading, then fix the source or tests, or tighten the
requirement text, rather than re-running an assessment to obtain a different
determination. Every change to agreed requirement text, including a rewording for precision,
MUST be reviewed with the user under
{cite}`requirements.cli.requirements_review_skill.agreed_text` before it is committed, and the
skills MUST then direct agents to give the reason, and the rationale that
prompted the change, in the message of the commit that makes it. That message
MUST describe the change relative to the prior commit, not the intermediate
drafts that led to it.
:::

Other sources

Input 1: requirements selection requirements.cli.distributed_guidance.reviews
:::{req} distributed_guidance.reviews
The bundled skills MUST tell agents that sites need no reference to the requirement, that `habeas author --all` authors site reviews under {cite}`requirements.references.site_review`, and that a false site review is addressed by fixing the site, or by tightening the queries or the requirement text when the site should not be covered or the text admits more than one reading, under {cite}`requirements.cli.flip_guidance`, not by re-running the review.
:::
Input 6: 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 7: outline tests/authoring_cli.rs fn[skill_file]
/// One file of a bundled skill, raw.
// {cite}`habeas:util`
fn skill_file(name: &str, path: &str) -> &'static str {
    skill_files(name)
        .iter()
        .find(|(file, _)| *file == path)
        .unwrap_or_else(|| panic!("{name} has no {path}"))
        .1
}
Input 8: outline tests/authoring_cli.rs fn[assert_text_in_order]
/// Asserts that the text contains each phrase, each after the previous one.
// {cite}`habeas:util`
fn assert_text_in_order(label: &str, text: &str, phrases: &[&str]) {
    let mut from = 0;
    for phrase in phrases {
        let at = text[from..]
            .find(phrase)
            .unwrap_or_else(|| panic!("{label} lacks {phrase:?} after byte {from}"));
        from += at + phrase.len();
    }
}