Skip to content

fix: correct case sensitivity in core and e2e tests#2321

Merged
lishaduck merged 11 commits intomainfrom
ser-ansi-color
Mar 12, 2026
Merged

fix: correct case sensitivity in core and e2e tests#2321
lishaduck merged 11 commits intomainfrom
ser-ansi-color

Conversation

@lishaduck
Copy link
Member

@lishaduck lishaduck commented Feb 15, 2026

PR Checklist

Overview

❤️

@vercel
Copy link

vercel bot commented Feb 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flint Ready Ready Preview, Comment Mar 11, 2026 6:14pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2026

⚠️ No Changeset found

Latest commit: 1b16cac

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines +4 to +5
// TODO[typescript>=6.0]: Remove this declaration.
// https://github.com/microsoft/TypeScript/pull/63046
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see why we shouldn't upgrade to the TS 6.0 beta, but we can do that in a different PR.

microsoft/TypeScript#63046

Comment on lines +28 to +30
return stdout
.replace(/\\/g, "/")
.replace(new RegExp(RegExp.escape(normalizedCwd), "gi"), "<cwd>");
Copy link
Member Author

Choose a reason for hiding this comment

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

On macOS, /Users is capitalized, while the cwd our host uses isn't. This probably affected Windows as well.

CC @auvred; this continues to convince me we should preserve case in the VFS.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm still getting this, I'm not sure why... @barrymichaeldoyle do you know what would've changed?

- <underline><cwd>/fixtures/CONTRIBUTING.md</underline>
+ <underline><cwd>/fixtures/contributing.md</underline>

Copy link
Member Author

Choose a reason for hiding this comment

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

Also don't know if we should switch to normalizePath as Auvred suggested but I'll leave it be for now.

Copy link
Member

Choose a reason for hiding this comment

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

On macOS, /Users is capitalized, while the cwd our host uses isn't. This probably affected Windows as well.

That's why we should use normalizePath!

CC @auvred; this continues to convince me we should preserve case in the VFS.

This would be semantically incorrect. As I said earlier, fs.readFile('fIlE') === fs.readFile('file') on case insensitive file systems. VFS should match this behavior to avoid inconsistencies.

Copy link
Member Author

@lishaduck lishaduck Feb 20, 2026

Choose a reason for hiding this comment

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

Oh, I didn't see you replied, sorry. Got lost in the noise.

That's why we should use normalizePath!

I agree that it's it's nice to use one implementation, but can you explain to my feeble brain how normalizePath helps here? Is it that it'd be lowercase everywhere?

As I said earlier, fs.readFile('fIlE') === fs.readFile('file') on case insensitive file systems. VFS should match this behavior to avoid inconsistencies.

Yes, right, I agree. What I don't understand is why we can't normalize on operations instead of in our storage. It's nice to users to be able to keep /Users or C:/ capitalized. I, personally, would be (am) annoyed if you try to lowercase my paths, because they look different and I'm used to a certain case. Windows a little unusual because path normalization anyway, but, on macOS, it just gives weird vibes.

Ok, that was a longish rant, sorry. I'm sure there's a good reason for doing it this way, and I'm happy to concede, I just don't like it yet. So please enlighten me!

Copy link
Member

Choose a reason for hiding this comment

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

they're suggesting not carrying around two paths, but only normalize at the point where you're using it (e.g. comparisons).

Ahh, I see, sorry! Well, this might actually work, but then we would need to adjust the paths returned from LinterHost methods to be non-normalized, I guess, for example from watchDirectory...

Copy link
Member Author

Choose a reason for hiding this comment

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

I was hoping we could leave this for a followup, but the issue is actually that we do normalize the path here (I was hoping that normalizing everywhere would help).

I'll see what I can do :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Gave up my approach and tossed Amp on it, and well, there's a patch now, that seems to work in my testing. We do have two paths now, which I'm not thrilled with, but honestly my alternative was handrolling a hashmap with a custom equality so I'm not complaining. 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Haha, sorry about the late reply. But yeah I don't remember the nitty gritties of this. So I don't have strong opinions on changes here.

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry about the late reply. But yeah I don't remember the nitty gritties of this.

You're good! It turns out it wasn't actually an issue from #2141 but rather from #1605(?) that the merge of #2141 caught.

Copy link
Contributor

@michaelfaith michaelfaith left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@michaelfaith michaelfaith added 1 approval One team member approved; we're now waiting for a second approval or for 2 business days to pass. ready to merge 2+ team members approved; we're now waiting on the author to file followups and self-merge. labels Feb 15, 2026
@lishaduck
Copy link
Member Author

Ooops. Sorry for the rebase.

@kovsu
Copy link
Member

kovsu commented Mar 1, 2026

can you pull this down and check #2361 still works?

@lishaduck Sorry for the late response. I don’t think it’s working at the moment. It might be because normalize() was used in places where pathKey() should have been used instead.

@JoshuaKGoldberg
Copy link
Collaborator

fix: improve e2e tests

Just confirming: this PR does more than just e2e tests, it actually fixes case sensitivity things right? And fixes #2367?

@lishaduck
Copy link
Member Author

Just confirming: this PR does more than just e2e tests, it actually fixes case sensitivity things right? And fixes #2367?

Right. It was originally fixing the tests' case-sensitivity but then I realized the actual case-sensitivity was broken so that all got rolled into this.

Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

I like the "path key" terminology! Much clearer than TypeScript's file name and path. Left a couple minor questions, nothing critical (sorry it took me so long to review)

@JoshuaKGoldberg JoshuaKGoldberg changed the title fix: improve e2e tests fix: correct case sensitivity in core and e2e tests Mar 7, 2026
Copy link
Collaborator

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Hell yeah! Nothing from me beyond what Auvred's already said in review. This is looking great!

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Mar 11, 2026
Co-authored-by: auvred <61150013+auvred@users.noreply.github.com>

Also a bit of Amp to fix what that broke:

Amp-Thread-ID: https://ampcode.com/threads/T-019cdaf0-487a-7656-9652-8d879c64f373
Co-authored-by: Amp amp@ampcode.com
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

10/10!

@auvred auvred added ready to merge 2+ team members approved; we're now waiting on the author to file followups and self-merge. and removed status: waiting for author Needs an action taken by the original poster labels Mar 12, 2026
@lishaduck
Copy link
Member Author

I'm going to merge given how much this fixes.

@lishaduck lishaduck merged commit 9f4d531 into main Mar 12, 2026
8 checks passed
@lishaduck lishaduck deleted the ser-ansi-color branch March 12, 2026 12:31
@lishaduck lishaduck mentioned this pull request Mar 13, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge 2+ team members approved; we're now waiting on the author to file followups and self-merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Lots of spelling/cspell complaints on local Flint 🐛 Bug: CLI output shouldn't lowercase file names

6 participants