fix: make drift output and global config cross-platform (Windows)#78
Merged
theDakshJaitly merged 2 commits intoJun 18, 2026
Merged
Conversation
The new telemetry/feedback/drift code was only exercised on Linux CI, so several Windows-only bugs slipped through: - Path output used native separators. relative()/glob return `\` on Windows, but drift issue `file` fields, heartbeat staleFiles, scanner entry paths, and event-log entries are forward-slash contracts (printed, JSON-serialized, consumed by mex-agent). The broken-link/path `patterns/` severity check (`source.includes(patterns/)`) silently misfired on Windows. Added src/paths.ts `toPosix()` and applied it at every boundary. - mexHomeDir() relied on homedir(), which ignores $HOME on Windows (reads USERPROFILE). Added a cross-platform MEX_HOME override so the global config / telemetry-id can be isolated and relocated. Tests: - telemetry/feedback suites now isolate via MEX_HOME instead of $HOME. - dev-repo guard tests chdir out before rmSync (Windows can't delete cwd). - gated the POSIX 0o600 mode assertion to non-Windows (NTFS has no mode bits). All 231 tests pass on Windows and remain green on POSIX. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
What
Makes mex's drift output, global config, and test suite work correctly on
Windows. Previously the new telemetry/feedback/drift code was only exercised
on Linux CI, so several Windows-only bugs slipped through.
Source fixes:
relative()/globreturn\on Windows, but driftissue
filefields, heartbeatstaleFiles, scanner entry paths, andevent-log entries are forward-slash contracts (printed, JSON-serialized,
consumed by mex-agent). The broken-link/path
patterns/severity check(
source.includes("patterns/")) silently misfired on Windows, producing thewrong severity. Added
src/paths.tstoPosix()and applied it at everyboundary.
mexHomeDir()relied onhomedir(), which ignores$HOMEon Windows (it readsUSERPROFILE). Added a cross-platformMEX_HOMEoverride so the global config / telemetry-id can be isolated andrelocated.
Test fixes:
MEX_HOMEinstead of$HOME.chdirout beforermSync(Windows can't delete the cwd).0o600mode assertion to non-Windows (NTFS has no mode bits).Why
On Windows the suite had 16 failing tests, and two were genuine product bugs
(not just test issues): drift severity for
patterns/files was computedincorrectly, and the global config/telemetry-id were written to the wrong
directory. Linux CI could never catch these. This makes mex behave identically
across platforms.
Type of change
How to test
npm installthennpm test→ all 231 tests pass(previously 16 failed across
telemetry,feedback,heartbeat,scanner, andcheckers).npm test→ still all green (no behavior change on POSIX).mex drifton a project with apatterns/*.mdfile containing a broken link → it's reported as a warning (not an
error) on every OS.
Checklist
npm test)