Skip to content

feat(review): add --dry-run and list every preflight refusal - #102

Closed
mrpmohiburrahman wants to merge 1 commit into
prooflinedev:mainfrom
mrpmohiburrahman:feat/review-dry-run
Closed

mrpmohiburrahman wants to merge 1 commit into
prooflinedev:mainfrom
mrpmohiburrahman:feat/review-dry-run

Conversation

@mrpmohiburrahman

Copy link
Copy Markdown

Who this helps

A person who is about to run proofline review on local changes, before the patch leaves the machine.

Problem

  1. The secret preflight stops at the first refused path. A patch with three secrets needs three runs and three edits.
  2. A checkout cannot be checked before proofline login. The first local review sends the patch before the person sees what it holds.

Change

proofline review --dry-run builds the same local patch as review and prints:

  • the base commit, the file count and the patch size
  • one line per changed file: added, modified, deleted or renamed
  • every preflight refusal, in patch order, in one list

It reads no credential and sends no request. The exit code is 1 when the preflight refuses the patch, and 0 when the patch passes.

The preflight now collects every refusal instead of returning the first one. review and hook run print the same list. A refused .env path is reported once, and its lines are not scanned again, so a .env file with five secrets is one line and not six. The list prints at most 20 lines and then counts the rest.

Example:

Local review would send 4 changed files (518 bytes of patch) against d726ae2dab5108f4b3653e5e70cf53e652cd5f5c.
  added ".env.local"
  added "added.txt"
  modified "kept.txt"
  deleted "old.txt"
proofline: local patch has 2 problems; remove them before upload, or pass --allow-path for each exact path:
  ".env.local": a sensitive .env path
  "kept.txt":2 (new line): an AWS access-key ID

Verification

  • a_dry_run_prints_the_patch_and_sends_nothing: exit 0, the summary names each file, and the fake server records no request.
  • a_dry_run_reports_every_refused_path_in_one_run: three problems in three files, one run lists all three, no secret reaches stderr, and no request is made.
  • every_refusal_is_listed_once_and_the_tail_is_counted: the list stops at 20 lines and counts the rest.
  • The existing tests/local_patch.rs cases pass with the new wording.
  • cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check pass. One test, unattended_registration_preserves_settings_and_uses_the_installed_binary, fails on main on this macOS host because $TMPDIR is /var/... and its canonical path is /private/var/.... That failure is present without this change.

Tradeoffs

  • The refusal text changed. A script that matches the old sentence must match --allow-path or a path and line instead.
  • --dry-run conflicts with --json, because it prints no JSON document. A JSON preview can follow.
  • A refused .env path hides a credential shape on its own lines. That matches the old behavior for a single run, and one --allow-path shows the file again.

`proofline review --dry-run` builds the same local patch, prints the base
commit, each changed file and the patch size, then runs the secret
preflight. It reads no credential and sends no request.

The preflight now collects every refusal instead of returning the first
one. A patch with three secrets needs one run and one edit, not three.
A refused `.env` path is listed once and its lines are not scanned again.

`cargo test`, `cargo clippy --all-targets -- -D warnings` and `cargo fmt
--check` pass.
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.

1 participant