Skip to content

Minor code cleanups - #1800

Open
Thorium wants to merge 2 commits into
fsprojects:mainfrom
Thorium:minor-cleanup
Open

Thorium wants to merge 2 commits into
fsprojects:mainfrom
Thorium:minor-cleanup

Conversation

@Thorium

@Thorium Thorium commented Sep 13, 2026

Copy link
Copy Markdown
Member

Minor code cleanups.

Copilot generated text-wall:
This pull request introduces several improvements and bug fixes across the codebase, with a focus on more robust type inference, performance and correctness in HTML parsing, and better error handling. The most important changes are summarized below:

HTML Parsing Improvements:

  • Refactored the descendantsBy function in HtmlOperations.fs to use an explicit stack for traversing nodes, improving performance and avoiding stack overflows for deeply nested HTML. The traversal is now pre-order and processes children in document order.
  • Updated the hasName function to use a case-insensitive comparison (StringComparison.OrdinalIgnoreCase) for matching node names, ensuring more robust HTML parsing regardless of case.

General Robustness and Error Handling:

  • Improved URI parsing in Helpers.fs by using String.IsNullOrWhiteSpace instead of a manual check, making URI validation more robust and readable.
  • Enhanced error messages in JsonSchema.fs for invalid reference paths, providing more informative feedback when a reference path does not lead through a record.

Type Inference Enhancements:

  • Added a new inferenceMode parameter to the InferColumnTypes method in CsvInference.fs, allowing more control over how types are inferred from CSV data.

@dsyme

dsyme commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

/repo-assist Fix the CI

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

✗ Repo Assist encountered failed, see workflow run.

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • api.nuget.org
  • api.worldbank.org
  • dc.services.visualstudio.com
  • raw.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.nuget.org"
    - "api.worldbank.org"
    - "dc.services.visualstudio.com"
    - "raw.githubusercontent.com"

See Network Configuration for more information.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated response from Repo Assist.

I looked into the CI failure. All three failing jobs (check-format, build-ubuntu, build-windows) fail for the same root cause: check-format fails first, and build-ubuntu/build-windows depend on it, so they never get past that stage.

Root cause: src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs is not formatted per the repo's Fantomas configuration:

/home/runner/work/FSharp.Data/FSharp.Data/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs needs formatting
Finished (Failed) 'CheckFormat'

Fix: Running dotnet run --project build/build.fsproj -t Format reformats the multi-line boolean condition in the URI-validation helper. I verified locally that CheckFormat then passes and Build succeeds. Here's the exact patch needed:

--- a/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs
+++ b/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs
@@ -257,7 +257,10 @@ module internal ProviderHelpers =
             match Uri.TryCreate(str, UriKind.RelativeOrAbsolute) with
             | false, _ -> None
             | true, uri ->
-                if String.IsNullOrWhiteSpace str || not uri.IsAbsoluteUri && Seq.exists invalidChars.Contains str then
+                if
+                    String.IsNullOrWhiteSpace str
+                    || not uri.IsAbsoluteUri && Seq.exists invalidChars.Contains str
+                then
                     None
                 else
                     Some uri

I wasn't able to push this directly since the PR branch lives on your fork (Thorium/FSharp.Data), which isn't authorized for automated pushes. Could you apply the patch above (or simply run dotnet run --project build/build.fsproj -t Format and commit the result)? That should get all three CI checks green.

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • api.nuget.org
  • api.worldbank.org
  • dc.services.visualstudio.com
  • raw.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.nuget.org"
    - "api.worldbank.org"
    - "dc.services.visualstudio.com"
    - "raw.githubusercontent.com"

See Network Configuration for more information.

Generated by 🌈 Repo Assist, see workflow run. Learn more.
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@5d11aa2a05ce2c943c085acb7b12b583f83ed375

@dsyme

dsyme commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@Thorium Please fix up when you get a chance, thanks

@Thorium

Thorium commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

I did already.
I don't know why fantomas Windows build pass and fantomas Ubuntu doesn't.
My WSL Ubuntu instance fantomas works fine: Formatted │ 0 │ Ignored │ 0 │ Unchanged │ 59 │ Errored │ 0

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants