Skip to content

fix: keep the theme suite honest on a Windows runner - #141

Merged
omartelo merged 1 commit into
mainfrom
fix/windows-theme-tests
Aug 4, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/windows-theme-tests

Conversation

@omartelo

@omartelo omartelo commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

main has been red on the Windows runner since #131 merged — three consecutive failing runs (0980607, aae21c2, 789f8f1). It surfaced when the v0.24.0 tag ran release.yml: the windows job failed, so release, aur and homebrew were skipped and nothing was published.

Two tests fail, both from #131, and neither is a Windows bug in the feature. Both are the suite assuming Linux.

TestListReturnsDirectoryError

The test puts a regular file where the themes directory belongs and expects List to fail. On Windows, ReadDir on that file reports not-exist, and customThemes had a os.IsNotExist branch meaning "nothing imported yet" — so identical state read as an error on Linux and as silence on Windows.

Fixed in the product rather than the test, since the divergence was real: customThemes now stats the path first and says outright that it is not a directory. Same answer on every OS, and the "nothing imported yet" branch still means only that.

TestDocumentedExampleIsImportable

Mine, from the review follow-up. It finds the documented JSON with ```json followed by a bare \n. The repo pins no .gitattributes, so a Windows checkout carries CRLF and the pattern matched nothing — the test reported "docs/themes.md has no JSON example" on a file that has one.

The pattern takes either ending now, and TestDocJSONBlockReadsBothLineEndings feeds it both, so the assumption fails on Linux if anyone hardcodes \n again.

Why neither PR caught it

os-tests runs on a push to main, or on a pull request carrying ci:os. Neither #131 nor #140 had the label. The local cross-compile loop passed on both — but as CLAUDE.md says, that only proves the code builds; it never runs the suite. #131 touched _test.go and added Windows-specific validation, so it was exactly the case the label exists for.

This PR carries ci:os, so the real Windows and macOS runners have to go green before it merges.

Testing

  • gofmt -l ., go vet ./..., go test -race ./... — 22 packages
  • cross-compile build + vet for linux, darwin, windows
  • cd frontend && ./node_modules/.bin/vite build

No CHANGELOG.md entry: v0.24.0 never published, so no released version ever carried this, and the behaviour change it does contain — an error instead of an empty list when a file occupies the themes directory path — is not a state a user reaches.

Two tests failed on the Windows runner from the moment internal/themes landed,
so main has been red since. Neither is a Windows bug in the feature; both are
the suite making a Linux assumption.

TestListReturnsDirectoryError expected List to fail when a regular file sits
where the themes directory belongs. On Windows, ReadDir on that file reports
not-exist, which the "nothing imported yet" branch swallowed into an empty
list — so the same state was an error on one OS and silence on another. This
changes the product rather than the test: customThemes stats the path first and
says outright that it is not a directory, which reads the same everywhere.

TestDocumentedExampleIsImportable located the documented JSON by a fence
followed by a bare \n. The repo pins no .gitattributes, so a Windows checkout
carries CRLF and the pattern matched nothing. The pattern now takes either
ending, and a test feeds it both so the assumption cannot come back unnoticed.

Neither test ran on either pull request that introduced them: os-tests only
runs on a push to main or under the ci:os label, and cross-compiling — which
both changes did pass — only proves the code builds.
@omartelo omartelo added the ci:os Runs the backend suite on Windows and macOS runners label Aug 4, 2026
@omartelo
omartelo merged commit 4600724 into main Aug 4, 2026
7 checks passed
@omartelo
omartelo deleted the fix/windows-theme-tests branch August 4, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:os Runs the backend suite on Windows and macOS runners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant