Skip to content

fix(ci): resolve macOS and Windows test failures in release builds#352

Merged
rhuanbarreto merged 5 commits into
mainfrom
fix/release-binaries-multiplatform-tests
May 25, 2026
Merged

fix(ci): resolve macOS and Windows test failures in release builds#352
rhuanbarreto merged 5 commits into
mainfrom
fix/release-binaries-multiplatform-tests

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Fix 7 macOS test failures caused by /var/private/var symlink path mismatch in temp dirs
  • Fix 1 Windows test timeout caused by bare bun test (5s default) instead of bun run test (60s)
  • Make resolveCommand PATH tests resilient to macOS ARM64 CI runners where Bun.which returns null for proto-installed shims

These failures appeared in v0.38.0 and v0.39.0 release builds but were invisible in PR CI (ubuntu-only).

What changed

File Change
.github/workflows/release-binaries.yml bun testbun run test on Windows validate step
tests/commands/session-context/*.test.ts (4 files) Wrap mkdtempSync with realpathSync to normalize macOS symlink paths
tests/commands/adr/import.test.ts Same realpathSync fix for both tempDir and upstreamDir
tests/helpers/platform.test.ts test.skipIf guards when Bun.which can't find bun/git on PATH

Root causes

  1. macOS /var symlink: mkdtempSync(join(tmpdir(), ...)) returns /var/folders/... but process.cwd() after chdir() resolves the symlink to /private/var/folders/.... Tests comparing tempDir against findProjectRoot() output fail because the paths differ.

  2. Bun.which on macOS ARM64 CI: When tools are installed via proto toolchain shims (not direct PATH binaries), Bun.which("bun") and Bun.which("git") return null. Production code handles this gracefully but tests that assert non-null results fail.

  3. Windows test timeout: The package.json test script includes --timeout 60000, but bare bun test uses Bun's default 5s timeout. Session-context tests that perform filesystem I/O exceed 5s on Windows CI runners.

Test plan

  • bun run validate passes locally (1199 pass, 15 skip, 0 fail, 27/27 ADR checks)
  • Release build succeeds on macOS ARM64 (verifiable after merge by re-running release-binaries.yml)
  • Release build succeeds on Windows (same)

The v0.38.0 and v0.39.0 release builds failed on macOS (7 tests) and
Windows (1 test) while PR CI (ubuntu-only) passed green.

Root causes:

1. macOS `/var` → `/private/var` symlink: `mkdtempSync` returns
   `/var/folders/…` but `process.cwd()` after `chdir()` resolves
   the symlink, causing path mismatches in session-context and
   import tests. Fix: wrap `mkdtempSync` with `realpathSync`.

2. macOS `Bun.which()` returns null for proto shims: on ARM64
   runners where bun/git are installed via proto, `Bun.which`
   can't find them. Fix: `test.skipIf` guards on PATH-presence
   tests.

3. Windows timeout: `bun test` (5s default) vs `bun run test`
   (60s from package.json). Fix: use `bun run test` in the
   release-binaries workflow Windows step.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 25, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: d456163
Status: ✅  Deploy successful!
Preview URL: https://eaa19d36.archgate-cli.pages.dev
Branch Preview URL: https://fix-release-binaries-multipl.archgate-cli.pages.dev

View logs

@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.2% (6536 / 7246)
Threshold 90% minimum — met
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.1% 2069 / 2348
src/engine/ 93.1% 1207 / 1297
src/formats/ 100.0% 141 / 141
src/helpers/ 90.1% 3119 / 3460

The "finds bun on PATH" and "finds git on PATH" tests assert CI
environment state, not application logic. They fail on macOS ARM64
runners where proto shims make Bun.which return null. Remove them
entirely — the non-existent command and WSL fallback tests already
cover resolveCommand's actual behavior.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Remove tests that assert CI environment state rather than code logic:

- platform.test.ts: drop "runtime matches process.platform" (tautological),
  "isWindows/isMacOS/isLinux matches process.platform" (mirrors runner OS),
  "isSupportedPlatform returns true" (same), and two isWSL/wslDistro
  tests that were no-ops on Linux (wrapped in if-guards, not test.skipIf).

- git.test.ts: rewrite with mocked Bun.which to test actual installGit
  logic (fast path, slow path fallback) instead of asserting git exists.

Tag isLinux() as @public since it's part of the platform helper API
but has no runtime consumers yet (knip would flag it otherwise).

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
…m gates

Replace `if (process.platform !== ...) return` patterns with
`test.skipIf(...)` across platform.test.ts, binary-upgrade.test.ts,
tls.test.ts, and git.test.ts. This makes skipped tests visible in
the test runner output instead of silently passing with no assertions.

Split if/else branching tests (getManualInstallHint, tlsHintMessage)
into separate test.skipIf tests for each platform branch.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto merged commit b28d823 into main May 25, 2026
11 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/release-binaries-multiplatform-tests branch May 25, 2026 21:19
@archgatebot archgatebot Bot mentioned this pull request May 25, 2026
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.

1 participant