Code review: binary paths containing ` b/` are truncated and misclassified as renames
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu với parseDiffGitHeader trong packages/core/diff-paths.ts, nơi chứa regex cho diff --git a/... b/... không được đặt trong dấu ngoặc kép, sau đó theo dõi cách dùng nó trong parseDiffToFiles trong packages/core/diff-files.ts. Chạy đoạn bun repro-diff-path.ts của issue để xác nhận đầu ra sai của icon.png/oldPath, rồi thêm các test parser bên cạnh các test diff hiện có. Hoàn tất khi header nhị phân có đường dẫn bằng nhau cho ra path: "assets b/icon.png" mà không có oldPath và trạng thái modified, trong khi đường dẫn có dấu ngoặc kép và các trường hợp rename/copy thực vẫn pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened?
A binary modification under a directory containing the literal sequence b/ is parsed with the wrong file identity and incorrectly classified as a rename. The existing file assets b/icon.png becomes path: "icon.png", with oldPath: "assets b/icon.png b/assets".
I reproduced this by calling the unmodified production parseDiffToFiles with actual git diff output from an isolated repository. A control file at assets/icon.png parses correctly. This verifies the parser; I have not run the browser UI or a packaged Plannotator binary.
Minimal reproduction
From a Plannotator checkout, save this as repro-diff-path.ts and run bun repro-diff-path.ts:
import { parseDiffToFiles } from './packages/core/diff-files';
const patch = [
'diff --git a/assets b/icon.png b/assets b/icon.png',
'index a4b2576..e98258d 100644',
'Binary files a/assets b/icon.png and b/assets b/icon.png differ',
'',
].join('\n');
console.log(parseDiffToFiles(patch).map(({ path, oldPath, status }) =>
({ path, oldPath, status })));
This is real Git output: create and commit a PNG at assets b/icon.png, change its binary bytes, then run git diff --no-ext-diff --no-textconv. Git leaves these space-containing paths unquoted in this header.
Actual result
[{"path":"icon.png","oldPath":"assets b/icon.png b/assets","status":"renamed"}]
Expected result
[{"path":"assets b/icon.png","status":"modified"}]
oldPath should be absent because the file was not renamed.
Source and impact
parseDiffGitHeaderuses/^diff --git a\/(.+) b\/(.+)$/for unquoted headers. The first greedy group consumes through theb/inside the new-side path.parseDiffToFileshas no---/+++or rename metadata to fall back to for this binary modification, so it propagates incorrect paths and derivesrenamed.- The code-review app uses this parser for its file list, and
listPatchFilesuses it for the server's changed-file set.findPatchFileEntryalso uses the same header parser. Downstream file identity/path lookup therefore receives a path that does not name the changed file. These downstream implications are based on source inspection, not a browser reproduction.
A fix should cover unquoted equal-path binary headers containing b/, while preserving quoted paths and genuine rename/copy handling. Simply making the regex non-greedy also needs care: b/ can occur in the old-side path too.
Related reports checked
I searched issues and PRs for the parser name, binary paths, whitespace and diff headers. #628 concerns quoted/non-ASCII headers and is closed; this reproduction uses an unquoted header and still fails on the checked main snapshot.
Plannotator version
Source checkout at 76cbbecf8bfe67ad1c3f8713c0c0907663710fd5 (package.json: 0.29.2). The same parser file was rechecked on main before filing.
OS
Windows. Verification runtime: Node.js v24.22.3 with native TypeScript support and an extension-resolution hook for the repo's extensionless import; Git 2.56.0.windows.2. The Bun snippet above is the equivalent maintainer-facing reproduction; the measured output was obtained with Node calling the original source functions.
Agent
None / standalone source-level reproduction
Where did it happen?
Code review — shared diff parser
Browser
Not used.
- Ngôn ngữ chính
- TypeScript
- Star
- 8.7k
- Fork
- 649
- Merge trung bình
- 14 giờ 26 phút
- Pull request đã merge (30 ngày)
- 772
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của backnotprop/plannotator
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checksCó thể đã có người làm @Raj1v đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#4046 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Codex routine preflight ignores project-level Inbox MCP registrationCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#4000 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PR description is hidden when a PR review opens on a phoneCó thể đã có người làm @flipcyde101 đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
backnotprop/plannotator#3667 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
backnotprop/plannotator#2643 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Annotate documentation omits per-file version history and privacy controlsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#1086 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của backnotprop/plannotator
Issue tương tự
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Có thể đã có người làm @goranai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
進捗部屋の管理画面で削除対象を月ごとに絞り込むĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
traPtitech/knoQ_R-UI#290 ·
Maintainer thường phản hồi trong vòng 24 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
farion1231/cc-switch#9981 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
account bug course exam iris lecture
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100