Code review: binary paths containing ` b/` are truncated and misclassified as renames
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- tooling
Línea de trabajo
Empieza con parseDiffGitHeader en packages/core/diff-paths.ts, donde está la expresión regular para diff --git a/... b/... sin comillas, y luego sigue su uso en parseDiffToFiles en packages/core/diff-files.ts. Ejecuta el fragmento bun repro-diff-path.ts del issue para confirmar la salida incorrecta de icon.png/oldPath, y luego añade tests del parser junto a los tests de diff existentes. Terminado cuando el encabezado binario de rutas iguales produzca path: "assets b/icon.png" sin oldPath y con estado modified, mientras que las rutas entre comillas y los casos reales de rename/copy sigan pasando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 8.7k
- Forks
- 649
- Merge medio
- 14 h 26 min
- PR fusionados (30 d)
- 772
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de backnotprop/plannotator
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checksPosiblemente ocupada @Raj1v la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
backnotprop/plannotator#4046 ·
Los mantenedores suelen responder en 1 día
-
Codex routine preflight ignores project-level Inbox MCP registrationPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
backnotprop/plannotator#4000 ·
Los mantenedores suelen responder en 1 día
-
PR description is hidden when a PR review opens on a phonePosiblemente ocupada @flipcyde101 la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
backnotprop/plannotator#3667 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
backnotprop/plannotator#2643 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Annotate documentation omits per-file version history and privacy controlsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
backnotprop/plannotator#1086 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de backnotprop/plannotator
Issues similares
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Posiblemente ocupada @goranai la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
進捗部屋の管理画面で削除対象を月ごとに絞り込むAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
traPtitech/knoQ_R-UI#290 ·
Los mantenedores suelen responder en 24 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
farion1231/cc-switch#9981 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
account bug course exam iris lecture
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100