Skip to content

fix(utils): key visited directories on BigInt inodes so Windows scans keep sibling folders - #454

Merged
joepetjr merged 1 commit into
mainfrom
fix/walk-inode-bigint
Oct 27, 2026
Merged

joepetjr merged 1 commit into
mainfrom
fix/walk-inode-bigint

Conversation

@joepetjr

Copy link
Copy Markdown
Collaborator

Problem

test (22, windows-latest) failed twice on the v2.3.0 release PR (#453), each time in test/skill-files-project-scope.test.js. One run dropped the home skill file and the other dropped the project one. Real Windows scans had the same bug: skill files went missing at random.

walkDirSafe remembers visited directories by `${st.dev}:${st.ino}` so it can detect loops. On NTFS, file IDs are larger than 2^53. A plain-Number ino loses its low bits, so two sibling folders created one after another can end up with the same key. The walker then treats the second folder as a symlink loop and skips everything inside it. docker-security's Kubernetes directory dedupe uses the same kind of key.

Change

  • src/utils.js: both visited-key stat calls read { bigint: true }, so the ID keeps full precision.
  • src/checks/docker-security.js: same change for the Kubernetes dir dedupe.
  • test/walk-inode-key.test.js: simulates the rounding by giving every Number ino the same value. Before the fix the walker reports a loop and returns one file; after it, it returns both. Red before the fix, green after.
  • changelog.d/454.fixed.md.

Verification (Linux, local)

  • npx vitest run test/walk-inode-key.test.js: red before the fix, green after.
  • npm test: 2522 passed, 59 skipped.
  • npm run verify:docs: OK.
  • npm run test:fixture: 5 passed.

Windows is checked by this PR's test (22, windows-latest) job.

@joepetjr
joepetjr added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 8f63103 Oct 27, 2026
6 checks passed
@joepetjr
joepetjr deleted the fix/walk-inode-bigint branch October 27, 2026 14:58
joepetjr added a commit that referenced this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant