Skip to content

fix(cache): invalidate framework dependencies when equal-size file lists change - #2519

Open
nk33-dev wants to merge 1 commit into
colbymchenry:mainfrom
nk33-dev:codex/file-list-cache
Open

nk33-dev wants to merge 1 commit into
colbymchenry:mainfrom
nk33-dev:codex/file-list-cache

Conversation

@nk33-dev

Copy link
Copy Markdown

Problem

Framework dependency detection caches its answer by the number of indexed files. Replacing one source tree with another of the same size can retain the old dependencies. The resolver also repeatedly materializes the same tracked-file list while the database is unchanged.

Changes

  • Memoize the sorted file list using the existing database change stamp (local writes and commits through other connections).
  • Freeze the cached array and expose it as readonly.
  • Do not reuse a memo inside a transaction; clear it on connection rebind.
  • Key dependency detection by the file-list identity instead of its length.

This is limited to file lists and framework dependencies. It does not modify the node-name or stats caches proposed in #2115.

Validation

Windows, upstream baseline 7ba8eee.

  • npx tsc --noEmit passed.
  • 12 focused tests passed: seven file-list lifecycle tests, four existing monorepo framework tests, and one equal-size dependency replacement regression.
  • Coverage includes same-connection writes, another connection's commit, rollback, rebind, and caller mutation.
  • git diff --check passed.

No indexing-time or memory benchmark has been run, so this PR does not claim a measured speedup. Full-suite and cross-platform validation are left to CI.

This branch has not been deployed

No deployments
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