fix(core): make the API skill and cd worktree tests pass on Windows (#66115)

Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
This commit is contained in:
opencodejr[bot] 2026-11-24 10:19:10 -05:00 • committed by GitHub
parent af54caef70
commit 66d53a82d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

2
.gitattributes vendored
View file

@ -23,6 +23,8 @@ packages/cli-rs/crates/ui/src/keymap/generated.rs linguist-generated
packages/cli-rs/crates/ui/src/theme/generated/** linguist-generated
packages/cli-rs/crates/util/fixtures/time.tsv linguist-generated
packages/core/src/**/*.txt text eol=lf
# test/opencode-api-skill.test.ts compares the generated API reference byte for byte, so Windows checkouts keep LF.
packages/core/src/plugin/skill/opencode/** text eol=lf
packages/httpapi-codegen/test/generated/*.ts text eol=lf
# The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF.
services/site/** text=auto eol=lf

View file

@ -4,7 +4,10 @@ import { directory, render } from "../script/generate-api-skill"
test("the opencode skill's API reference matches openapi.json", async () => {
const files = await render()
const current = await Array.fromAsync(new Bun.Glob("**/*.md").scan({ cwd: directory }))
// Bun.Glob yields native separators, so Windows lists `api\session.md` where render() keys `api/session.md`.
const current = (await Array.fromAsync(new Bun.Glob("**/*.md").scan({ cwd: directory }))).map((file) =>
file.split(path.sep).join("/"),
)
expect(current.toSorted()).toEqual(Object.keys(files).toSorted())
for (const [file, content] of Object.entries(files)) {
// Run `bun run generate` from packages/protocol (or `bun run generate:api-skill` from packages/core) when this fails.

View file

@ -344,7 +344,9 @@ describe("CdTool", () => {
// On a sandboxed workspace Location, a sandbox path matching a host worktree path must still prompt.
const sandboxAssertions: Permission.AssertInput[] = []
const memory = makeMemoryDriver()
const sandboxWorktreePath = AbsolutePath.make("/outside-wt")
// A sandboxed Location resolves plain paths with the host's path rules (`D:\outside-wt` on Windows), so create
// the directory where that resolution lands for the memory driver to find it.
const sandboxWorktreePath = AbsolutePath.make(path.resolve("/outside-wt"))
yield* memory.overrides!.mkdir!(sandboxWorktreePath)
const wrkID = Workspace.ID.make("wrk_wt_test")
const sandboxLayer = buildLayer({