Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

  • Identify CI build failure
  • Fix netstandard2.0 compatibility issue (String.Contains with char vs string)
  • Verify build passes
  • Verify unit tests pass (123 tests, 0 failures)
Original prompt

This section details on the original issue you should resolve

<issue_title>Relative file path verification fails on Windows</issue_title>
<issue_description>

Discussed in #278

Originally posted by Numpsy December 15, 2025
Hi

I'm not sure if this is down to my environment or is an actual issue (I'm running on Windows and I see the CI is running on Ubuntu), but when I run the build script locally I get this unit test failure:

image

I got this when trying to do a local build for #277 and it prevented the later tests from running, making it harder to test.

Any ideas?

Thanks

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 24, 2025 14:42
- Add isTrulyAbsolute helper to distinguish between truly absolute paths and rooted relative paths
- On Windows, paths starting with / or \ followed by .. or . are now correctly treated as relative
- On Unix, paths starting with /../ or /./ are also correctly treated as relative
- Add comprehensive unit tests for path resolution logic
- All existing tests still pass

Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
- Extract startsWithRelativeMarker helper function to avoid code duplication
- Remove redundant checks after path normalization
- Both Windows and Unix platforms now use the same helper for consistency

Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix relative file path verification failure on Windows Fix relative file path verification on Windows Dec 24, 2025
Copilot AI requested a review from sergey-tihon December 24, 2025 14:48
Copy link
Member

@sergey-tihon sergey-tihon left a comment

Choose a reason for hiding this comment

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

fix CI build

Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 24, 2025

fix CI build

Fixed in commit 3e1ed8b. The build was failing because String.Contains(char) is not available in netstandard2.0 - changed to use Contains(string) instead.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/fsprojects/SwaggerProvider/actions/jobs/58875742271/logs
    • Triggering command: /usr/bin/curl curl -L REDACTED -H Accept: application/vnd.github.v3&#43;json (http block)
  • petstore.swagger.io
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.101/FSharp/fsc.dll @/tmp/MSBuildTempBQPLYS/tmpada5e26978814a309e2a2d9c015b151b.rsp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@sergey-tihon
Copy link
Member

@copilot fix tests

Copy link
Contributor Author

Copilot AI commented Dec 24, 2025

@copilot fix tests

The unit tests (123 tests in SwaggerProvider.Tests) are passing successfully. However, the provider integration tests (SwaggerProvider.ProviderTests) are failing during compilation because the type providers need to fetch OpenAPI schemas from external URLs like petstore.swagger.io at compile time, and these network requests are timing out or being blocked.

This is a network/environment issue rather than a code issue with the relative path fix. The provider tests would need network access or local schema files to build successfully.

@sergey-tihon sergey-tihon marked this pull request as ready for review December 24, 2025 19:06
Copilot AI review requested due to automatic review settings December 24, 2025 19:06
@sergey-tihon sergey-tihon merged commit ed3414f into master Dec 24, 2025
5 of 6 checks passed
@sergey-tihon sergey-tihon deleted the copilot/fix-relative-file-paths-windows branch December 24, 2025 19:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Windows-specific issue where relative file path verification was failing when paths containing parent directory references (..) were concatenated with __SOURCE_DIRECTORY__. The fix introduces more nuanced path classification logic that correctly distinguishes between truly absolute paths and rooted paths with relative markers.

Key changes:

  • Introduced startsWithRelativeMarker and isTrulyAbsolute helper functions to properly classify paths across Windows and Unix
  • Modified getAbsolutePath to handle rooted paths with drive letters vs. rooted paths without drive letters differently
  • Added comprehensive unit tests to verify path resolution behavior across platforms

Reviewed changes

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

File Description
src/SwaggerProvider.DesignTime/Utils.fs Added helper functions startsWithRelativeMarker and isTrulyAbsolute to correctly identify absolute vs. relative paths; updated getAbsolutePath logic to handle Windows paths with drive letters and Unix paths with proper security checks for path traversal attempts
tests/SwaggerProvider.Tests/PathResolutionTests.fs New test file with comprehensive coverage of path resolution scenarios including concatenated paths with parent directory references, relative paths, absolute paths (both Windows and Unix), URLs, and real-world __SOURCE_DIRECTORY__ usage patterns
tests/SwaggerProvider.Tests/SwaggerProvider.Tests.fsproj Added reference to the new test file PathResolutionTests.fs in the compilation order

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Relative file path verification fails on Windows

2 participants