Skip to content

feat: add proofline finding command - #68

Open
akacolf wants to merge 2 commits into
prooflinedev:mainfrom
Quantum-Club-Inc:feat/finding-command
Open

akacolf wants to merge 2 commits into
prooflinedev:mainfrom
Quantum-Club-Inc:feat/finding-command

Conversation

@akacolf

@akacolf akacolf commented Nov 18, 2026

Copy link
Copy Markdown

Problem

openapi.public.json already exposes get_finding (GET /api/v1/organizations/{org_id}/findings/{finding_id} -> CustomerFinding), and proofline review prints finding IDs for follow-up commands, but the CLI had no proofline finding <FINDING_ID> [--json] command to inspect an individual finding directly.

Approach

  • build.rs: Registered ("get", "get_finding", &["finding_id"]) in OPERATIONS so routes.rs generates url_get_finding.
  • src/model.rs: Added CustomerFinding and its typed OpenAPI sub-models (CustomerEvidenceRef, CustomerFindingValidation, FindingCausalGraphView, FindingCausalNodeView, FindingCausalEdgeView, FindingRuleRefView, FindingSupport, UntrustedText).
  • src/api.rs: Added Api::finding(&self, finding_id: Uuid) -> Result<(serde_json::Value, CustomerFinding), ApiError>, matching Api::review by returning both the raw serde_json::Value (preserving unknown/future server fields for --json) and the typed CustomerFinding (for text rendering).
  • src/render.rs: Added render::finding_detail (with format_evidence_ref) using one_line terminal-escape sanitization for all untrusted server strings, plus a unit test finding_detail_renders_evidence_validation_and_causal_graph.
  • src/lib.rs: Added Command::Finding(FindingArgs) (finding_id: Uuid, --json: bool) and wired it in run().
  • tests/contract.rs: Added CustomerFinding and CustomerEvidenceRef to types_match_the_public_contract and ("get", "/api/v1/organizations/{org_id}/findings/{finding_id}") to operations_the_cli_calls_exist.
  • tests/http.rs: Added finding_command_renders_text_and_json_safely using an axum mock server to verify Authorization: Bearer ... header, terminal-escape stripping in text mode, rendered metadata/evidence/causal-graph fields, and verbatim raw JSON preservation in --json mode.

Proofline Review & Evaluation

Tested on our fork PR (Quantum-Club-Inc/cli#1, Proofline review):

  • Proofline flagged 1 Warning (JSON test misses altered claims and dropped fields) in tests/http.rs: our --json test assertions only checked parsed["id"] and parsed["future_server_field"]["kept_in_json"], so mutations to claim or dropped fields like impact would have gone undetected.
  • Evaluation: We agreed with this finding — the entire point of returning (serde_json::Value, CustomerFinding) in Api::finding is to preserve the raw server document verbatim for --json. In commit 98cac86, we replaced the partial assertions with assert_eq!(parsed, payload);.

End-to-End Verification & Reproducible Steps

Run in /Users/colf/Desktop/proofline-cli (Rust 1.95):

cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked --lib
cargo test --locked --test contract
cargo test --locked --test http

Observed results after the final edit (98cac86):

  • cargo fmt --check: passed (exit 0)
  • cargo clippy --locked --all-targets -- -D warnings: passed (exit 0)
  • cargo test --locked --lib: 63 passed; 0 failed; 0 ignored (includes render::tests::finding_detail_renders_evidence_validation_and_causal_graph)
  • cargo test --locked --test contract: 2 passed; 0 failed; 0 ignored (operations_the_cli_calls_exist, types_match_the_public_contract)
  • cargo test --locked --test http: 41 passed; 0 failed; 0 ignored (includes finding_command_renders_text_and_json_safely)

@mohityadav8

Copy link
Copy Markdown

@mohsen1 can i review this and other open pr ?

This branch has not been deployed

No deployments
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