fix(windows): align async/sync safe-open identity checks#25917
fix(windows): align async/sync safe-open identity checks#25917
Conversation
PR SummaryLow Risk Overview Extracts the identity comparison into shared Written by Cursor Bugbot for commit 0c9242d. This will update automatically on new commits. Configure here. |
…ocalFile On Windows, device IDs (dev) returned by handle.stat() and fs.lstat() may differ even for the same file, causing false-positive 'path-mismatch' errors when reading local media files. This fix introduces a statsMatch() helper that: - Always compares inode (ino) values - Skips device ID (dev) comparison on Windows where it's unreliable - Maintains full comparison on Unix platforms Fixes #25699
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
5678903 to
0c9242d
Compare
Summary
src/infra/file-identity.tsfs-safe.ts) and sync (safe-open-sync.ts) safe-open pathsdevchecks when both sides are non-zero, while allowing Windowsdev=0fallback parity with existing sync behaviorWhy this shape
safe-open-syncalready had a Windows fallback fordev=0; asyncopenVerifiedLocalFiledid not, so reasoning/media attachment reads on Windows could be dropped withLocal media path is not safe to read. Sharing one helper removes drift risk.Tests
pnpm test src/infra/file-identity.test.ts src/infra/fs-safe.test.tspnpm checkpnpm buildRelated
Greptile Summary
Extracted file identity comparison into a shared helper (
src/infra/file-identity.ts) to unify Windowsdev=0handling across async (fs-safe.ts) and sync (safe-open-sync.ts) safe-open paths. Previously, only the sync path had the Windows fallback, causingLocal media path is not safe to readerrors in async flows (reasoning/media attachments).Key changes:
sameFileIdentityhelper with platform-awaredev=0fallback for Windows while preserving strict checks when bothdevvalues are non-zeroConfidence Score: 5/5
Last reviewed commit: 5678903