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.ci.fixme_closed_issue

Requirements index · View definition

evidence Valid

Example

A current evidence record has {"FIXME": ["example/queue#125"]}, acknowledged by a {fixme} naming example/queue#125. The issue is then closed, though the zero-capacity gap remains. habeas status reports the record as stale and lists the closed issue, exactly as if an input had changed, and habeas author --all reassesses it. The reviewer sees the issue’s state as closed, so the {fixme} no longer acknowledges the gap, and the judgment is false. Repository validation, which does not contact GitHub, still accepts the old record until it is reassessed. cite requirements.ci.outcomes cite requirements.authoring.github_reads cite requirements.cli.fixme_issues

Rationale

The example describes a concrete case with stated outcomes. A current {"FIXME": ["example/queue#125"]} record is acknowledged by a {fixme} naming example/queue#125. The issue then closes. The outcomes are: habeas status reports the record stale and lists the closed issue; habeas author --all reassesses it; the reviewer sees the issue as closed and judges false; repository validation, which does not contact GitHub, still accepts the old record.

The only {test} reference is tests/authoring_batch.rs#fn[closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed]. It checks each outcome:

  • Setup: The test inserts a {fixme} requirements.beta with :github: example/queue#125 into src/lib.rs. It runs author --all while the fake GitHub reports the issue open. It then rewrites the requirements.beta evidence to {"FIXME":["example/queue#125"]}. status must not contain “stale” at that point.
  • Issue closes: The fake GitHub state is set to closed. The test first checks that the cached open state is reused. It then deletes the cache file and checks that exactly one new GitHub read occurs.
  • Stale and issue listed: The status output must contain evidence/requirements.beta.json: stale: issue example/queue#125 ... is closed. It must also contain the {fixme} names example/queue#125, which is closed error and the failing-item line for fn beta. The requirements.beta row must show “Invalid”.
  • Repository validation: habeas::validate_repository must return no errors, and the GitHub request count must not change. This shows the old record is still accepted and GitHub is not contacted.
  • Reassessment and reviewer view: A second author --all must send exactly one new subject, requirement requirements.beta. In fn[serve], the fake reviewer’s Behavior::ClosedIssueIsFalse returns false only when the prompt contains "state": "closed". So the false determination asserted in the rewritten evidence also shows the reviewer was shown the closed state.
  • Cited requirements: The assertions on the GitHub cache, the Authorization header, and the absence of github_issues from the evidence and usage records cover requirements.authoring.github_reads. The status error lines cover requirements.cli.fixme_issues.

I found no outcome the example states that these assertions would let a wrong implementation pass. No gaps were found and no FIXME acknowledgments are needed.

Inputs

Tests

