Repository navigation
Show what a review run cost in review text output - #119
Open
HarshitSharma14 wants to merge 2 commits into
Open
HarshitSharma14 wants to merge 2 commits into
HarshitSharma14 wants to merge 2 commits into
Conversation
The review API returns each run's charge (cost_microcredits), the share for review work (review_cost_microcredits) and what paid for it (cost_funding) to organization members, but the text output dropped all three. Only --json carried them, so a person on the free review month or a capped plan could not see what a review spent without reading raw JSON, and had nothing to size `scan --budget` against. Review text now prints one line below the review link, for example: Cost: 2.75 credits (review 2.5, walkthrough 0.25); paid by: free review month 2.75 - Amounts are exact decimal credits from integer microcredits, never rounded or converted through floats. - A pending or running review reports its cost "so far". - The walkthrough share appears only when it is positive; parts that paid nothing are left out. - A caller the server hides the cost from, or an older server, gets no line. A cost value the CLI cannot read is treated as absent, so it never fails the review read; --json keeps the API's value unchanged.
The split guard dropped a review share at or above the total, but not one below zero. A negative review_cost_microcredits then printed a negative review cost and a walkthrough cost larger than the total. Show the split only when the review share lies within the total; the total itself still prints.
Member
|
I like this, but no need to make it so bold and colorful, also too much for just cost. make it just say the review cost after status, |
This branch has not been deployed
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
Anyone who reads reviews in a terminal or a CI log and pays for them in credits: a team on the free review month watching how fast it is spending, an organization on capped credits, and anyone choosing a
proofline scan --budget, which is required and has no default.The review API already returns each run's charge to organization members (
cost_microcredits), the share for review work (review_cost_microcredits) and what paid for it (cost_funding). The CLI's text output dropped all three, so the only way to see what a review cost was to read raw--json.What changes
review,findings,rerun,scanandci reviewtext output now prints one line under the review link:Screenshots
The
mainand branch binaries, run against a local stand-in for the review API that serves the same pull-request review to three kinds of caller.Completed review, organization member
Review still running: the cost so far
Caller who is not an organization member: no line, same output as
mainDecisions
1250000->1.25,3->0.000003), never rounded or passed through a float.PENDINGorRUNNINGreview saysso far.Cost: 0 creditswith no payer.0.CodeAssessmentRead.--jsonis unchanged and keeps the API's raw value.ReviewCostFundingis checked against the public contract intests/contract.rs, like the other model types.Not in this PR
proofline export spend.--jsonalready carries the raw fields. SARIF and workflow annotations describe findings, not billing, so they are unchanged.Proofline review
I ran Proofline on this change in my fork (HarshitSharma14#1).
review_cost_microcreditswould print a negative review cost and a walkthrough cost larger than the total. The guard rejected a share at or above the total, but not one below zero.i64::MIN.How I verified it
src/render.rs: exact formatting (zero, sub-credit, whole, negative,i64::MIN), split, payer list,so far, singular1 credit, a free run, an inconsistent review share and a hidden cost.tests/http.rsruns the real binary against the fake API for a charged review, a hidden cost (nulls), an older server (fields absent), unreadable cost values and a partly unreadable funding object, in both text and--jsonoutput.Checksworkflow passes locally:cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo test --lockedandcargo deny check(cargo-deny 0.20.2). A release build prints a validreview --schema. The one failure on macOS,unattended_registration_preserves_settings_and_uses_the_installed_binary, also fails onmain(unattended_registration_preserves_settings_and_uses_the_installed_binary fails on macOS (/var vs /private/var) #112, fixed by test(agent): resolve recorded executable path before comparing #116).