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.authoring.requirement_task

Requirements index · View definition

evidence Valid

Requirement

The requirement task of cite requirements.authoring.initial_prompt MUST be this text, the steps a requirement’s review follows to assess test adequacy:

1. Derive testable obligations and expected outcomes from each MUST, MUST NOT,
   and SHOULD clause. Separate independent conditions and properties while
   preserving alternatives the text permits. Identify ambiguities separately.
2. Identify relevant input classes, boundaries, condition combinations, and
   state transitions from the requirement. Use only distinctions that affect
   an obligation; do not invent required behavior for unspecified inputs.
3. Read the supplied tests and request helpers or fixtures needed to understand
   their inputs and assertions. Use targeted discovery to look for relevant
   tests before reporting a missing scenario.
4. Map each obligation assessed here to concrete test scenarios and assertions
   in your rationale. Identify obligations delegated to a refining requirement
   or a distributed site's review, and any established testing exemptions,
   separately. Check both whether the expected result is correct under the
   requirement and whether the assertions enforce it. Execution without a
   relevant assertion does not establish adequacy; assertions in helpers,
   snapshots, and parameterized or property tests can do so.
5. For each proposed adequacy gap, describe plausible requirement-violating
   behavior that the reviewed tests would accept. Cite the requirement clause
   and explain why the tested inputs or assertions would miss it. A wrong
   expected result is a gap too: explain how the assertion contradicts the
   requirement rather than claiming it proves a missing scenario.
   Explain the requirement-relevant distinction the counterexample exposes.
   Another untested value in an already represented input class is not a gap
   without explaining why it could expose different required behavior.
6. Check whether another reviewed test or helper already rules out that
   behavior. Report unresolved questions separately from established gaps.
   If information needed to decide adequacy remains unavailable, choose false
   and explain what is missing without inventing a behavioral gap.
   A relevant test without a {test} reference to the subject is a marking gap;
   a helper reached from a marked test needs no reference of its own. Do not
   confuse marking gaps with inadequate assertions.
7. Request implementation source only to resolve a specific question, stating
   that question in your rationale. Derive expected behavior from the
   requirement, not the implementation. Do not assess implementation
   correctness, implementation reachability, or unspecified implementation
   behavior as additional tasks.

Rationale

Obligation. requirements.authoring.requirement_task has one obligation. The requirement task given in the initial prompt must be exactly the quoted seven-step text. The ‘Prompt template’ section of the book cites the requirement, and requirements.authoring.initial_prompt places it in {{subject_task}}. For a requirement, the testing bar follows it.

Test. src/authoring/mod.rs#mod[tests]/fn[initial_prompt_carries_the_review_criteria] carries the {test} reference. It builds the real initial prompt for the requirement subject requirements.ready. It then makes these assertions:

  • The prompt contains approved_text("requirement_task", 0). approved_text reads the first ```text block of the requirement_task requirement from md/requirements/authoring.md, which is the requirement’s own text. The assertion therefore checks the full seven-step text, verbatim, against the book.
  • The prompt contains the first step line (“Derive testable obligations … MUST NOT,”).
  • The prompt contains the concatenation of the requirement task, a newline, and the testing bar. This confirms the testing criteria follow the task in the {{subject_task}} slot.
  • No unreplaced {{ placeholder remains.

Subject-kind distinction. The same test adds an example subject to the book and prepares it. For that example subject, the prompt:

  • contains the example task;
  • does not contain requirement_task;
  • does not contain testing_bar or “Testing criteria:”.

An implementation that put the requirement task into an example’s prompt would fail this check. An implementation that left it out of a requirement’s prompt would fail the first check.

Gaps. The helper reads the approved text from the book, so a drifting or truncated copy of the text would fail the contains assertion. I found no plausible violation that the assertions would accept. No {fixme} acknowledgments apply. Marking is present for this requirement.

Inputs

Tests

Input 3: outline src/authoring/mod.rs mod[tests]/fn[initial_prompt_carries_the_review_criteria]
    // {test}`requirements.ci.review_criteria`
    // {test}`requirements.authoring.requirement_task`
    // {test}`requirements.authoring.testing_bar`
    // {test}`requirements.authoring.example_task`
    // {test}`requirements.authoring.judgment_rules`
    // {test}`requirements.authoring.habeas_background`
    // {test}`requirements.examples.evidence`
    // {test}`requirements.examples.definition`
    #[test]
    fn initial_prompt_carries_the_review_criteria() {
        let project = inputs::tests::project();
        let sources = AssessmentSources::prepare(project.path(), "requirements.ready").unwrap();
        let prompt = initial_prompt(&sources).unwrap().joined();
        for criterion in [
            "Subject: requirement requirements.ready\nJudge against: the subject's text.",
            approved_text("habeas_background", 0),
            approved_text("habeas_background", 1),
            approved_text("judgment_rules", 0),
            approved_text("requirement_task", 0),
            approved_text("testing_bar", 0),
            "Derive testable obligations and expected outcomes from each MUST, MUST NOT,",
            "Testing criteria:",
            "The project MUST be ready.",
        ] {
            assert!(
                prompt.contains(criterion),
                "missing {criterion:?} in:\n{prompt}"
            );
        }
        // The testing criteria follow the requirement task.
        assert!(prompt.contains(&format!(
            "{}\n{}",
            approved_text("requirement_task", 0),
            approved_text("testing_bar", 0)
        )));
        assert!(!prompt.contains(approved_text("example_task", 0)));
        assert!(!prompt.contains("This subject is a distributed requirement."));
        assert!(!prompt.contains(distributed_background()));
        assert!(!prompt.contains("{{"), "{prompt}");

        // An example's task replaces the requirement task.
        let requirements = project.path().join("md/requirements.md");
        let mut book = fs::read_to_string(&requirements).unwrap();
        let cite = "{cite}`requirements.ready`";
        book.push_str(&format!(
            "\n:::{{example}} case\nA ready case. {cite}\n:::\n"
        ));
        fs::write(&requirements, book).unwrap();
        let sources = AssessmentSources::prepare(project.path(), "requirements.case").unwrap();
        let prompt = initial_prompt(&sources).unwrap().joined();
        assert!(
            prompt.contains("Subject: example requirements.case"),
            "{prompt}"
        );
        assert!(
            prompt.contains(approved_text("example_task", 0)),
            "{prompt}"
        );
        assert!(
            prompt.contains("First check that it describes a concrete case\nwith expected behavior; a missing concrete case or expected behavior is a gap."),
            "{prompt}"
        );
        assert!(
            !prompt.contains(approved_text("requirement_task", 0)),
            "{prompt}"
        );
        assert!(
            !prompt.contains(approved_text("testing_bar", 0)),
            "{prompt}"
        );
        assert!(!prompt.contains("Testing criteria:"), "{prompt}");
        assert!(!prompt.contains("{{"), "{prompt}");
    }

Referenced definitions

Input 2: requirements selection requirements.authoring.initial_prompt
:::{req} initial_prompt
The initial request MUST provide the ten tool definitions above and the
following prompt, the first block as its system prompt and the second as its
subject message under {cite}`requirements.authoring.prompt_parts`. The harness MUST replace `{{subject_kind}}` with `requirement`
or `example`, `{{subject_name}}` with the full subject name,
`{{habeas_background}}`, `{{reference_roles}}`, and `{{distributed_background}}`
under {cite}`requirements.authoring.habeas_background`, `{{judgment_rules}}` under
{cite}`requirements.authoring.judgment_rules`, `{{acknowledgments}}` with the JSON
array of {cite}`requirements.authoring.fixme_inputs`, and `{{mandatory_inputs}}` with the
complete mandatory inputs as a JSON array using
the existing evidence-input formats. It MUST replace `{{subject_task}}`, for a requirement, with the text of
{cite}`requirements.authoring.requirement_task` followed by that of
{cite}`requirements.authoring.testing_bar`, and for an example, with the text of
{cite}`requirements.authoring.example_task`. It MUST replace
`{{distributed_task}}` with the filled text of
{cite}`requirements.authoring.distributed_task` for a distributed requirement,
and with nothing otherwise. The template MUST otherwise
be used as written. Their review guidance MUST follow
{impl}`requirements.ci.review_criteria`, {cite}`requirements.examples.evidence`,
and {cite}`requirements.ci.outcomes`.

```text
# Task

Assess whether a project's tests adequately check one {{subject_kind}}.
Your determination should be the one any careful reviewer would reach from the
same text and sources.

# Background: Habeas terms

{{habeas_background}}

{{reference_roles}}

# Your task

The mandatory inputs at the end contain the subject, the requirements and
examples it cites, the vocabulary definitions it uses, and the source text of
its {test} items and :test: anchors. Requirement and example declarations that
refine the subject through {impl} are also included. Implementation source is
not included merely because it carries an {impl} reference or :impl: anchor.
You can locate it with references and request it with habeas when needed.
Each {fixme} acknowledgment includes the state of the issues it names.