Input 5: outline tests/authoring_batch.rs fn[closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed]
// {test}`requirements.ci.fixme_closed_issue`
// {test}`requirements.cli.fixme_issues`
// {test}`requirements.authoring.github_reads`
// {test}`requirements.authoring.batch`
// {test}`requirements.ci.outcomes`
// {test}`requirements.configuration.state_location`
#[test]
fn closing_an_acknowledged_issue_makes_the_fixme_record_stale_and_reassessed() {
    let server = Server::start_with(false, Behavior::ClosedIssueIsFalse);
    let github = FakeGithub::start();
    let fixture = Fixture::new(&server.endpoint, None);
    let source = fixture.project.join("src/lib.rs");
    fs::write(
        &source,
        fs::read_to_string(&source).unwrap().replace(
            "pub fn beta()",
            "// :::{fixme} requirements.beta\n// :github: example/queue#125\n// Zero capacity is untested.\n// :::\npub fn beta()",
        ),
    )
    .unwrap();
    let run = |args: &[&str]| {
        let output = fixture
            .command()
            .env("HABEAS_GITHUB_API_URL", &github.endpoint)
            .env("GITHUB_TOKEN", "TEST_GITHUB_TOKEN")
            .args(args)
            .output()
            .unwrap();
        assert!(
            output.status.success(),
            "{}",
            String::from_utf8_lossy(&output.stderr)
        );
        String::from_utf8(output.stdout).unwrap()
    };
    run(&["author", "--all"]);
    assert!(github.headers.lock().unwrap().iter().any(|headers| {
        headers
            .to_ascii_lowercase()
            .contains("authorization: bearer test_github_token\r\n")
    }));
    assert_eq!(server.subjects().len(), 6);
    // The issue was open, so record the acknowledged gap as current FIXME
    // evidence.
    let mut beta = fixture.evidence("requirements.beta");
    beta["determination"] = json!({"FIXME": ["example/queue#125"]});
    fs::write(
        fixture.project.join("evidence/requirements.beta.json"),
        serde_json::to_vec_pretty(&beta).unwrap(),
    )
    .unwrap();
    let cache = fixture.state.join(if cfg!(windows) {
        "habeas/state/github/example+queue+125.json"
    } else {
        "habeas/github/example+queue+125.json"
    });
    assert!(
        cache.exists(),
        "GitHub reads are cached under the state root"
    );
    let status = run(&["status"]);
    assert!(!status.contains("stale"), "{status}");
    let reads = github.requests();

    *github.state.lock().unwrap() = "closed";
    // The cached open state is reused for an hour.
    assert!(!run(&["status"]).contains("stale"));
    assert_eq!(github.requests(), reads);
    fs::remove_file(&cache).unwrap();
    let status = run(&["status"]);
    assert_eq!(github.requests(), reads + 1);
    let row = status
        .lines()
        .find(|line| line.starts_with("| `requirements.beta`"))
        .unwrap_or_else(|| panic!("{status}"));
    assert!(row.contains("Invalid"), "{status}");
    for expected in [
        "evidence/requirements.beta.json: stale: issue example/queue#125, named by the acknowledging {fixme} to requirements.beta at src/lib.rs:5, is closed",
        "src/lib.rs:5: {fixme} names example/queue#125, which is closed",
        "src/lib.rs:9: fn beta fails: its {fixme} at line 5 names example/queue#125, which is closed",
    ] {
        assert!(status.contains(expected), "{expected}\n{status}");
    }
    // Repository validation, which does not contact GitHub, still accepts it.
    let report = habeas::validate_repository(&fixture.project).unwrap();
    assert!(report.errors.is_empty(), "{:?}", report.errors);
    assert_eq!(github.requests(), reads + 1);

    run(&["author", "--all"]);
    let subjects = server.subjects();
    assert_eq!(subjects.len(), 7, "{subjects:?}");
    assert_eq!(subjects[6], "requirement requirements.beta");
    let beta = fixture.evidence("requirements.beta");
    assert_eq!(beta["determination"], json!(false), "{beta}");
    // Issue states are supplied with inputs but never recorded.
    assert!(!beta.to_string().contains("github_issues"), "{beta}");
    for run in fixture.usage() {
        assert!(!run.to_string().contains("github_issues"), "{run}");
    }
}

Referenced definitions

Input 2: requirements selection requirements.ci.outcomes
:::{req} outcomes
Every assessment judgment MUST use one of these outcomes, applying
{cite}`requirements.ci.review_criteria`:

- `true`: the reviewed tests adequately check a requirement or example under
  {cite}`requirements.ci.review_criteria`, including applicable testing
  exemptions and obligations assessed by a refining requirement or a site's
  own review. For a citation or site review, the review finds no gap under its
  own task.
- `false`: the sources do not support the subject, or information is missing,
  and the gaps are not all acknowledged by `{fixme}` references to it.
- `FIXME`: some aspects remain unmet or untested, and `{fixme}` references to
  the subject acknowledge every one of those gaps. The reviewer MUST explain the
  gaps and their source locations in the rationale and record their issue
  references or other identifying content from the supplied acknowledgments or
  inputs.

The JSON `determination` MUST be `true`, `false`, or an object containing exactly
`"FIXME"` with a nonempty array of nonempty strings, such as
`{"FIXME": ["example/queue#125", "rust-lang/rust#123"]}`. A gap MUST count as
acknowledged only by a `{fixme}` reference under
{cite}`requirements.references.roles` whose body describes that gap and that
references the assessed definition, or, for a site review, the distributed requirement from within that site; a citation review MUST NOT accept a `{fixme}`; a plain
`FIXME` comment, another marker such as `TODO`, or prose MUST NOT. The strings
MUST list each distinct issue reference the acknowledging `{fixme}` references
name in their option lines, as written after `:github:`, and, for a `{fixme}`
naming no issue, its body's words, without comment delimiters, joined by single
spaces. A `{fixme}` reference describing a gap that the review establishes no
longer exists within its task's scope MUST itself be treated as a gap. A reference
describing only an implementation defect MUST NOT create a test-adequacy gap or
require implementation review; it MUST acknowledge a testing gap only when its
body describes that same gap. A `{fixme}` naming a GitHub issue that
{cite}`requirements.authoring.github_reads` reports closed MUST NOT count as
acknowledging its gap. A FIXME judgment MUST be grounded in recorded evidence
inputs or, for an acknowledgment supplied under
{cite}`requirements.authoring.fixme_inputs`, the reference-set digest covering
that acknowledgment.
:::
Input 3: requirements selection requirements.authoring.github_reads
:::{req} github_reads
The harness MUST expose a `github` tool with this interface:

```text
github({ issue: String }) -> Issue

Issue { reference: String, state: "open" | "closed", title: String, body: String }
```

`issue` MUST have the form `<owner>/<repo>#<number>`. The tool MUST read the issue
or pull request through the GitHub API, authenticating with the `GITHUB_TOKEN`
environment variable when that is set, and MUST return its body redacted under
{cite}`requirements.authoring.redaction`. GitHub reads cannot be reproduced
later, so their results MUST NOT be recorded as evidence inputs and MUST NOT
make evidence stale. Every GitHub read by Habeas, including this tool's, the
lookups below, and those of {cite}`requirements.cli.fixme_issues`, MUST go
through one cache under the state root of
{cite}`requirements.configuration.state_location`, keyed by issue, and MUST
reuse a cached result less than one hour old instead of contacting GitHub. A malformed reference, a missing issue, or a failed request
MUST return an explanatory tool error.

When the mandatory inputs contain a `{fixme}` reference under
{cite}`requirements.references.roles`, or the initial request includes one under
{cite}`requirements.authoring.fixme_inputs`, the harness MUST look up the state of
each issue its `:github:` lines name in the same way and MUST supply each state
with the corresponding source input or acknowledgment as `open` or `closed`;
when GitHub cannot be reached, the issue MUST be assumed open. These states MUST
NOT be recorded either. Instead, `habeas status` and `habeas author` MUST treat a recorded FIXME determination as stale, exactly as if one of its inputs had changed, when an issue that one of its acknowledging `{fixme}` references names, or for a site review the `{fixme}` references inside the site, is closed or does not exist; repository validation, which never contacts GitHub, MUST NOT.

The harness MAY take the GitHub API base URL from `HABEAS_GITHUB_API_URL`,
accepting only `http://127.0.0.1:<port>`, so that tests can use a local server.
:::
Input 4: requirements selection requirements.cli.fixme_issues
:::{req} fixme_issues
`habeas status` MUST look up, under {cite}`requirements.authoring.github_reads`,
every issue that a `:github:` option line of a named or unnamed `{fixme}` under
{cite}`requirements.references.roles` names, and MUST report each `{fixme}`
naming an issue that is closed or does not exist as an error, with its file and
line and the issue. It MUST also report the item that contains that `{fixme}` as
failing: the outline node containing it, or the requirement or example
declaration whose body contains it, in the same way it reports an uncovered
Rust item. When GitHub cannot be reached, the issue MUST be assumed open.
Repository validation MUST NOT contact GitHub.
:::

Other sources

Input 1: requirements selection requirements.ci.fixme_closed_issue
:::{example} fixme_closed_issue
A current evidence record has `{"FIXME": ["example/queue#125"]}`, acknowledged by
a `{fixme}` naming `example/queue#125`. The issue is then closed, though the
zero-capacity gap remains. `habeas status` reports the record as stale and lists
the closed issue, exactly as if an input had changed, and `habeas author --all`
reassesses it. The reviewer sees the issue's state as closed, so the `{fixme}` no
longer acknowledges the gap, and the judgment is `false`. Repository validation,
which does not contact GitHub, still accepts the old record until it is
reassessed.
{cite}`requirements.ci.outcomes`
{cite}`requirements.authoring.github_reads`
{cite}`requirements.cli.fixme_issues`
:::