Skip to content

fix: make drift output and global config cross-platform (Windows)#78

Merged
theDakshJaitly merged 2 commits into
mex-memory:mainfrom
Yashasvi2229:fix/windows-cross-platform-support
Jun 18, 2026
Merged

fix: make drift output and global config cross-platform (Windows)#78
theDakshJaitly merged 2 commits into
mex-memory:mainfrom
Yashasvi2229:fix/windows-cross-platform-support

Conversation

@Yashasvi2229

Copy link
Copy Markdown
Contributor

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:

  • Path 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, producing the
    wrong severity. Added src/paths.ts toPosix() and applied it at every
    boundary.
  • Home dir resolution. mexHomeDir() relied on homedir(), which ignores
    $HOME on Windows (it reads USERPROFILE). Added a cross-platform
    MEX_HOME override so the global config / telemetry-id can be isolated and
    relocated.

Test fixes:

  • telemetry/feedback suites now isolate via MEX_HOME instead of $HOME.
  • dev-repo guard tests chdir out before rmSync (Windows can't delete the cwd).
  • gated the POSIX 0o600 mode 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 computed
incorrectly, 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

  • Bug fix
  • New feature
  • Refactor
  • Docs
  • CI/Tooling

How to test

  1. On Windows, run npm install then npm test → all 231 tests pass
    (previously 16 failed across telemetry, feedback, heartbeat,
    scanner, and checkers).
  2. On macOS/Linux, run npm test → still all green (no behavior change on POSIX).
  3. Spot-check the path fix: run mex drift on a project with a patterns/*.md
    file containing a broken link → it's reported as a warning (not an
    error) on every OS.

Checklist

  • Tests pass (npm test)
  • No breaking changes (or documented below)
  • Tested locally with a real project

Yashasvi2229 and others added 2 commits June 15, 2026 14:09
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>

@theDakshJaitly theDakshJaitly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@theDakshJaitly theDakshJaitly merged commit 2da79d2 into mex-memory:main Jun 18, 2026
2 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