Skip to content

fix(e2e): canonicalize temp repo paths so golden tests pass on macOS - #6718

Merged
nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/fix-golden-e2e-macos-symlink
Jun 29, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/fix-golden-e2e-macos-symlink

Conversation

@nwparker

@nwparker nwparker commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The golden release E2E tests fail deterministically on macOS with Expected e2e repo to be loaded / repo did not load. This is a test bug, not an app regression — the app behavior is correct; the tests just assert on the wrong path form.

Root cause

  • PR fix: root monorepo subfolder imports at the git repo while keeping the first terminal in the subfolder (#6336) #6574 (adcf74a9fb) made repos:add store repo.path = getGitRepoRoot(path), which runs git rev-parse --show-toplevel. That resolves symlinks.
  • On macOS, os.tmpdir() returns /var/folders/..., which is a symlink to /private/var/folders/.... So the app stores the canonical /private/var/... path, while the tests create the repo under /var/... and assert with strict candidate.path === rawPath equality → never matches.
  • It passes on Linux CI (/tmp is not a symlink) but fails on the macOS golden job, which is why the release looked green on Linux but the golden gate failed.

The getGitRepoRoot canonicalization is intentional, correct production behavior (it fixes monorepo-subfolder imports, #6336/#6574). In production the native folder picker returns already-canonical paths, so users never hit this — it only surfaces because the tests use os.tmpdir(), which returns the /var symlink.

Fix

Wrap the temp-repo / parent-dir creation in realpathSync at every site that later asserts on the store's canonicalized path. This mirrors the existing convention already used in combined-diff-scroll-restore.spec.ts:51 and large-diff-repro-fixtures.ts:23.

Sites covered:

File Why
golden-core-flows.spec.ts (createGitRepo) golden gate — repo.path === targetPath
global-setup.ts + helpers/orca-app.ts (createSeededTestRepo) seeded fixture used by the terminal golden suite and other specs
add-project-default-checkout.spec.ts repo.path === mainPath (linked-worktree fixture)
folder-setup.spec.ts group-import projectPaths.includes(repo.path) + group.parentPath === parentPath
folder-setup-shallow-priority.spec.ts repo.path === webClientPath/apiPath/webPath + group.parentPath === parentPath

The last three were hardened proactively: they exercise the same canonicalize-on-import path and would exhibit the same latent macOS mismatch if run on the macOS job.

Verification (local, macOS)

  • golden-core-flows.spec.ts — 5/5 clean runs, 0 crashes
  • test:e2e:terminal-rendering-golden — 2/2 pass
  • add-project-default-checkout.spec.ts — 2/2 pass
  • folder-setup.spec.ts — 2/2 pass
  • folder-setup-shallow-priority.spec.ts — 2/2 pass

Root cause + fix correctness independently confirmed by an adversarial review agent (high confidence).


Known follow-up (NOT addressed here, non-blocking)

During the original failing run, the app once hit a native FATAL ERROR / SIGABRT in @parcel/watcher's getIgnoreGlobs during teardown:

FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
 getIgnoreGlobs(...)  [@parcel/watcher-darwin-arm64/watcher.node]
 PromiseRunner::onWorkComplete
 napi_async_cleanup_hook_handle__::Hook -> uv__work_done -> Environment::CleanupHandles

Assessment (verified, high confidence): this is a latent abnormal-shutdown teardown race in the main-thread worktree-base watcher (src/main/ipc/worktree-base-directory-watcher.ts — the only subscription using glob ignores, so the only one that reaches getIgnoreGlobs). It fires only when the process begins freeing the Node environment with an inflight @parcel/watcher subscribe/unsubscribe still queued — i.e. when the app is torn down abnormally mid-watch (as happened when the repo-load assertion failed). It did not recur across 5 subsequent clean runs, because the normal will-quit path already preventDefault()s and awaits shutdownWatchersOnce() before exiting.

It is not a user-facing regression and should not block the release. Suggested follow-up: harden the abnormal-exit path so an inflight glob-watch op can't fault during env teardown (e.g. a best-effort drain/guard equivalent to the worker watcher's). Happy to open a separate issue/PR for this.

🤖 Generated with Claude Code

Made with Orca 🐋

The golden release E2E tests (golden-core-flows + the seeded terminal
golden suite) fail deterministically on macOS with "Expected e2e repo to
be loaded". Root cause is a test bug, not an app regression:

- PR stablyai#6574 made repos:add store repo.path = getGitRepoRoot(path), which
  runs `git rev-parse --show-toplevel` and resolves symlinks.
- On macOS os.tmpdir() returns /var/... which symlinks to /private/var/...,
  so the app stores the canonical /private/var/... path while the tests
  assert on the raw /var/... path via strict `=== repoPath` equality.
- It passes on Linux CI (/tmp is not a symlink) but fails on the macOS
  golden job.

Fix: wrap the temp-repo/parent creation in realpathSync at every site that
later asserts on the store's canonicalized path. This mirrors the existing
convention in combined-diff-scroll-restore.spec.ts and
large-diff-repro-fixtures.ts.

Covered sites:
- golden-core-flows.spec.ts (createGitRepo)
- global-setup.ts + helpers/orca-app.ts (seeded fixture used by the
  terminal golden suite and other specs)
- add-project-default-checkout.spec.ts (linked/clone fixtures)
- folder-setup.spec.ts + folder-setup-shallow-priority.spec.ts (group
  import path/parentPath assertions)

Verified locally on macOS: golden-core-flows 5/5 clean runs, terminal
golden 2/2, and all hardened specs pass individually.
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2e91befc-2e34-48fa-a952-292d9c0c8f52

📥 Commits

Reviewing files that changed from the base of the PR and between ffe50ad and 0a01274.

📒 Files selected for processing (6)
  • tests/e2e/add-project-default-checkout.spec.ts
  • tests/e2e/folder-setup-shallow-priority.spec.ts
  • tests/e2e/folder-setup.spec.ts
  • tests/e2e/global-setup.ts
  • tests/e2e/golden-core-flows.spec.ts
  • tests/e2e/helpers/orca-app.ts

📝 Walkthrough

Walkthrough

Across all e2e test fixture files, the fs imports are updated to include realpathSync, and every temporary directory path produced by mkdtemp/mkdtempSync is now wrapped with realpathSync(...) before use. This applies to global-setup.ts, helpers/orca-app.ts, and the spec files add-project-default-checkout.spec.ts, folder-setup-shallow-priority.spec.ts, folder-setup.spec.ts, and golden-core-flows.spec.ts. Inline comments are added explaining macOS tmpdir symlink behavior.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning It includes a detailed Summary, but misses most required template sections: Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing template sections, including screenshots or 'No visual change', testing checklist/results, cross-platform AI review, security audit, and notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing macOS E2E failures by canonicalizing temp repo paths.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 63e96db into stablyai:main Jun 29, 2026
4 checks passed
@nwparker
nwparker deleted the nwparker/fix-golden-e2e-macos-symlink branch June 29, 2026 08:24
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