Repository navigation
Add proofline scan for whole-repository scans - #67
Merged
Merged
Conversation
Request a scan of one ref or exact commit through the public request_scan operation, within a required credit budget. - --budget has no default, so a scan never spends an unchosen amount. - The request ID is printed before sending and the POST is never repeated; an unknown outcome exits 4 and names the --request-id that reads the first resolution instead of starting a second scan. - REPOSITORY_UNAVAILABLE, definite refusals, a missing scans:request scope and unknown outcomes each get a distinct message. - Malformed input is refused before any network call.
mohsen1
approved these changes
Nov 17, 2026
mohsen1
left a comment
Member
There was a problem hiding this comment.
Codex
Reviewed the scan operation, explicit budget, exact commit/ref selection and request identity handling. Required check and windows jobs passed on this head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Who this helps
Teams that want a scan of a whole repository at a known point (a nightly scan of
main, a pre-release scan of a tag, or a scan of the exact commit a deploy is about to ship) from cron or CI, without opening the console.The public contract already describes this (
request_scan,POST /repositories/{repo_id}/scans, scopescans:request), but no CLI command used it. This adds the command:Decisions
A scan spends credits, so the command is built around never spending money the caller did not choose and never paying twice.
--budgetis required and has no default. It must be 1 or more. The organization's on-demand limit still caps it on the server.request_id(UUID v7) unless--request-idis given, and prints it before sending. The client already never replays a POST; this command keeps that.ci reviewalready uses when Proofline gives no answer) and prints the--request-idthat reads the first resolution instead of starting a second scan. A definite refusal (400, 403, 404) created nothing, so it shows only the server's reason, with no retry hint.CREATEDandEXISTINGfollow the scan review.REPOSITORY_UNAVAILABLEexits 1, says nothing was spent, and says to omit--request-idto ask again, because repeating the same ID returns the same answer. With--jsonthat resolution still goes to stdout for scripts. An unknown outcome is not followed and asks the user to update the CLI.scans:request, and--scopereplaces the defaults, so a 403 prints the fullproofline logincommand with the default scopes plusscans:request.--refand--commitare mutually exclusive and one is required.--commitmust be a full SHA (40 or 64 hex, normalized to lowercase);--refmust not be blank.terminal_safe/one_line, like the rest of the CLI's output.build.rs(request_scandeclared beside its siblings), repository lookup fromconnected_repository, and waiting and printing fromshow, so--timeout,--jsonand exit codes 0/2 behave as inproofline review.Left out on purpose: no
--ref HEADresolution on the client (GitHub resolves the ref on the server, once, as the contract says), and no MCP or SDK changes.Outcomes at a glance
flowchart TD A["proofline scan --ref REF | --commit SHA --budget N"] --> V{"Input valid?"} V -- no --> X["Refused before any request<br/>exit 1"] V -- yes --> R["Print the request ID, then send one POST"] R --> S{"Server answer"} S -- "CREATED or EXISTING" --> W["Wait for the scan review and print it<br/>exit 0 complete, 2 incomplete or unfinished"] S -- "REPOSITORY_UNAVAILABLE" --> U["Nothing started, nothing spent<br/>exit 1; omit --request-id to ask again"] S -- "400 or 404" --> F["The server's reason, no retry hint<br/>exit 1"] S -- "403" --> L["The proofline login command to run<br/>exit 1"] S -- "5xx, dropped connection or unreadable answer" --> Q["Outcome unknown<br/>exit 4; rerun with --request-id"] S -- "unknown outcome" --> K["Not followed; update the CLI<br/>exit 1"] Q -. "same request ID returns the first resolution" .-> RDemo
Recorded against a local stand-in for the three endpoints the command uses (
mock_console.py), not against production, and the review content is made up. It shows the required budget, a scan waiting for its result, a 502 after the server accepted the request (exit 4 with the request ID), and the rerun with that ID returning the existing scan instead of starting a second one.How I verified it
cargo fmt --checkandcargo clippy --locked --all-targets -- -D warningsare clean.cargo test --locked: all targets pass, including 9 new integration tests intests/scan.rs. They run the real binary against a loopback stand-in for the console and check:--refand--commit(fields named, nothing extra, SHA lowercased);--request-idprinted;REPOSITORY_UNAVAILABLEexits 1, prints the resolution with--json, and explains how to ask again;tests/agent_install.rsfails on unmodifiedmaintoo (/varvs/private/var), unrelated to this change; it passes on Linux CI.RunNowRefusedschema inopenapi.public.json.