requirements.authoring.example_task
Requirements index · View definition
Requirement
For a named example, the task of
MUST be this text:
The subject is a named example. First check that it describes a concrete case with expected behavior; a missing concrete case or expected behavior is a gap. Read its supplied tests and request helpers or fixtures needed to understand their setup and assertions. Check that they cover its scenario and assert each expected outcome it states, with expected results derived from the example and its referenced requirements. Say which inputs and assertions check each outcome. For a proposed gap, describe requirement-violating behavior those tests would accept, or an assertion whose expected result contradicts the example. Check whether another reviewed test or helper resolves the gap, and report unresolved questions separately. Request implementation source only for a specific question, stating it in your rationale. If information needed to decide adequacy remains unavailable, choose false and explain what is missing without inventing a behavioral gap. A true judgment needs at least one {test} reference to the example in the mandatory inputs; choose true when the tests adequately check it.
Rationale
The subject requirements.authoring.example_task has one obligation. For a named example, the task in the initial prompt must be the text block quoted in the requirement.
src/authoring/mod.rs#mod[tests]/fn[initial_prompt_carries_the_review_criteria] carries a {test} reference to the subject. It checks that obligation as follows:
- It adds a named example,
requirements.case, to the test project’s book. The example citesrequirements.ready. - It builds the initial prompt for that example with
initial_prompt(&sources).unwrap().joined(). - It asserts that the prompt contains
Subject: example requirements.case. - It asserts that the prompt contains
approved_text("example_task", 0). The helperapproved_textreads the first```textblock of theexample_taskrequirement straight frommd/requirements/authoring.mdthroughinclude_str!. The expected text is therefore the requirement’s own text, not a copy that could drift. - It asserts that the prompt contains the example task’s opening sentences: “First check that it describes a concrete case / with expected behavior; a missing concrete case or expected behavior is a gap.”
- It asserts that the prompt contains neither the requirement task text nor the testing bar text, and that it lacks “Testing criteria:”. This shows the example task replaces the requirement task instead of being added to it.
- It asserts that no unfilled
{{placeholder remains, so the{{subject_task}}substitution happened.
The same test also covers the contrast case. For a requirement subject, it asserts that the example task text is absent. A wrong swap in either direction would therefore fail.
The test only checks that the example task text is present, not where it sits in the template. The requirement does not state a position beyond the {{subject_task}} substitution, so this is not a gap. I found no gaps and no unresolved questions. No {fixme} acknowledgments apply.
Inputs
Tests
Input 3: outline src/authoring/mod.rs mod[tests]/fn[initial_prompt_carries_the_review_criteria]
- File:
src/authoring/mod.rs - Selector:
mod[tests]/fn[initial_prompt_carries_the_review_criteria] - Kind:
fn src/authoring/mod.rs:2138–2210
// {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
requirements.authoring.initial_prompt:md/requirements/authoring.md:1349–1439
:::{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.example_task
requirements.authoring.example_task:md/requirements/authoring.md:1548–1569
:::{req} example_task
For a named example, the task of {cite}`requirements.authoring.initial_prompt`
MUST be this text:
```text
The subject is a named example. First check that it describes a concrete case
with expected behavior; a missing concrete case or expected behavior is a gap.
Read its supplied tests and request helpers or
fixtures needed to understand their setup and assertions. Check that they cover
its scenario and assert each expected outcome it states, with expected results
derived from the example and its referenced requirements. Say which inputs and
assertions check each outcome. For a proposed gap, describe requirement-violating
behavior those tests would accept, or an assertion whose expected result
contradicts the example. Check whether another reviewed test or helper resolves
the gap, and report unresolved questions separately. Request implementation
source only for a specific question, stating it in your rationale.
If information needed to decide adequacy remains unavailable, choose false and
explain what is missing without inventing a behavioral gap.
A true judgment needs at least one {test} reference to the example in the
mandatory inputs; choose true when the tests adequately check it.
```
:::
Input 4: outline src/authoring/mod.rs fn[approved_text]
- File:
src/authoring/mod.rs - Selector:
fn[approved_text] - Kind:
fn src/authoring/mod.rs:729–744
/// 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")
}