Skip to content

fix: Windows cross-platform compatibility#31

Open
bilersan wants to merge 1 commit intoActiveMemory:mainfrom
bilersan:feat/windows-compat
Open

fix: Windows cross-platform compatibility#31
bilersan wants to merge 1 commit intoActiveMemory:mainfrom
bilersan:feat/windows-compat

Conversation

@bilersan
Copy link
Contributor

@bilersan bilersan commented Mar 7, 2026

Summary

Fixes #30 — Windows cross-platform compatibility.

This PR makes ctx build and test cleanly on Windows by addressing 5 runtime issues and fixing 50+ test failures across 13 test files.

Merge Order

Merge second — standalone, no dependencies. But merge before #36 to avoid conflicts.
Suggested order: #29#31#36

Runtime Changes (5 files)

File Fix
validation/path.go Case-insensitive boundary checks on Windows
memory/discover.go Platform-independent project slugs via filepath
recall/parser/path.go Forward slashes only for session path operations
journal/core/generate.go Normalize source links and nav paths to forward slashes
site/cmd/feed/run.go Use config.NewlineLF / config.ExtMarkdown

Test Changes (13 files)

  • USERPROFILE env var — Set alongside HOME in 50+ test functions across 10 files (os.UserHomeDir reads USERPROFILE on Windows)
  • APPDATA env var — Set in recall tests (XDG fallback reads APPDATA on Windows)
  • setLocalUTC helper — Replaces t.Setenv("TZ", "UTC") which has no effect on Windows
  • Binary suffix — .exe on Windows for test binary lookup
  • Platform PATH separator — ; on Windows vs : on Unix
  • .bat fake binaries — Windows equivalent of #!/bin/sh scripts in test setup
  • os.TempDir() — Instead of hardcoded /tmp/
  • t.TempDir() + filepath.ToSlash — Instead of hardcoded /home/user/... paths
  • Permission skips — Skip Unix-only file permission tests on Windows

Testing

  • go build ./... — clean
  • go test ./... — all pass except pre-existing deps/core failures (file handle cleanup issue unrelated to this PR)

Runtime fixes:
- validation/path.go: case-insensitive boundary checks on Windows
  (VS Code lowercases drive letters, EvalSymlinks uppercases)
- memory/discover.go: platform-independent project slugs with
  filepath.ToSlash and Windows drive prefix stripping
- recall/parser/path.go: use forward slashes consistently for
  session path operations (not platform separator)
- journal/core/generate.go: normalize source links and nav paths
  to forward slashes
- site/cmd/feed/run.go: use config.NewlineLF and config.ExtMarkdown
  constants; use Println for cross-platform line endings

Test fixes:
- Set USERPROFILE alongside HOME in 50+ test functions across 10
  files (os.UserHomeDir reads USERPROFILE on Windows)
- Set APPDATA in recall tests (XDG fallback reads APPDATA on Windows)
- recall/core/format_test.go: replace t.Setenv TZ with setLocalUTC
  helper (TZ env var does not affect time.Local on Windows)
- cli_test.go: append .exe suffix on Windows for test binary
- serve_test.go: use os.TempDir, .bat fake binaries, platform PATH
  separator
- pad_test.go: skip file permission test on Windows; use
  filepath.Separator in path assertions
- crypto_test.go: skip Unix permission check on Windows
- journal/core/generate_test.go: use t.TempDir with filepath.ToSlash
  instead of hardcoded Unix paths

Signed-off-by: ersan bilik <ersanbilik@gmail.com>
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.

Windows cross-platform compatibility fixes

1 participant