You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(file-entry-cache): restore v8 reconcile and change-detection semantics (#1648) (#1649)
* fix(file-entry-cache): restore v8 reconcile and change-detection semantics (#1648)
file-entry-cache v11 diverged from v8 in three ways that broke ESLint's
use case:
1. reconcile() updated cache entries for *every* tracked file, not just
those inspected via getFileDescriptor(). This revalidated files that
were never looked at this run, so a file that changed on disk but was
not part of the run kept its stale (valid) cache entry. reconcile()
now only updates files that were visited during the session and drops
ones that were deleted.
2. getFileDescriptor() returned `changed: false` on repeated calls for
the same file because it overwrote the persisted meta on every read.
Change detection now compares against a baseline snapshot taken as of
the last load/reconcile, so a file keeps reporting `changed: true`
until the cache is reconciled.
3. create() threw when the cache file contained invalid JSON. It now
starts with an empty cache and overwrites the file on the next
reconcile(), matching v8.
Adds regression tests covering all three scenarios and updates existing
tests that relied on the previous (incorrect) same-session dedup behavior
to reconcile before re-checking.
* test(file-entry-cache): cover reconcile() guard for externally-removed entries
Covers the defensive branch in reconcile() that skips a session-tracked
key when it no longer exists in the underlying cache, restoring 100%
patch coverage.
* fix(file-entry-cache): harden create() and reconcile() per code review
- create(): only treat parse errors (SyntaxError) as an invalid cache and
fall back to an empty cache; re-throw unexpected IO/permission errors so a
valid cache is not silently discarded and overwritten.
- reconcile(): persist the consistent size/mtime/hash snapshot captured when
the file was inspected instead of re-stat'ing only size/mtime (which left
the hash stale and could mask a change made between getFileDescriptor() and
reconcile() in useModifiedTime mode). statSync is now used only to detect
deletion.
Adds regression tests for both behaviors.
* fixing some small issues
* minor bug fixes
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments