Repository navigation
fix: normalize single Windows path separators in protectedFilePatterns - #403
Conversation
normalizePath() searched for the two-character string \\(source literal "\\\\") instead of each single backslash, so real Windows paths were never normalized and protectedFilePatterns silently failed to protect them. Ported from upstream DCP commit 5f8f33b. Adds tests/protected-patterns.test.ts (5 of 8 tests fail against pre-fix code). Fixes #402
📦 Built Plugin ArtifactBranch: Option A — Install from npm PR tag (recommended)opencode plugin opencode-acp@pr-403 --globalEach push to this PR publishes a new version under the Option B — Install from GitHubopencode plugin "github:ranxianglei/opencode-acp#2026-09-16_fix-windows-path-normalization" --globalOption C — Download artifact
tar xzf opencode-acp-pr403.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
This comment is automatically updated on each push. |
[bot] 🏷 Reviewing this PR (mine / another agent's prior work — verifying rather than redoing). Diff reviewed (
CI: Independently running typecheck + the new suite + full suite locally to confirm the 8/8-pass / 5-of-8-fail-pre-fix claims. Will report back with the conclusion. |
[bot] 🏷 Verification complete — PR #403 is ready for human merge. (I did not redo the work; I fetched the branch and independently verified it.) Independent local run (detached worktree at head
Code review: the one-line change is correct and minimal — Diff cleanliness: 4 files, all on-topic — the fix, the new test file, and the required devlog ( CI (all green): Issue linkage: PR body carries Nothing to change. Per AGENTS.md §5.1.1.2, merging is a human-only operation — please merge when ready: #403 中文摘要:独立复核了本 PR(非重做)——单行修复正确(归一化从只替换双反斜杠改为替换每个单反斜杠,路径与模式同向归一、 |
Summary
Fixes #402 — ported from upstream DCP commit
5f8f33b.normalizePath()inlib/protected-patterns.tsdidreplaceAll("\\\\", "/"). In source,"\\\\"is the two-character string\\, so only doubled backslashes were ever replaced. Real Windows paths contain single separators, making the normalization a no-op on the only platform it exists for —protectedFilePatternssilently failed to protect Windows paths at all fourisFilePathProtectedcall sites (protected-content, sweep, deduplication, purge-errors). Only patterns like**/*.tsaccidentally worked, because*compiles to[^/]*, which spans backslashes freely.Changes
lib/protected-patterns.ts:2— replace each single backslash with/(both input path and pattern are normalized identically, so cross-style matching stays consistent and*still compiles to[^/]*without crossing directory boundaries)tests/protected-patterns.test.ts(NEW) — 8 regression tests: Windows path vs forward-slash pattern, pattern written with Windows separators, wildcard boundary semantics, read/multiedit/apply_patch parameter shapes, unmatched-path negatives,isToolNameProtectednon-regression, regex metacharacter escaping. Backslashes are built viaString.fromCharCode(92)so no future reformatting can reintroduce an escape mistake.Verification
tsc --noEmit)format:checkreports 452 pre-existing unformatted files unrelated to this change; left untouched to keep the diff minimal)No state-format, config-schema, or API changes. No version bump (content fix).