From 8b5981c57450d5ef3bf90b3daffa1fdbb5de6c91 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Fri, 24 Jul 2026 21:45:37 -0700 Subject: [PATCH] test: guard the bundled-plugin LF pin against a CRLF checkout The byte-hash mismatch only surfaced in Windows packaging CI. Assert the .gitattributes pin and that a CRLF tree is rejected, so a regression fails on any platform instead of waiting for a packaged Windows build. Co-authored-by: Orca --- .../verify-packaged-plugin-resources.test.mjs | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/config/scripts/verify-packaged-plugin-resources.test.mjs b/config/scripts/verify-packaged-plugin-resources.test.mjs index 3203905ea82..77927a050f0 100644 --- a/config/scripts/verify-packaged-plugin-resources.test.mjs +++ b/config/scripts/verify-packaged-plugin-resources.test.mjs @@ -1,4 +1,4 @@ -import { cp, mkdtemp, rm, writeFile } from 'node:fs/promises' +import { cp, mkdtemp, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises' import { createRequire } from 'node:module' import { tmpdir } from 'node:os' import { join } from 'node:path' @@ -42,4 +42,34 @@ describe('verify packaged plugin resources', () => { await rm(resourcesDir, { recursive: true, force: true }) } }) + + // The tree is hashed by raw bytes, so a CRLF checkout on Windows breaks the + // pinned hash. These two guard the `.gitattributes` eol=lf pin that prevents it. + it('pins the launch tree to LF so Windows checkouts hash identically', async () => { + const attributes = await readFile(join(process.cwd(), '.gitattributes'), 'utf8') + expect(attributes).toContain('/resources/plugins/** text eol=lf') + }) + + it('rejects a CRLF checkout of the launch tree', async () => { + const resourcesDir = await mkdtemp(join(tmpdir(), 'orca-packaged-plugins-')) + try { + const launchRoot = join(resourcesDir, 'plugins', 'launch') + await cp(join(process.cwd(), 'resources', 'plugins', 'launch'), launchRoot, { + recursive: true + }) + for (const entry of await readdir(launchRoot, { recursive: true })) { + const path = join(launchRoot, entry) + if (!(await stat(path)).isFile()) { + continue + } + await writeFile(path, (await readFile(path, 'utf8')).replace(/\r?\n/g, '\r\n')) + } + + expect(() => verifyPackagedPluginResources(resourcesDir)).toThrow( + 'packaged bytes do not match stablyai.orca-navigation-shortcuts' + ) + } finally { + await rm(resourcesDir, { recursive: true, force: true }) + } + }) })