fix(review): show P4 added files in code review#494
Merged
backnotprop merged 1 commit intobacknotprop:mainfrom Apr 7, 2026
Merged
fix(review): show P4 added files in code review#494backnotprop merged 1 commit intobacknotprop:mainfrom
backnotprop merged 1 commit intobacknotprop:mainfrom
Conversation
P4 added files (p4 add) were not appearing in the review UI on Windows. The root cause was \r\n line endings from P4 command output — splitting on \n left \r in file paths, causing Bun.file() to fail silently. - Normalize \r\n to \n in runP4() stdout for all P4 commands - Strip \r\n from file content in getNewFileDiff() - Replace fragile index-based p4 where parsing with -ztag structured output, which is also more robust for stream depots and overlays Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
added files not appearing in the review UI on Windows\r\nto\nin P4 command stdout to prevent stray\rin file pathsp4 whereparsing withp4 -ztag wherestructured outputRoot Cause
On Windows,
p4 wherestdout uses\r\nline endings. Splitting on\nleaves\rat the end of every path except the last line.Bun.file("path\r")silently fails to find the file, causinggetNewFileDiff()to return an empty string and the added file to be omitted from the review.Changes
runP4(): strip\r\n→\nin stdout for all P4 commandsgetNewFileDiff(): strip\r\nfrom file content read viaBun.file()batchResolveDepotPaths(): switch from index-basedp4 whereline parsing top4 -ztag wherefield-based parsing (also more robust for stream depots and overlay mappings)Test plan
p4 addfiles + 12p4 editfilesStray \r in patch: 0after fix🤖 Generated with Claude Code