Skip to content

🤖 fix: harden review diff parsing for prefix variants#3040

Open
RainbowDashy wants to merge 6 commits intocoder:mainfrom
RainbowDashy:fix-review-diff-parser-robustness
Open

🤖 fix: harden review diff parsing for prefix variants#3040
RainbowDashy wants to merge 6 commits intocoder:mainfrom
RainbowDashy:fix-review-diff-parser-robustness

Conversation

@RainbowDashy
Copy link

@RainbowDashy RainbowDashy commented Mar 20, 2026

Summary

Make the Review diff parser tolerate more real-world git patch header formats so the Review tab no longer drops valid diffs when git uses mnemonic prefixes or --no-prefix.

Background

The Review panel parsed file boundaries from diff --git headers but assumed path labels always looked like a/... and b/.... In workspaces using mnemonic prefixes such as c/... and w/..., or diffs produced with --no-prefix, Review could show a non-zero raw output size while still reporting zero parsed files and hunks.

Implementation

src/common/utils/git/diffParser.ts now canonicalizes diff path labels more carefully instead of blindly stripping the first path segment. The parser now:

  • accepts standard and mnemonic diff prefixes
  • preserves real nested paths when --no-prefix is used
  • respects /dev/null for additions and deletions
  • uses rename metadata when present to keep old/new paths accurate

src/common/utils/git/diffParser.test.ts adds focused coverage for mnemonic-prefix and --no-prefix diffs, including add/delete cases.

Validation

  • bun test src/common/utils/git/diffParser.test.ts
  • bun x prettier --check src/common/utils/git/diffParser.ts src/common/utils/git/diffParser.test.ts
  • make static-check

Risks

Low. The change is narrowly scoped to diff header/path normalization in the shared parser, with regression coverage for the newly supported diff forms.


Generated with mux • Model: openai:gpt-5.4 • Thinking: high • Cost: $0.00

Teach the diff parser to canonicalize paired git path labels, honor ---/+++ patch headers, and preserve rename metadata so --no-prefix, mnemonic-prefix, add, and delete patches resolve the correct repo-relative paths.

Add regression coverage for real git-generated --no-prefix and mnemonic-prefix diffs, and make the deletion test self-contained so it no longer depends on prior test ordering.
Keep the robust diff parser changes intact while addressing the remaining lint complaints by switching the parsed path label shape to an interface and using an optional chain for the null-path guard.
@RainbowDashy
Copy link
Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c83ea5e5d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@RainbowDashy
Copy link
Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18dd83fbfe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@RainbowDashy
Copy link
Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4383f8531d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@RainbowDashy
Copy link
Author

@codex review

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.

1 participant