Skip to content

test(file-explorer): count the linked-folder check in the rename scan bound - #25816

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/file-explorer-single-cache-scan
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/file-explorer-single-cache-scan

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

ELI5

Main's unit-test shard "test / tests node 24 2/5" is red for every PR. file-explorer-watch-reconcile.test.ts › "purges distinct cached directory renames with one bounded cache scan" fails with expected 4002 to be 2001.

The cause is #25371. Running only that test file, it passes at #25371's parent (c8ff7e8) and fails at #25371 (fff8718).

#25371 taught the file explorer to refresh linked folders when their targets change. To do that, the code that applies file-watcher events now looks through the explorer's folder cache once per batch of events, to see whether any cached folder is a link. The test still allowed only the single pass it did before, for clearing out renamed folders.

This PR updates the test to count that second pass. It does not change product code.

What Changed

What changes for users: nothing. This is test-only, and it makes main's unit tests green again.

The test is renamed to "purges distinct cached directory renames with one purge scan and one link check". Its bound goes from one pass over the cache keys to exactly two (toBe(entryCount * 2)). It stays an exact equality, so any further pass still fails it. A comment names #25371 and says why the second pass exists.

Why

I checked whether the second pass could be removed instead, and it can't without storing new state:

Cost: one pass over the cached folder paths and their children, once per batch of watcher events that isn't a plain edit to a known file. Plain file edits still skip it.

Follow-up (not filed): keep an index of cached linked folders beside the cache, updated when folders load, so no pass is needed. That is #25371's owner's area and stores derived state, so it's left out of this test-only fix.

Linked Issue

None. This is a red test on main from #25371.

Visual Proof

N/A: test-only change, nothing visible to users.

Testing

Bisect: running only this test file, it passes at fff8718^ and fails at fff8718 (expected 4002 to be 2001).

With this change, I ran 78 test files explicitly: every file-explorer-* and useFileExplorer* test in right-sidebar/, plus every test file #25371 touched. 77 passed. local-file-access.test.ts timed out in that batch at load average 115–133; run alone, it passes 17/17.

tc-gate pnpm tc:web, oxlint and pnpm run check:code-quality:changed pass.

Platforms: macOS locally; CI covers Linux and Windows.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No product code, SSH, mobile or platform behaviour changes.

PR author: @BrennanKB5.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

… bound

#25371 made the watcher reconciler build the cache path index once per
payload to learn whether any cached folder is a link, because nodes carry
no link target and watcher events name targets. The rename-batch test still
asserted a single cache scan, so it failed on main (4002 vs 2001). The bound
stays exact: one purge scan plus one link check.

Co-Authored-By: Claude <[email protected]>
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #24878, which fixed this on main (it reuses one cache-key enumeration for the link check and the purge, keeping the strict one-scan bound).

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