make the test suite and openapi generator platform-independent

Windows checkouts turned LF into CRLF (core.autocrlf=true), and several
tests plus the openapi generator hardcoded LF or POSIX path separators.
The result was a suite that was green on Linux CI but red on Windows, and
an openapi.json whose /api/hermes/* routes silently disappeared when
generated on Windows.

Pin the repository to LF via .gitattributes, strip shebangs before
Vite's SSR transform, and key route files by their posix path. Add a
manually triggered macOS verification workflow so the same checks run
on a self-hosted macOS runner.
This commit is contained in:
2026-10-20 11:17:34 +08:00
committed by trae-solo-agent
parent 8052bf5781
commit a1fff482bf
20 changed files with 251 additions and 48 deletions
+7 -3
View File
@@ -205,7 +205,11 @@ describe('gateway-runner supervision', () => {
startGatewayRunManaged('/usr/bin/hermes', { profileDir: '/tmp/delete-me' })
expect(fakeChildren).toHaveLength(1)
const retired = retireManagedGatewayForProfile('/tmp/delete-me', { timeoutMs: 5000 })
// 固定 platform:停止网关的手段随平台不同(POSIX 走 child.kill('SIGTERM'),
// Windows 走 taskkill 杀进程树),不固定的话这个用例会随运行平台变形。
// Windows 分支由同文件末尾的 "kills the managed gateway process tree on
// Windows shutdown" 单独覆盖。
const retired = retireManagedGatewayForProfile('/tmp/delete-me', { timeoutMs: 5000, platform: 'linux' })
expect(fakeChildren[0].killSignals).toEqual(['SIGTERM'])
fakeChildren[0].emit('exit', 0, 'SIGTERM')
@@ -226,7 +230,7 @@ describe('gateway-runner supervision', () => {
startGatewayRunManaged('/usr/bin/hermes', { profileDir: '/tmp/shutdown-b' })
expect(fakeChildren).toHaveLength(2)
const shutdown = shutdownManagedGateways({ timeoutMs: 5000 })
const shutdown = shutdownManagedGateways({ timeoutMs: 5000, platform: 'linux' })
expect(fakeChildren[0].killSignals).toEqual(['SIGTERM'])
expect(fakeChildren[1].killSignals).toEqual(['SIGTERM'])
@@ -266,7 +270,7 @@ describe('gateway-runner supervision', () => {
startGatewayRunManaged('/usr/bin/hermes', { profileDir: '/tmp/shutdown-d' })
const shutdown = shutdownManagedGateways({ timeoutMs: 1000 })
const shutdown = shutdownManagedGateways({ timeoutMs: 1000, platform: 'linux' })
expect(fakeChildren[0].killSignals).toEqual(['SIGTERM'])
await vi.advanceTimersByTimeAsync(1000)