Skip to content

Re-enable Windows CI#324

Merged
vinistock merged 1 commit into
mainfrom
11-13-re-enable_windows_ci
Nov 20, 2025
Merged

Re-enable Windows CI#324
vinistock merged 1 commit into
mainfrom
11-13-re-enable_windows_ci

Conversation

@vinistock

@vinistock vinistock commented Nov 13, 2025

Copy link
Copy Markdown
Member

Closes #68

It seems that ruby/prism#3594 did fix the Windows build 🎉. This PR re-enables it so that we don't accidentally add Windows incompatible code.

Most of the fixes are related to assuming forward slashes in file paths or not accounting for the carriage return character where it may happen.

vinistock commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock self-assigned this Nov 13, 2025
@vinistock vinistock added the chore Something that should not be included in release notes label Nov 13, 2025
Base automatically changed from 11-13-upgrade_prism_to_v1.6.0 to main November 13, 2025 21:27
@vinistock
vinistock force-pushed the 11-13-re-enable_windows_ci branch 5 times, most recently from bbb21b0 to 032008f Compare November 14, 2025 15:53
@vinistock
vinistock changed the base branch from main to graphite-base/324 November 14, 2025 17:58
@vinistock
vinistock force-pushed the 11-13-re-enable_windows_ci branch from 032008f to ead5eab Compare November 14, 2025 17:58
@vinistock
vinistock changed the base branch from graphite-base/324 to 11-14-use_line-index_crate_for_offset_to_position_conversions November 14, 2025 17:58
@vinistock
vinistock changed the base branch from 11-14-use_line-index_crate_for_offset_to_position_conversions to graphite-base/324 November 14, 2025 18:19
@vinistock
vinistock force-pushed the 11-13-re-enable_windows_ci branch from ead5eab to 9ab0070 Compare November 14, 2025 18:19
@vinistock
vinistock changed the base branch from graphite-base/324 to main November 14, 2025 18:19
@vinistock
vinistock marked this pull request as ready for review November 14, 2025 18:27
@vinistock
vinistock requested a review from a team as a code owner November 14, 2025 18:27
Comment thread lib/saturn/location.rb

uri.path
path = uri.path
path.delete_prefix!("/") if Gem.win_platform?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is terrible, but temporary until we move the Ruby LSP's custom URI implementation into Saturn.

The reason we need this is because Windows paths are prefixed with an artificial forward slash to turn them into valid URIs. For example:

C:/projects/foo.rb

# Simply prefixing this with the scheme file:// will result in an invalid URI
# You need an extra forward slash (which has to be accounted for when translating
# back into a file path)

file:///C:/projects/foo.rb

Comment thread test/helpers/context.rb
def uri_to(relative_path)
path = absolute_path_to(relative_path)
path.prepend("/") if Gem.win_platform?
URI::File.build(path: path).to_s

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will also be replaced by our custom URI abstraction once we bring that over.

Comment on lines +195 to +197
let baz = Path::new("bar").join("baz.rb");
let qux = Path::new("bar").join("qux.rb");
let bar = Path::new("foo").join("bar.rb");

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.

Can't we move this logic into Context.touch?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried doing it in this commit, but it honestly makes the tests odd.

When these are running on Windows we need to assert that the result is using backslashes, which we can easily get if we simply do path.to_str().

If we try to continue writing tests with string literals that use forward slashes, then we need to somehow account for the fact that the result will contain forward slashes in Unix and backslashes on Windows - but then at that point, I feel like just dealing with paths is more straight forward.

Comment thread test/definition_test.rb
class Foo
# Method comment
def foo; end
def bar; end

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.

Why do we need to change this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wanted to extract the comments into a variable to make the test a bit more readable, but then both variables would be called foo_comments because both definitions are called foo.

Unless we're testing something related to indexing getting potentially confused due to similar names for different definitions, I'd vote to always use a different name to avoid any confusion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think in this particular case we can also use class_comments and method_comments without changing the test itself. But the current version is fine to me too.

Comment thread test/definition_test.rb Outdated
@caution-tape-bot

This comment was marked as off-topic.

@caution-tape-bot

This comment was marked as off-topic.

@vinistock

Copy link
Copy Markdown
Member Author

Regarding the caution tape bot, we are using the custom runners for Ubuntu and Windows, but we don't have custom runners for MacOS.

@vinistock
vinistock force-pushed the 11-13-re-enable_windows_ci branch from 5819c80 to 1edf741 Compare November 19, 2025 19:51
@vinistock
vinistock requested a review from Morriar November 19, 2025 19:54

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are several pieces of code you mentioned that can be removed/simplified once we port the URI abstraction from ruby-lsp. Can you add todo comments on them, like TODO: revisit this once URI abstraction is ported from ruby-lsp? This will make sure others can easily pick them up too.

@vinistock
vinistock force-pushed the 11-13-re-enable_windows_ci branch from 1edf741 to fa4c7ac Compare November 20, 2025 14:20
@vinistock

Copy link
Copy Markdown
Member Author

Added the TODO comments 👍

@vinistock
vinistock enabled auto-merge (squash) November 20, 2025 14:20
@vinistock
vinistock merged commit a231ccb into main Nov 20, 2025
14 checks passed
@vinistock
vinistock deleted the 11-13-re-enable_windows_ci branch November 20, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Something that should not be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use cross-compilation to fix Windows build

3 participants