fix(desktop): make lint and unit-test gates work on Windows#2943
Open
TheSeydiCharyyev wants to merge 1 commit into
Open
fix(desktop): make lint and unit-test gates work on Windows#2943TheSeydiCharyyev wants to merge 1 commit into
TheSeydiCharyyev wants to merge 1 commit into
Conversation
The desktop quality gate does not work on a Windows checkout: two checks pass without examining anything, one fails on every file, and one reports violations its own allowlist already covers. pnpm test quoted the test glob with single quotes. On Windows pnpm runs scripts through cmd.exe, which does not strip them, so node received the quotes literally and matched no files - reporting 0 tests with exit code 0, a silent green. Double quotes are stripped by cmd.exe and POSIX shells alike, so CI behaviour on Linux is unchanged. With no .gitattributes, core.autocrlf=true (the Git for Windows default) checks every text file out as CRLF. Biome formats with LF, so biome check failed on 1632 of 1633 files, and virtuaWheelModePatch.test.mjs, which matches patches/*.patch with newline-joined patterns, failed with it. The stored blobs are already LF, so pinning eol=lf causes no renormalisation churn. check-px-text-core and check-file-sizes-core compare path.relative output against roots and allowlist keys authored with forward slashes. On Windows the separator is a backslash, so the px-text allowlist never matched (5 false violations) and findRule matched no rule at all: check:file-sizes examined 0 of 1097 files and still exited 0. check-pubkey-truncation-core already normalises the same way; this applies it to the other two. After the change the Windows run agrees with CI - check:file-sizes reports the same runtime.rs violation main is currently failing on. Desktop unit tests still fail on Windows until block#2758 lands; this stops hiding those failures rather than fixing them. Signed-off-by: Seydi Charyyev <seydi.charyev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a Windows checkout the desktop quality gate does not work. This fixes four defects in it. Two checks report success without examining anything, one fails on every file, and one reports violations that its own allowlist already covers.
1.
pnpm testfinds no tests and still exits 0. Thetestscript quotes the glob with single quotes. On Windows pnpm runs scripts throughcmd.exe, which does not strip single quotes, so node receives them as part of the pattern and matches nothing. The run prints# tests 0and exits 0 — a silent green. Double quotes are stripped bycmd.exeand by POSIX shells alike, so Linux CI behaviour is unchanged.2. Every text file is checked out as CRLF. There is no
.gitattributes, andcore.autocrlf=trueis the Git for Windows default. Biome formats with LF, sobiome check .fails on 1632 of 1633 files.desktop/src/features/messages/ui/virtuaWheelModePatch.test.mjsfails too, because it matchespatches/*.patchwith\n-joined patterns. The stored blobs are already LF, soeol=lfadds no renormalisation churn —git statusstays clean after the change.3.
check:px-textnever finds its own allowlist.scripts/check-px-text-core.mjsbuilds the key frompath.relative, which returns\separators on Windows, while the allowlist indesktop/scripts/check-px-text.mjsis written with/. Nothing matches, so the check reports 5 false violations on a clean tree.4.
check:file-sizesexamines nothing at all.findRulecompares against`${rule.root}${path.sep}`. The roots are multi-segment (src/app,src/features,src-tauri/src), so on Windowssrc/app\never matchessrc\app\.... No rule matches any file: the check walks 0 of 1097 files and exits 0.scripts/check-pubkey-truncation-core.mjsalready normalises paths this way (relativePath.split(path.sep).join("/")). This applies the same idiom to the other two.Related issue
None found — no open issue covers this. The closest open PR is #2758, which fixes a fifth Windows defect in
desktop/test-loader-hooks.mjs; it is required before the desktop unit tests can pass here, and it does not overlap with these files. I checked the changed-file list of every open PR: none touch.gitattributes,desktop/package.json,scripts/check-px-text-core.mjsorscripts/check-file-sizes-core.mjs.Testing
Windows 11 (10.0.26200), node 22.17.1, pnpm 11.4.0, clean checkout with the default
core.autocrlf=true.pnpm test# tests 0, exit 0biome check .pnpm check:px-textpnpm check:file-sizescheck:file-sizesnow reportssrc-tauri/src/managed_agents/runtime.rs: 2220 lines (limit 2216). That violation is pre-existing and not introduced here —maincurrently fails on the same line in CI (Desktop Core, run 30185213010, commit c2a4ee7). Before this change Windows reported success while CI was red; now the Windows result agrees with CI.Desktop unit tests still fail on Windows until #2758 lands. With #2758 applied on top of this branch the full suite passes: 3515 tests, 0 failures. This change stops hiding those failures rather than fixing them.