Repository navigation
fix: Treat a repeated override file path in a different case as a repeat on Windows - #2134
Conversation
…eat on Windows The file-based override source drops a path listed more than once, so that the file's entries are not duplicates of themselves. The comparison was exact, so on Windows, where file names ignore case, a path repeated in a different case survived and every key of that file failed as its own duplicate under the default fail handling. On Windows the comparison now ignores case; elsewhere it stays exact.
|
bugbot review |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
bugbot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit db5a4ab. Configure here.
Summary
The file-based override source drops a path that is listed more than once, so that the file's entries do not collide with themselves. The comparison was exact. On Windows, where file names ignore case, a path repeated in a different case (
C:\overrides\a.jsonandc:\Overrides\A.JSON) survived, and every key in that file then failed as its own duplicate under the defaultfailhandling, so the reload failed and no overrides from it applied.On Windows the comparison now ignores case. Elsewhere it stays exact, because a case-sensitive file system can hold both names as different files. The platform is read from the platform data the SDK already reports (
os.nameofWindows), so the shared package does not depend on Node'sprocess.This is the gap that Bugbot found in the .NET port (launchdarkly/dotnet-core#367).
Tests
Two tests in
createOverrideSource.test.tsset the platform's OS name. On Windows, a path repeated in a different case is dropped with the existing warning; this test fails without the change and fails again with it reverted. On Linux, paths that differ only in case are both kept. The sdk-server suite passes (1561 passed, 7 skipped), and lint and formatting are clean.Opened from termag
SDK-3419
Note
Overview
File override path deduplication now treats paths that differ only by case as the same file when
platformData().os.nameisWindows, dropping repeats with the existing warning. On other platforms, deduplication stays case-sensitive so two paths can still refer to distinct files.Implementation replaces
indexOf-based filtering with aSetkeyed by the path or its lowercase form on Windows. Tests addmakeContextOnto mock OS name and cover Windows (drop + warn) vs Linux (keep both, no warn).Reviewed by Cursor Bugbot for commit db5a4ab. Bugbot is set up for automated code reviews on this repo. Configure here.