Skip to content

Read deployment reviews and hold a deploy job to them - #64

Closed
Olagold-hackxx wants to merge 1 commit into
prooflinedev:mainfrom
Olagold-hackxx:deployment-reviews
Closed

Olagold-hackxx wants to merge 1 commit into
prooflinedev:mainfrom
Olagold-hackxx:deployment-reviews

Conversation

@Olagold-hackxx

Copy link
Copy Markdown

Who this helps

Engineers who deploy with Proofline connected. Today the CLI can read and gate on a pull-request review, but not on a deployment review:

  • get_deployment_review is in the pinned contract (GET …/reviews/deployments/{public_key}), and no command calls it. Someone who has a rev_… address from the console cannot read that review in a terminal.
  • ci review waits only for PULL_REQUEST reviews. The existing test even records that "a deployment review of the same commit is not the pull request's". So a deploy job has no way to wait for the review of the commit it is deploying and stop on its result.

What it adds

# Read one deployment review by its public key
proofline findings --deployment rev_0190f3a00000700080000000000000d1 --wait

# Hold a deploy job to the deployment review of its commit
proofline ci deployment --commit "$DEPLOYED_SHA" --fail-on serious
  • findings --deployment KEY reads through the deployment operation. It supports --json, --wait and --timeout exactly as --review does, and prints with the existing renderer.
  • ci deployment waits for the DEPLOYMENT review whose head is the commit, then reports it. Exit codes are those of ci review: 0 complete, 2 not complete, 3 an open finding at or above --fail-on, 4 no answer before --timeout.

Decisions

  • The key is parsed before any request. Only the canonical spelling is accepted: rev_ plus 32 lowercase hex digits. The key becomes a path segment, so a malformed value never reaches the network.
  • The reply is held to the key. The command refuses a reply whose id is not the review the key names, or whose kind is not DEPLOYMENT. This mirrors what sarif::validate_subject does for SARIF: never report another review as the one the caller named.
  • ci deployment only reads. The contract has no operation that requests a deployment review, so the job never asks for one, whatever event started it. Its OIDC exchange names no pull-request head.
  • Reuse over new code. The command shares ci_review, ci_verdict, read_review and print_review. read_review and show now take an Address (a review ID or a deployment key), and existing callers pass a Uuid unchanged.
  • Existing behaviour is unchanged. ci review prints the same text and returns the same exit codes as before.

Left out, on purpose

  • SARIF for deployment reviews. The SARIF projection is defined for a retained pull-request review, so --sarif is refused with --deployment, and ci deployment has no --sarif.
  • Finding a key from the CLI. proofline reviews already lists reviews as JSON with their public_key. A --kind filter there would be a separate change.
  • Kind check on the ci deployment detail read. The job trusts the list's kind, as ci review does.

How the feature was chosen

I built this with an AI coding agent, as the role describes. Before any code, I had the agent read the application page, all four repositories and every open pull request, so the feature would not repeat another applicant's. It came back with four candidates:

  1. Deployment reviews in the CLI (this pull request).
  2. coverage upload --repo owner/name, since the command needs a repository UUID the CLI cannot look up.
  3. Shell completions.
  4. A deployment-review wait helper in the Python SDK.

I chose the first. It was the only candidate that closed a gap between the pinned contract and the CLI: get_deployment_review existed with no command, and ci review deliberately ignores deployment reviews. The others were either generic (completions) or already done for another SDK by someone else (the wait helper).

How I verified it

  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and cargo test --locked pass: 102 tests, 0 failures.
  • New tests/deployment.rs runs the built binary against a loopback console:
    • a deployment review reads by key in text and JSON, with exactly one request to the deployment operation;
    • an incomplete review exits 2, with and without --wait;
    • a substituted review, a pull-request review behind the key and an unknown key each exit 1 and print nothing to stdout;
    • malformed keys, a second selector and --sarif are refused before any request;
    • ci deployment exit codes across complete, open-finding, --fail-on, unmeasurable-threshold and pull-request-only cases, with only GET requests;
    • a ref instead of a full SHA, and --sarif, are refused.
  • Unit tests in src/deployment.rs cover key parsing and reply validation, including terminal-control characters in a server-supplied kind.
  • The existing unit test for the CI job now also asserts that a deployment job never requests a review and names no pull-request head in its exchange.
  • tests/contract.rs asserts the deployment operation exists in openapi.public.json and returns CustomerReviewDetail.

Not verified: I have no Proofline workspace with deployment reviews, so this is tested against the contract and a stand-in console, not a live organization. I did not run cargo deny check locally; Cargo.toml and Cargo.lock are unchanged.

findings --deployment reads a deployment review by its public key through
the review API's deployment operation, and refuses a reply that is another
review or not a deployment review.

ci deployment waits for the deployment review of the commit being deployed
and reports it with the exit codes of ci review, including --fail-on. It
only reads: the review API has no operation that requests one.

mohsen1 commented Nov 17, 2026

Copy link
Copy Markdown
Member

Codex

Closing as out of scope for the CLI.

@mohsen1 mohsen1 closed this Nov 17, 2026
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.

2 participants