Skip to content

Add a required-environment check to ci review - #141

Open
Stig-Johnny wants to merge 6 commits into
prooflinedev:mainfrom
Stig-Johnny:feature/require-environment
Open

Stig-Johnny wants to merge 6 commits into
prooflinedev:mainfrom
Stig-Johnny:feature/require-environment

Conversation

@Stig-Johnny

@Stig-Johnny Stig-Johnny commented Dec 2, 2026 •

Copy link
Copy Markdown

Add a required-environment check to ci review

A pull-request review can finish with staging checked and production skipped. proofline ci review --require-environment production lets a CI job require the final review to report that exact environment key as CHECKED.

proofline ci review --require-environment production --fail-on serious

This brings the required-environment use case from sdk-python#74 to the CLI. It reads the existing response and adds no API request.

The option matches the external key, never the display name. The command exits 2 with an explanation if evidence is missing, malformed, duplicated or unchecked. A CHECKED entry cannot satisfy the requirement if its other fields say the environment was not checked. Without the option, behaviour is unchanged.

Who uses the check?

The webshop has a test shop called staging and a live shop called production. A release engineer configures CI once to require evidence that the review checked production. Developers see the result on each checkout pull request.

---
config:
  htmlLabels: false
---
flowchart LR
    accTitle: Who uses the production review requirement?
    accDescr: The release engineer configures the requirement, CI checks the review for production coverage, and the checkout developer reads the result on the pull request.
    engineer["Release engineer"]
    ci["Webshop CI"]
    developer["Developer"]
    subgraph workflow["Checkout pull request"]
        policy(["Require production"])
        verify(["Check coverage"])
        result(["Read CI result"])
    end
    engineer --- policy
    ci --- verify
    developer --- result
    classDef actor fill:#19384d,color:#ffffff,stroke:#7796ab
    classDef goal fill:#e7f2fa,color:#183247,stroke:#88aabf
    class engineer,ci,developer actor
    class policy,verify,result goal
Loading

What happens on a checkout pull request?

CI reads the completed review for this commit. With --fail-on serious, the CLI uses the server’s count of open serious findings.

sequenceDiagram
    accTitle: A checkout pull request with production required
    accDescr: CI reads the completed Proofline review. If the review skipped production, the job exits 2. If production was checked, the open serious findings determine the result.
    actor Dev as Checkout developer
    participant CI as Webshop CI
    participant CLI as Proofline CLI
    participant API as Proofline API
    Dev->>CI: Open a checkout PR
    CI->>CLI: Run the configured review step
    CLI->>API: Read the PR review for this commit
    API-->>CLI: Final review and recorded results
    alt Only the test shop was checked
        CLI-->>CI: Stop (exit 2), production check missing
    else Live shop checked, no open serious findings
        CLI-->>CI: Pass (exit 0)
    else Live shop checked, open serious findings
        CLI-->>CI: Stop (exit 3)
    else Live shop checked, finding counts unavailable
        CLI-->>CI: Stop (exit 4)
    end
    CI-->>Dev: Show the check result on the PR
Loading

The environment requirement is evaluated after review completeness and before --fail-on. Raw JSON and the completeness outcome stay unchanged, so JSON consumers must read the process exit code. This requires the server to report the target as checked; it does not independently correlate a target with an assessment ID or verify a deployment.

Verification

The staging-only regression test initially failed because the command accepted the flag but returned exit 0 instead of 2. It passes with enforcement in place. Tests also cover code-only reviews, duplicate keys, unknown states, malformed evidence, contradictory metadata, final-poll changes, identity and threshold precedence, text/JSON output and terminal sanitisation.

All 19 new tests pass. The final full suite on macOS had 184 passed, two failures and one ignored test. Both failures also occur on the unchanged base commit b022c3e and concern macOS path assertions in agent_install; the ignored test requires optional pre-commit. Formatting and Clippy pass with Rust 1.96.1. The repository pins Rust 1.100.0, which was not used locally; pinned-toolchain and other-platform checks remain for CI.

@Stig-Johnny
Stig-Johnny force-pushed the feature/require-environment branch from b86af05 to 722810f Compare December 2, 2026 10:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant