Repository navigation
Description
What happens
The text renderer prints each finding's cited files as at path:lines. render::location ignores the reference's commit_sha, companion_repository and provenance_status, so a line range read at the base commit, or in a companion repository, prints exactly like a line at the reviewed head. Someone following it opens the wrong code. In a live review --pr N --full, 5 of 7 findings cited src/lib.rs read at the base commit and printed as plain at src/lib.rs, next to head-commit citations.
The CLI already has the rule. SARIF (sarif::code_location) places a reference only if it's a verified repository_file read at the review's head, and --annotations reuses it (#52). Text output (review, findings, run, and the hook summary) is the one view that doesn't.
Offline, with a stand-in server, one finding cites the same lines at the head, at the base and in another repository:
export PROOFLINE_TOKEN=dummy PROOFLINE_ORGANIZATION_ID=0190f3a0-0000-7000-8000-000000000001
R=0190f3a0-0000-7000-8000-0000000000e1
python3 - "$R" <<'PY' &
import json, sys
from http.server import BaseHTTPRequestHandler, HTTPServer
head, base = "c" * 40, "b" * 40
ref = lambda commit, repo=None: {"kind": "companion_repository_file" if repo else "repository_file", "label": "x",
"provenance_status": "VERIFIED_REPOSITORY_READ", "repository_path": "src/lib.rs", "start_line": 10, "end_line": 14,
"commit_sha": commit, "companion_repository": repo}
finding = {"id": "0190f3a0-0000-7000-8000-0000000000a1", "severity": "SERIOUS", "risk_domain": "data_integrity",
"claim": "Retries drop orders.", "impact": "orders are lost", "lifecycle_state": "NEW",
"evidence_refs": [ref(head), ref(base), ref(head, "acme/contracts")]}
body = json.dumps({"id": sys.argv[1], "kind": "PULL_REQUEST", "status": "COMPLETED", "repository_full_name": "acme/web",
"pull_request_number": 7, "run_number": 1, "base_commit_sha": base, "head_commit_sha": head, "assessment_count": 1,
"assessments": [{"id": "0190f3a0-0000-7000-8000-0000000000f2", "environment_display_name": "production",
"status": "COMPLETED", "findings": [finding], "checks": {"receipt_recorded": True, "status": "READY", "families": []}}]}).encode()
class H(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200); self.send_header("Content-Type", "application/json"); self.end_headers(); self.wfile.write(body)
def log_message(self, *args): pass
HTTPServer(("127.0.0.1", 8766), H).serve_forever()
PY
sleep 1
proofline --base-url http://127.0.0.1:8766 findings --review "$R"
proofline --base-url http://127.0.0.1:8766 findings --review "$R" --sarif | python3 -c 'import json, sys
print([r["locationStatus"] for r in json.load(sys.stdin)["runs"][0]["results"][0]["properties"]["evidenceReferences"]])'
kill %1 SERIOUS data_integrity Retries drop orders.
at src/lib.rs:10-14
at src/lib.rs:10-14
at src/lib.rs:10-14
...
['LOCATED', 'DIFFERENT_COMMIT', 'COMPANION_REPOSITORY']
SARIF from the same review places only the first citation.
Expected
Text output doesn't present a citation as head code when SARIF wouldn't. It still shows the citation, because text is where a person reads where the model looked.
Proposal
Keep every cited file in text output. A citation SARIF places at the head prints as today. Any other gets a short note on where it was read, decided by sarif::code_location's status so the two can't drift: (base <sha12>), (commit <sha12>), (in <owner/repo>) or (unverified). A code assessment's findings are checked against its own base and head, since a patch review records none. --json, SARIF and annotations stay as they are.
Seen on main (22c86ca).
Activity