Repository navigation
Preserve carriage returns in review diffs - #1353
Conversation
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; retain the documented Git patch capture and main’s branch name whitespace handling. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; tests exercise the documented exact Git evidence path. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the compact fixtures verify the documented original patch digest. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the transport test covers both exact and rendered patches. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on e8a5bde8fb4b0b4034a083ab0a0edcb453ab066d, 33.0s: approve (0 critical, 0 important, 1 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
|
|
||
| def diff_since(wt: Path, sha: str) -> str: | ||
| return _git(Path(wt), "diff", "--no-color", sha, "HEAD") | ||
| def diff_since(wt: Path, sha: str) -> bytes: |
There was a problem hiding this comment.
suggestion: diff_since turns Git's bytes into text and back again
diff_since asks _proc.run(preserve_newlines=True) to turn Git's raw stdout into text using surrogateescape. It then turns that text straight back into bytes. That round trip is the only reason _proc.run needs to set stdout and stderr to different error handlers, and for preserve_newlines to also switch the encoding to UTF-8. The result is correct because surrogateescape gets the original bytes back exactly. Still, the bytes are the real data here, so there's no reason to go through text. A simpler fix: add a small raw-bytes mode to _proc.run (or a _git_bytes helper) that returns proc.stdout unchanged, and have diff_since return it directly. That removes the surrogateescape conversions and means a future caller can't accidentally write the surrogateescaped string somewhere that expects strict UTF-8.
Architecture-Review: unchanged; the deletion fixture follows the documented patch rendering path. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 1752ac831900f9c14093e6bfaab923849803f53a, 7.1s: approve (0 critical, 0 important, 0 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Preserve carriage returns in review diffs
Context and goal
Acceptance
A committed CRLF-only change keeps its carriage return and final newline in the supplied patch. Native inspection verifies the digest against Git's output. Existing text-mode callers retain their behavior.
Closes #1126
Base
Base: 47bdb17
Notes
The committed CRLF fixture failed before the change because the prompt dropped its carriage return and final newline. The full runner test file passed with the fix.
This supersedes #1237. It carries the original #1140 patch and its review fixes, with a smaller regression fixture to fit the test line budget. The transport test exercises both CRLF and legacy-encoded committed patches.
Validation
Recorded for
1752ac831900uv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review