Skip to content

test: resolve temp roots to the long path on native Windows - #870

Merged
jeff-r2026 merged 2 commits into
Tencent:mainfrom
Jay0130-a:test/windows-realpath-native
Sep 30, 2026
Merged

jeff-r2026 merged 2 commits into
Tencent:mainfrom
Jay0130-a:test/windows-realpath-native

Conversation

@Jay0130-a

Copy link
Copy Markdown
Contributor

Summary

43 test files build their temp root with realpathSync(mkdtempSync(join(os.tmpdir(), …))) so that macOS's /tmp → /private/tmp aliasing matches the realpath the code under test takes. On native Windows that intent breaks: os.tmpdir() yields the 8.3 short form (C:\Users\ADMINI~1\AppData\Local\Temp), and realpathSync hands it back unchanged, while the code under test returns the long path — so every equality between the two fails.

Switching those call sites to realpathSync.native resolves the short name to the long one on Windows. On Linux and macOS .native is the platform's realpath, so nothing changes there.

No production code is touched.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds what users expect)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

Measured on native Windows 10, Node v24.18.0, with the full npx vitest run suite:

failed assertions failed files
before 284 55
after 192 48

8 files go from red to fully green — anchors, config-not-initialized, detect-subdir, dry-run-load-path, migrate, p3-functionize, self-worktree-rebind, viz-foreign-checkout — and no file regresses from green to failing.

  • npx tsc --noEmit passes

  • npm run lint passes (681 files, 96 rules)

  • npx vitest run passes — not on this platform: 192 failures remain, and they have two other causes that this change deliberately leaves alone (see Notes)

  • Added/updated tests for the change — no new tests; the change is to the existing test harness itself

  • This PR does not involve the above items

Related Issues

None filed yet. Happy to open one covering the whole "native Windows" gap if maintainers prefer that sequencing.

Notes for Reviewers

  • CI has no windows-latest job (the matrix is ubuntu-latest + macos-latest), which is why this class of failure stays invisible upstream.
  • The two remaining Windows clusters are not test-harness path noise and are out of scope here:
    • api-key.test.ts, config-atomic-save.test.ts and scope.test.ts assert POSIX modes (0o600 / 0o644) and observe 0o666. On Windows chmod cannot restrict an ACL, so this is a product-level question about how the API key file gets protected there — not something to paper over by loosening an assertion.
    • votes-scope.test.ts has cases that hit the 15s test timeout, which looks like a separate subprocess-behavior difference.
  • Per AGENTS.md, this is a tests-only change, so no real-CLI end-to-end record is attached.

@jeff-r2026 jeff-r2026 self-assigned this Sep 28, 2026
@github-actions

Copy link
Copy Markdown

No findings.

The PR is tests-only, and the description documents sufficient Windows test evidence plus type-check and lint results. A real-CLI end-to-end record is not required under the repository’s review rules.

@github-actions

Copy link
Copy Markdown

No findings.

The previous review remains valid: the diff is tests-only, changes are consistently scoped to Windows path canonicalization, and the PR description provides sufficient native Windows test evidence plus type-check and lint results. A real-CLI end-to-end record is not required.

@Jay0130-a

Copy link
Copy Markdown
Contributor Author

Added one commit: local-agent.test.ts built its temp root with a bare fse.mkdtemp(os.tmpdir()) — it never went through realpath at all, so the mechanical sweep could not reach it, and that file's 13 short-name assertions still failed. Wrapping it in realpathSync.native takes the file from 17 failing to 2.

Measured: with the first commit the native-Windows suite was at 192 failing assertions across 48 files (down from 284 / 55 on main), with no file regressing from green to red. This commit removes 15 of those 192; the failing-file count stays 48 because two cases remain in the file.

Those two are the separate Windows problem, not a path problem: they assert 0o600 and observe 0o666, because chmod cannot restrict an ACL there. Same root cause as the api-key / config-atomic-save / scope failures, and not something worth silencing by loosening an assertion — it looks like a real product gap that deserves its own issue.

npx tsc --noEmit and npm run lint (oxlint --type-aware) are clean on the branch.

@jeff-r2026
jeff-r2026 merged commit 4a87fe5 into Tencent:main Sep 30, 2026
12 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Oct 28, 2026
Tencent#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (Tencent#870); this one now does too.
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Oct 28, 2026
Tencent#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (Tencent#870); this one now does too.
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Oct 28, 2026
Tencent#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (Tencent#870); this one now does too.
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Oct 28, 2026
Tencent#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (Tencent#870); this one now does too.
jeff-r2026 pushed a commit that referenced this pull request Oct 28, 2026
…y gate on Windows (#1504) (#1521)

* test(ci): forget a pid the runner cannot signal, and run the CodeBuddy gate on Windows (#1504)

Two parts of #1504, both test-side:

- `detached-processes.ts` rethrew every error but `ESRCH` from the pid probe.
  On macOS a pid the kernel recycled to another user's process answers `EPERM`,
  and the teardown failed the whole file. `EPERM` means the pid is not teamai's
  child any more, so it is forgotten like `ESRCH`.
- The Windows job ran only the unit list, so the CodeBuddy project gate
  (#1494) was verified only on contributors' machines. Its e2e file already
  carries the `cmd.exe` branch, so the job runs it now.

* test(ci): give the CodeBuddy gate e2e the long temp path Windows needs (#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (#870); this one now does too.

---------

Co-authored-by: wangchongfei <[email protected]>
Walternater added a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
Tencent#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (Tencent#870); this one now does too.
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
)

* test: resolve temp roots to the long path on native Windows

* test: canonicalize the local-agent temp root as well

---------

Co-authored-by: Jay0130-a <[email protected]>
Walternater added a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…y gate on Windows (Tencent#1504) (Tencent#1521)

* test(ci): forget a pid the runner cannot signal, and run the CodeBuddy gate on Windows (Tencent#1504)

Two parts of Tencent#1504, both test-side:

- `detached-processes.ts` rethrew every error but `ESRCH` from the pid probe.
  On macOS a pid the kernel recycled to another user's process answers `EPERM`,
  and the teardown failed the whole file. `EPERM` means the pid is not teamai's
  child any more, so it is forgotten like `ESRCH`.
- The Windows job ran only the unit list, so the CodeBuddy project gate
  (Tencent#1494) was verified only on contributors' machines. Its e2e file already
  carries the `cmd.exe` branch, so the job runs it now.

* test(ci): give the CodeBuddy gate e2e the long temp path Windows needs (Tencent#1504)

The Windows job runs the gate's e2e file now, and the file failed there:
Windows hands out a short 8.3 temp path, and a path the CLI resolves later
does not match that spelling, so the project scope was not found at all. Every
other temp root takes the long path (Tencent#870); this one now does too.

---------

Co-authored-by: wangchongfei <[email protected]>
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