Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ command preserves the real index and applies the usual secret preflight.
It cannot be combined with pushed-commit, range or pull-request review.

Read all recorded runs with `proofline history --repo owner/name --pr 7`.
`proofline diff --repo owner/name --pr 7` compares the two newest recorded runs,
matching findings by their retained fingerprint. It prints New, Resolved,
Persisting, and Uncorrelated findings, plus a Not comparable section, and
`--json` emits the same comparison as data: the repository, pull request, both
run numbers and statuses, and the four lists. A run that is still `PENDING` or
`RUNNING` refuses the diff, because its empty assessments are not a result. If
either run is `INCOMPLETE`, `FAILED` or `STOPPED`, or one side lacks a CODE
assessment, the affected lane is reported as not comparable rather than as
resolved, and the command exits 2.
`proofline rerun REVIEW_ID` requests the original immutable subject and waits;
`--no-wait` returns its link. Reruns require `reviews:rerun`.
`proofline guidance --repo owner/name` requires `guidance:read`.
Expand Down
35 changes: 35 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,41 @@ impl Api {
.await
}

/// One page of a pull request's runs, newest first.
pub(crate) async fn pull_request_history(
&self,
repository: &str,
number: u64,
cursor: Option<&str>,
) -> Result<ReviewPage, ApiError> {
let mut url = self.url(&["reviews", "pr", repository, &number.to_string()]);
if let Some(cursor) = cursor {
url.query_pairs_mut().append_pair("cursor", cursor);
}
let raw = self.get(url).await?;
serde_json::from_value(raw).map_err(|error| self.http.protocol(error.to_string()))
}

/// One recorded run of a pull request, by its run number.
pub(crate) async fn pull_request_run(
&self,
repository: &str,
number: u64,
run: u64,
) -> Result<ReviewDetail, ApiError> {
let raw = self
.get(self.url(&[
"reviews",
"pr",
repository,
&number.to_string(),
"runs",
&run.to_string(),
]))
.await?;
serde_json::from_value(raw).map_err(|error| self.http.protocol(error.to_string()))
}

pub(crate) async fn guidance(&self, repository: Uuid) -> Result<serde_json::Value, ApiError> {
self.get(self.url(&["repositories", &repository.to_string(), "review-guidance"]))
.await
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ enum Command {
Rerun(tools::RerunArgs),
/// List the recorded runs of a pull request.
History(tools::HistoryArgs),
/// Compare the findings of a pull request's two newest runs.
Diff(tools::DiffArgs),
/// Read the repository review guidance as JSON.
Guidance(RepositoryArgs),
/// Read a bounded, untrusted finding fix prompt as JSON.
Expand Down Expand Up @@ -485,6 +487,10 @@ pub async fn run(cli: Cli, token: Option<SecretString>) -> anyhow::Result<Verdic
let name = repository_name(&args.repository).await?;
tools::json(&api.history(&name, args.pr).await?)
}
Command::Diff(args) => {
let api = connect(Http::new(origin)?, token, cli.org).await?;
tools::diff(&api, &args).await
}
Command::Guidance(args) => {
let api = connect(Http::new(origin)?, token, cli.org).await?;
let (_, repository) = connected_repository(&api, &args).await?;
Expand Down
Loading