Skip to content

fix: Windows portability in shipped code, with CI lanes to keep it - #213

Merged
mchav merged 5 commits into
DataHaskell:mainfrom
skymanbp:win-portability
Aug 20, 2026
Merged

fix: Windows portability in shipped code, with CI lanes to keep it#213
mchav merged 5 commits into
DataHaskell:mainfrom
skymanbp:win-portability

Conversation

@skymanbp

Copy link
Copy Markdown
Contributor

Follow-up to #212: the test suite passes on Windows now, but the same defect classes were still in shipped code, and nothing runs CI there. This fixes the library/app side and adds lanes so it stays fixed.

Library and app fixes:

  • writeCsv/writeTsv/writeSeparated and the web-plot HTML writer used locale text handles: a non-UTF-8 code page mis-encodes the output, and newline translation corrupts quoted embedded newlines. The writers now use byte-mode UTF-8 (Data.Text.IO.Utf8).
  • The lazy CSV reader and countRows decoded with the locale, unlike the byte-mode strict reader; their handles are now pinned to UTF-8.
  • showInDefaultBrowser spawned start as an executable. It is a cmd builtin and needs a shell, so web plots never opened on Windows.
  • lazy-bench wrote to /tmp, which Windows lacks; it now uses the system temp dir.

CI: windows-latest and macos-14 lanes over the cabal.project.ci subset at the ends of the tested GHC range (9.6.7, 9.12.2), mirroring the ubuntu workflow. Four runner jobs per push/PR; trim the matrix if that is too much.

Validated on my fork: all four new lanes green (https://github.com/skymanbp/dataframe/actions/runs/32211640843), the library fixes green on Presubmit + ubuntu (https://github.com/skymanbp/dataframe/actions/runs/32215828900), and the merged branch green locally on Windows 11 (full cabal test all over every package in cabal.project.ci: 1097 + 134 + 193 + 61 + 10 cases, 0 failures).

Out of scope: stdout locale encoding in the terminal display paths — that is process-global policy, not a file handle the library owns.

The suite passes on Windows since DataHaskell#212; these lanes keep it that way.
Runs the cabal.project.ci subset on windows-latest and macos-14 at the
ends of the tested GHC range (9.6.7, 9.12.2).
Same classes DataHaskell#212 fixed in tests. CSV and HTML writers and the lazy
reader used locale handles; pin them to UTF-8. 'start' is a cmd
builtin, so launch it through a shell. lazy-bench wrote to /tmp,
which Windows lacks; use the system temp dir.
Comment thread app/LazyBenchmark.hs Outdated

defaultFile :: FilePath
defaultFile = "/tmp/lazy_1b.csv"
-- /tmp does not exist on Windows.

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.

We can remove this comment. Please review the PRs for comment hygiene.

Comment thread dataframe-csv/src/DataFrame/IO/CSV.hs Outdated
import qualified Data.Text.Encoding as TE
import qualified Data.Text.IO as TIO

-- UTF-8 byte mode; locale handles corrupt output on Windows.

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.

No comments on imports.

Nothing -> (0, totalRows')
Just (start, len'') -> (start, min len'' (totalRows' - rowsRead opts))
withFile path ReadMode $ \handle -> do
-- Decode UTF-8, not the locale.

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.

This comment restates the line of code.

"mingw32" -> openFileSilently "start" fullPath
"darwin" -> openFileSilently "open" fullPath
_ -> openFileSilently "xdg-open" fullPath
-- 'start' is a cmd builtin; it needs a shell.

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.

You can out this in the PR description rather than 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.

Or even in the function haddock.

@skymanbp

Copy link
Copy Markdown
Contributor Author

Done. Swept both PRs.

@skymanbp
skymanbp requested a review from mchav August 20, 2026 04:25
@mchav
mchav merged commit 09c52b3 into DataHaskell:main Aug 20, 2026
14 of 15 checks passed
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.

2 participants