Code review: binary paths containing ` b/` are truncated and misclassified as renames
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
parseDiffGitHeader から始めます。これは packages/core/diff-paths.ts にあり、引用符で囲まれていない diff --git a/... b/... の正規表現がここにあります。次に、parseDiffToFiles での使用箇所を packages/core/diff-files.ts で追います。issue の bun repro-diff-path.ts スニペットを実行して、誤った icon.png/oldPath の出力を確認し、既存の diff テストの隣にパーサーテストを追加します。等しいパスのバイナリヘッダーが path: "assets b/icon.png" を oldPath なしで、ステータス modified で返し、引用符付きパスと実際の rename/copy ケースが引き続き通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 8.7k
- フォーク
- 649
- 平均マージ
- 14時間 26分
- マージ済み PR(30日)
- 772
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
backnotprop/plannotator のほかの issue
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checks対応中かも @Raj1v が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#4046 ·
メンテナーはふだん 1 日以内に返信
-
Codex routine preflight ignores project-level Inbox MCP registration対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#4000 ·
メンテナーはふだん 1 日以内に返信
-
PR description is hidden when a PR review opens on a phone対応中かも @flipcyde101 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
backnotprop/plannotator#3667 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
backnotprop/plannotator#2643 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Annotate documentation omits per-file version history and privacy controls再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#1086 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
backnotprop/plannotator の issue をすべて見る
似ている issue
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10対応中かも @goranai が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
traPtitech/knoQ_R-UI#290 ·
メンテナーはふだん 24 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
farion1231/cc-switch#9981 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
account bug course exam iris lecture
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100