Cited requirements and examples are context: when the subject requires behavior
under or following a cited requirement, check that the subject's tests cover
applying it in the subject's case. Do not reassess the cited requirement's
implementation or tests.

When another requirement's text carries an {impl} reference to the subject,
assess only whether that text carries out the obligations it covers; do not
reassess its implementation or tests, and those obligations need no test here.

Judge test adequacy, rather than whether the current implementation is correct.
Derive expected behavior from the requirement and examples, even if you request
implementation source. A true judgment means the reviewed tests adequately
check the subject under the criteria below. You do not need to find a defect
when those criteria are met.

{{subject_task}}

# How to judge

{{judgment_rules}}

# Submitting

Choose true when your task finds no gap, {"FIXME": ["..."]} when every gap is
acknowledged, and false otherwise. You MUST end by calling submit_judgment
with determination and rationale until one submission is accepted.
A rejected submission does not complete the assessment. A judgment written in your
reply text is not accepted.
```

```text
# Subject

Subject: {{subject_kind}} {{subject_name}}
Judge against: the subject's text.

{{distributed_task}}

# Acknowledgments

{{acknowledgments}}

# Mandatory inputs

{{mandatory_inputs}}
```
:::

Other sources

Input 1: requirements selection requirements.authoring.requirement_task
:::{req} requirement_task
The requirement task of {cite}`requirements.authoring.initial_prompt` MUST be
this text, the steps a requirement's review follows to assess test adequacy:

```text
1. Derive testable obligations and expected outcomes from each MUST, MUST NOT,
   and SHOULD clause. Separate independent conditions and properties while
   preserving alternatives the text permits. Identify ambiguities separately.
2. Identify relevant input classes, boundaries, condition combinations, and
   state transitions from the requirement. Use only distinctions that affect
   an obligation; do not invent required behavior for unspecified inputs.
3. Read the supplied tests and request helpers or fixtures needed to understand
   their inputs and assertions. Use targeted discovery to look for relevant
   tests before reporting a missing scenario.
4. Map each obligation assessed here to concrete test scenarios and assertions
   in your rationale. Identify obligations delegated to a refining requirement
   or a distributed site's review, and any established testing exemptions,
   separately. Check both whether the expected result is correct under the
   requirement and whether the assertions enforce it. Execution without a
   relevant assertion does not establish adequacy; assertions in helpers,
   snapshots, and parameterized or property tests can do so.
5. For each proposed adequacy gap, describe plausible requirement-violating
   behavior that the reviewed tests would accept. Cite the requirement clause
   and explain why the tested inputs or assertions would miss it. A wrong
   expected result is a gap too: explain how the assertion contradicts the
   requirement rather than claiming it proves a missing scenario.
   Explain the requirement-relevant distinction the counterexample exposes.
   Another untested value in an already represented input class is not a gap
   without explaining why it could expose different required behavior.
6. Check whether another reviewed test or helper already rules out that
   behavior. Report unresolved questions separately from established gaps.
   If information needed to decide adequacy remains unavailable, choose false
   and explain what is missing without inventing a behavioral gap.
   A relevant test without a {test} reference to the subject is a marking gap;
   a helper reached from a marked test needs no reference of its own. Do not
   confuse marking gaps with inadequate assertions.
7. Request implementation source only to resolve a specific question, stating
   that question in your rationale. Derive expected behavior from the
   requirement, not the implementation. Do not assess implementation
   correctness, implementation reachability, or unspecified implementation
   behavior as additional tasks.
```
:::
Input 4: outline src/authoring/mod.rs fn[approved_text]
/// The `index`th text block of approved requirement `name` in the authoring
/// chapter, which is the sole source of these instructions.
// {impl}`requirements.authoring.initial_prompt`
// {impl}`requirements.authoring.habeas_background`
// {impl}`requirements.authoring.judgment_rules`
fn approved_text(name: &str, index: usize) -> &'static str {
    let chapter = include_str!("../../md/requirements/authoring.md");
    let opening = format!(":::{{req}} {name}\n");
    let start = chapter.find(&opening).expect("approved requirement") + opening.len();
    let body = &chapter[start..];
    let body = &body[..body.find("\n:::\n").expect("requirement closing fence")];
    body.split("```text\n")
        .nth(index + 1)
        .and_then(|block| block.split("\n```").next())
        .expect("approved text block")
}