Skip to content

fix(review): show P4 added files in code review#494

Merged
backnotprop merged 1 commit intobacknotprop:mainfrom
l10veu602:fix/p4-added-files-review
Apr 7, 2026
Merged

fix(review): show P4 added files in code review#494
backnotprop merged 1 commit intobacknotprop:mainfrom
l10veu602:fix/p4-added-files-review

Conversation

@l10veu602
Copy link
Copy Markdown
Contributor

@l10veu602 l10veu602 commented Apr 6, 2026

Summary

  • Fix P4 added files not appearing in the review UI on Windows
  • Normalize \r\n to \n in P4 command stdout to prevent stray \r in file paths
  • Replace fragile index-based p4 where parsing with p4 -ztag where structured output

Root Cause

On Windows, p4 where stdout uses \r\n line endings. Splitting on \n leaves \r at the end of every path except the last line. Bun.file("path\r") silently fails to find the file, causing getNewFileDiff() to return an empty string and the added file to be omitted from the review.

Changes

  • runP4(): strip \r\n\n in stdout for all P4 commands
  • getNewFileDiff(): strip \r\n from file content read via Bun.file()
  • batchResolveDepotPaths(): switch from index-based p4 where line parsing to p4 -ztag where field-based parsing (also more robust for stream depots and overlay mappings)

Test plan

  • Tested on a real P4 workspace with 4 p4 add files + 12 p4 edit files
  • Before fix: 13 files shown (only 1 of 4 added files). After fix: 17 files shown (all 4 added files)
  • Verified Stray \r in patch: 0 after fix

🤖 Generated with Claude Code

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>
@l10veu602 l10veu602 closed this Apr 6, 2026
@l10veu602 l10veu602 reopened this Apr 6, 2026
@backnotprop backnotprop merged commit 719fd96 into backnotprop:main Apr 7, 2026
5 checks passed
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.

3 participants