Repository navigation
fix(injected-deps-syncer): skip FIFOs when syncing injected deps - #13612
EduardoFernandess wants to merge 6 commits into
Conversation
FIFOs and other non-file/dir nodes (e.g. 1Password `.env` pipes) caused extendFilesMap to throw UNSUPPORTED_INODE_TYPE, aborting syncInjectedDepsAfterScripts and leaving injected workspace deps stale. Skip those inode types instead of failing the whole sync. Fixes #13550 Co-authored-by: Cursor <[email protected]>
|
💖 Thanks for opening this pull request! 💖 |
|
Warning Review limit reached
Next review available in: 30 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesInode synchronization
Estimated code review effort: 2 (Simple) | ~10 minutes Assessment against linked issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix injected deps sync by skipping FIFO/unsupported inode types
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; current code removes target special inodes before replacement and completes parent modifications before adding descendant files. Reviews (6): Last reviewed commit: "style: correct UNSUPPORTED import order ..." | Re-trigger Greptile |
Record FIFOs/sockets/devices as UNSUPPORTED so target-side specials can be removed or replaced, and never hardlink them from the source. Fixes the TypeScript test that incorrectly called non-existent fs.mkfifoSync. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts`:
- Around line 158-161: Add release metadata for the change around DirPatcher’s
special-file skipping logic: create a concise changeset with an explicit pnpm
patch bump, and add the corresponding Pacquet changeset or document why Pacquet
parity is deferred.
In `@pnpm11/workspace/injected-deps-syncer/test/DirPatcher.test.ts`:
- Around line 229-236: Update the FIFO setup around fs.mkfifoSync so
process.platform === 'win32' returns before attempting creation; otherwise catch
errors and ignore only the documented unsupported-operation codes (ENOSYS and
EPERM), rethrowing every other error instead of allowing the platform check to
swallow it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ad359fcd-fb0a-4e15-9908-d0793d030fe0
📒 Files selected for processing (2)
pnpm11/workspace/injected-deps-syncer/src/DirPatcher.tspnpm11/workspace/injected-deps-syncer/test/DirPatcher.test.ts
| } | ||
| // Skip FIFOs, sockets, and device nodes (e.g. 1Password `.env` pipes). | ||
| // Throwing here aborted syncInjectedDepsAfterScripts and left injected | ||
| // deps stale — see https://github.com/pnpm/pnpm/issues/13550. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)changesets?/|DirPatcher\.ts$|Pacquet|package\.json$|changeset\.config|pnpm|README|AGENTS|CONTRIBUTING|REVIEW_GUIDE' || true
echo "== DirPatcher relevant section =="
sed -n '130,175p' pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts
echo "== changeset files =="
if [ -d .changeset ]; then find .changeset -maxdepth 1 -type f -print0 | xargs -0 -r -n1 sh -c 'echo "--- $0"; sed -n "1,80p" "$0"'; fi
echo "== changeset/config refs =="
rg -n "changesets|changeset|Pacquet|pnpm|patch|release" -S . --glob '!node_modules' --glob '!dist' | head -200Repository: pnpm/pnpm
Length of output: 50368
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== DirPatcher full file outline/contents stat =="
wc -l pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts
cat -n pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts
echo "== changesets mentioning injected, Pipe, FIFO, DirPatcher, Pacquet injected =="
rg -n "injected|DirPatcher|Pacquet|pip|FIFO|socket|device|cat|patch|1Password|13550|syncInjectedDepsAfterScripts" .changeset --glob '*.md' || true
echo "== package references for DirPatcher module =="
rg -n "`@pnpm/injected-deps-syncer`|DirPatcher|extendFilesMap|InodeMap|applyPatch" pnpm11 pnpm -S --glob '!**/pnpm-lock.yaml' | head -250Repository: pnpm/pnpm
Length of output: 50365
Add the required release metadata for the injected dependency sync change.
Add a concise changeset that includes an explicit pnpm patch bump. Add the matching Pacquet changeset or record why Pacquet parity is deferred.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts` around lines 158 -
161, Add release metadata for the change around DirPatcher’s special-file
skipping logic: create a concise changeset with an explicit pnpm patch bump, and
add the corresponding Pacquet changeset or document why Pacquet parity is
deferred.
Source: Path instructions
| try { | ||
| fs.mkfifoSync(fifoPath) | ||
| } catch (err) { | ||
| // Windows and some CI images lack mkfifo — skip rather than fail. | ||
| if ((err as NodeJS.ErrnoException).code === 'ENOSYS' || (err as NodeJS.ErrnoException).code === 'EPERM' || process.platform === 'win32') { | ||
| return | ||
| } | ||
| throw err |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Do not skip every Windows setup error.
The platform check is inside catch, so every Windows error becomes a passing test. Check process.platform before calling the FIFO creator. Then ignore only documented unsupported-operation codes and rethrow all other errors.
Suggested control flow
+ if (process.platform === 'win32') {
+ return
+ }
try {
fs.mkfifoSync(fifoPath)
} catch (err) {
- if (code === 'ENOSYS' || code === 'EPERM' || process.platform === 'win32') {
+ if (code === 'ENOSYS' || code === 'EPERM') {
return
}As per coding guidelines, catch only the specific expected error code and do not broadly swallow errors.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pnpm11/workspace/injected-deps-syncer/test/DirPatcher.test.ts` around lines
229 - 236, Update the FIFO setup around fs.mkfifoSync so process.platform ===
'win32' returns before attempting creation; otherwise catch errors and ignore
only the documented unsupported-operation codes (ENOSYS and EPERM), rethrowing
every other error instead of allowing the platform check to swallow it.
Source: Coding guidelines
Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts`:
- Around line 164-168: Update the comment in DirPatcher’s unsupported-entry
handling to remove the historical failure explanation and issue link. Keep only
the invariant that unsupported entries remain in the diff so target-side special
entries can be removed or replaced, while never being materialized from the
source by applyPatch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f0262df-b980-4935-a122-aadf17aee478
📒 Files selected for processing (4)
pnpm11/workspace/injected-deps-syncer/src/DirPatcher.tspnpm11/workspace/injected-deps-syncer/test/DirPatcher.test.tspnpm11/workspace/injected-deps-syncer/test/diffDir.test.tspnpm11/workspace/injected-deps-syncer/test/extendFilesMap.test.ts
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. Concurrent patch ordering race
|
Apply removals/modifications before adds so replacing a special inode with a directory cannot delete newly linked children. Keep mkfifo in alphabetical order for meta-updater. Co-authored-by: Cursor <[email protected]>
| // applyPatch never hardlinks these from the source. | ||
| // Throwing here aborted syncInjectedDepsAfterScripts and left injected | ||
| // deps stale — see https://github.com/pnpm/pnpm/issues/13550. | ||
| addInodeAndAncestors(relativePath, UNSUPPORTED) |
There was a problem hiding this comment.
3. Concurrent patch ordering race 🐞 Bug ☼ Reliability
applyPatch runs added and modified operations concurrently, so when a target path is UNSUPPORTED (FIFO/socket/device) and the source turns it into a directory with children, a child add may attempt to create/link under that path before the parent replacement completes and fail (e.g. ENOTDIR/EEXIST), aborting the sync. This becomes reachable because extendFilesMap now records special inodes as UNSUPPORTED instead of throwing.
Agent Prompt
## Issue description
`extendFilesMap()` now records special inode types as `UNSUPPORTED`, which allows diffs where a parent path is a `ModifiedItem` (e.g. `UNSUPPORTED -> DIR`) and its children are `AddedItem`s. `applyPatch()` currently applies `added`, `removed`, and `modified` in parallel; this can race such that a child `added` item runs before the parent `modified` item has removed/recreated the parent path, causing filesystem errors (commonly `ENOTDIR`/`EEXIST`) and aborting injected-deps sync.
## Issue Context
This is most likely when the *target* has a FIFO/socket/device at `pipe` and the *source* has a real directory `pipe/` containing files. The diff will include:
- `modified: [{ path: 'pipe', oldValue: UNSUPPORTED, newValue: DIR }]`
- `added: [{ path: 'pipe/file.txt', newValue: <inode> }, ...]`
The `added` handler calls `mkdirSync(path.dirname(targetPath), { recursive: true })`, which fails if `pipe` is still a FIFO.
## Fix Focus Areas
- pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts[85-129]
- pnpm11/workspace/injected-deps-syncer/src/DirPatcher.ts[145-171]
### Suggested fix approach
1. Change `applyPatch()` to enforce a safe phase order for type-changing parents:
- Phase 1: execute `removed` (already reversed) and the **remove** portion of `modified` (i.e., `removeRecursive(targetPath)` for each modified item).
- Phase 2: execute the **add** portion of `modified` (i.e., `addRecursive(...)` for each modified item).
- Phase 3: execute `added`.
This ensures parent replacements (like `UNSUPPORTED -> DIR`) complete before any child additions attempt to create/link beneath them.
2. Add a regression test that constructs:
- Source: `pipe/child.txt` (a real directory with a file)
- Target: `pipe` as a FIFO (or a mocked stat + filesystem layer)
and asserts `DirPatcher.apply()` succeeds and materializes the expected directory/file on target.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 7350e95 |
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Summary
Fixes #13550.
extendFilesMapthrewUNSUPPORTED_INODE_TYPEwhen it encountered a FIFO, socket, or device node (for example a 1Password.envpipe next to package files). That abortedsyncInjectedDepsAfterScriptsand left injected copies stale.Change
UNSUPPORTEDsentinel instead of throwing.applyPatchnever hardlinksUNSUPPORTEDentries from the source (source-side FIFOs are ignored for materialisation).EEXISTfrom linking over a FIFO).Test plan
UNSUPPORTEDin the inode mapdiffDirtreats targetUNSUPPORTED→ source file as a modificationmkfifo(when available) recorded asUNSUPPORTEDSummary by CodeRabbit
Bug Fixes
Tests