Skip to content

Fix canonical URI cache invalidation on path casing changes - #328679

Open
zainnadeem786 wants to merge 1 commit into
microsoft:mainfrom
zainnadeem786:fix/uri-identity-cache-invalidation
Open

Fix canonical URI cache invalidation on path casing changes#328679
zainnadeem786 wants to merge 1 commit into
microsoft:mainfrom
zainnadeem786:fix/uri-identity-cache-invalidation

Conversation

@zainnadeem786

Copy link
Copy Markdown

Fixes #328677

Summary

Fix canonical URI cache invalidation when a filesystem provider's path-casing capability changes.

Root Cause

UriIdentityService recomputes the new per-scheme ignorePathCasing value after a filesystem provider registration or capability-change event, but the existing implementation compares the newly computed value to itself.

Because this condition is always true, the listener returns before clearing cached canonical URI entries for the affected scheme.

As a result, direct URI comparisons can reflect the updated path-casing behavior while asCanonicalUri() continues returning URI values cached under the previous casing semantics.

Change

Compare the previously cached path-casing value with the newly computed value:

- if (newIgnorePathCasingValue === newIgnorePathCasingValue) {
+ if (oldIgnorePathCasingValue === newIgnorePathCasingValue) {

This allows the existing canonical URI cache invalidation logic to run only when the provider's path-casing behavior has actually changed.

Regression Test

Added a focused URI Identity regression test that:

  • caches foo://bar/BANG while the provider scheme is case-insensitive;
  • confirms foo://bar/BANG and foo://bar/bang initially resolve to the same canonical URI;
  • changes the provider capability to PathCaseSensitive;
  • emits the provider capability-change event;
  • verifies direct URI comparison reflects the new case-sensitive behavior; and
  • verifies asCanonicalUri(foo://bar/bang) no longer returns the stale uppercase URI.

The test fails on the previous implementation and passes after the fix.

Validation

  • npm run compile

  • .\scripts\test.bat --grep "asCanonicalUri clears cache when provider path casing changes"

    • 1 passing
  • .\scripts\test.bat --grep "URI Identity"

    • 8 passing

Copilot AI review requested due to automatic review settings August 3, 2026 09:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes stale canonical URI caching when filesystem path-casing capabilities change.

Changes:

  • Corrects old-versus-new casing comparison.
  • Adds a focused regression test for cache invalidation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/platform/uriIdentity/common/uriIdentityService.ts Corrects cache invalidation condition.
src/vs/platform/uriIdentity/test/common/uriIdentityService.test.ts Tests runtime casing-capability changes.

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.

UriIdentityService retains stale canonical URI cache after path casing capability changes

3 participants