Skip to content

feat(diff): compare findings between a pull request's two newest runs - #57

Closed
Kathircpe wants to merge 1 commit into
prooflinedev:mainfrom
Kathircpe:feat/diff-runs
Closed

Kathircpe wants to merge 1 commit into
prooflinedev:mainfrom
Kathircpe:feat/diff-runs

Conversation

@Kathircpe

Copy link
Copy Markdown

Today the CLI can show one run (proofline run), the latest findings
(proofline findings) or a list of runs (proofline history), but it cannot
show what changed between two runs. In practice that means comparing two blocks
of prose from memory:

  • after pushing a fix, you cannot tell whether the finding you addressed
    disappeared or was reworded and moved;
  • after a rebase or refactor, you cannot tell a new finding from an existing one;
  • a reviewer who looked at run 3 has to re-read run 5 in full.

Findings already carry finding_fingerprint, the retained semantic identity
the server uses to correlate occurrences across runs. The CLI reads it for SARIF
partialFingerprints and nowhere else. This change uses it to compare two runs
and report the difference.

Change

  • proofline diff --repo owner/name --pr 7 resolves the two newest recorded
    runs through /reviews/pr/{repository}/{pull_request_number} and reads each
    through /reviews/pr/{repository}/{pull_request_number}/runs/{run_number}.
    No API or contract change.
  • Findings are matched by fingerprint and reported as New, Resolved or
    Persisting. A persisting finding whose severity changed prints its previous
    severity.
  • A finding without a fingerprint is reported under Uncorrelated with its run
    number. Dropping it would let the diff claim nothing else changed when the
    truth is that it could not tell.
  • Environment and CODE are compared as separate lanes. If a lane is missing on
    one side, or either side's assessment is incomplete, that lane is reported as
    Not comparable instead of being diffed, and the command exits 2. This follows
    the renderer's rule that an incomplete assessment never reads as clean.
  • A run that is still PENDING or RUNNING refuses the diff. Its empty
    assessments are not a result, and diffing them would report every previous
    finding as resolved.
  • --json emits the repository, pull request, both run numbers and statuses,
    and the four lists. The run history is followed through next_cursor to the
    end rather than relying on the endpoint's ordering.
  • README.md documents the command, the exit codes and the two limits below.

Exit codes

Code Meaning
0 Both runs completed and every lane was comparable
2 A run was not COMPLETED, or a lane was not comparable
1 Usage or transport error, a missing run, or a run that has not finished

Verification

  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and
    cargo test --locked pass: 104 passed, 1 ignored.
  • Unit tests cover fingerprint classification, a changed severity, an incomplete
    environment, a missing CODE lane and a missing environment lane.
  • Integration tests run the real binary against a loopback server:
    diff_refuses_a_run_that_has_not_finished,
    diff_never_reports_an_incomplete_run_as_resolved (asserts Resolved (0) and
    that the incomplete lane is listed instead),
    diff_reports_a_missing_run_as_http_404, diff_needs_two_runs,
    diff_labels_findings_and_emits_the_documented_json and
    diff_follows_a_truncated_run_history_to_the_newest_runs.

Scope

The command compares the two newest runs only. --from/--to is a natural
follow-up, as is falling back to the two newest settled runs when the latest run
is still in flight. Both are left out to keep this change reviewable.

Match findings by fingerprint and print New, Resolved, Persisting, and Uncorrelated, with JSON output available via --json.

Refuse a diff while either run is still pending or running, and mark lanes not comparable instead of reporting false deltas when a run is incomplete or one side lacks an environment or CODE assessment. Such comparisons exit 2.

Follow the run history cursor so a truncated page never silently selects the wrong runs.

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