pingdotgg / pingdotgg/t3code

test(server): entrypoint symlink case asserts unrealpath'd module URL — fails on macOS (/var → /private/var)

Open Beginner friendly
#9,389 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
23k
Forks
5.9k
Avg merge
11h 14m
Merged PRs (30d)
357

Description

apps/server/src/entrypoint.test.ts"matches through a symlinked entrypoint, as npm and npx install it" fails deterministically on macOS.

The test does:

const dir = mkdtempSync(join(tmpdir(), "t3-entrypoint-test-"));
const real = join(dir, "bin.mjs");
const link = join(dir, "t3");
writeFileSync(real, "");
symlinkSync(real, link);
expect(isEntrypoint({ moduleUrl: pathToFileURL(real).href, entryPath: link, runtimeMain: undefined })).toBe(true);

The implementation (entrypoint.ts:34) compares moduleUrl === pathToFileURL(realpathSync(entryPath)).href. On macOS $TMPDIR is under /var/folders/… and /var is a symlink to /private/var, so realpathSync(entryPath) resolves to /private/var/folders/…/bin.mjs while pathToFileURL(real).href stays /var/folders/…/bin.mjs — the strings can never be equal, so the assertion gets false instead of true.

The product code is correct: canonicalizing the entry path is exactly what makes npm/npx-style symlinked entrypoints match. The fixture is what needs the realpath — e.g. pathToFileURL(realpathSync(real)).href, or realpath the temp dir when creating it — so the test isolates the symlink resolution it intends to exercise from macOS's own /var/private/var symlink. Linux CI is unaffected, which is why this only surfaces running the suite locally on macOS.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/server/src/entrypoint.test.ts and the test named "matches through a symlinked entrypoint, as npm and npx install it"; compare its temporary-path fixture with entrypoint.ts:34 and the existing isEntrypoint behavior. Run the focused test on macOS, then confirm the fixture passes while preserving the symlink-resolution assertion and remaining green on Linux.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.