mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
* Reduce native dependency installs to the host platform * Remove install policy documentation * Guard cross-arch packaging and scope release installs to the runner electron-builder only logs a warning for a missing extraResources source, so a host-only install silently shipped a foreign-arch slice without its natives — `pnpm build:mac` on Apple Silicon produced an x64 DMG with no sherpa-onnx-darwin-x64 and no @parcel/watcher-darwin-x64. The previous beforePack hook covered only win32. - Add assertPackagedNativeVariantsInstalled, an arch-aware check over the target's sherpa-onnx, @parcel/watcher, and (on Windows) node-gyp addons. beforePack now runs it for every platform, with remedies split: another architecture comes from install:release, the os:win32 addons need a Windows host. - Drop --os from the release installs. Every packaging job already runs on a runner whose OS matches its target, so only the macOS lanes need extra breadth, and only on CPU for their x64+arm64 config. Windows and Linux packaging return to a plain host-only install. - Add --frozen-lockfile to install:release so a bare run cannot rewrite the lockfile. - Restore the install policy reference doc and the CONTRIBUTING note, plus the rationale comments dropped from the runtime contract test. - Gate the packaging-closure assertions on whether the Windows addons are installed rather than on the host OS, so a cross-arch install exercises them off Windows too. - Make the workflow contract test read `run:` steps as well as retry-action commands, and enforce host-only scoping on the non-macOS packaging lanes. - Remove the unreferenced install measurement script; its numbers live in the policy doc. * Track the install policy doc and index it from AGENTS.md docs/** is ignored behind a per-file allow-list, so the new reference doc was only committed via git add -f and future edits would be skipped. Add it to the allow-list and give it an AGENTS.md entry like every other tracked reference doc, so the host-only install rule is discoverable before someone packages a second architecture. * Route Windows-lane removals through the retrying helper Adding these four specs to the PR Windows lane pulled them into the windows-lane-tree-removal-boundary ratchet, which failed on 20 raw recursive removals. On Windows a bare rmSync races a handle the OS has not released, throwing EPERM after the assertions already passed and reporting a green test as a lane failure. * Adapt the packaging guard to the vendored Windows registry addon main vendored windows-native-registry as the workspace package @orca/windows-registry (#20438). A workspace link resolves on every host, so including it in the installed-Windows-addons checks proved nothing. @vscode/windows-process-tree is the only os: win32 npm addon left, so it alone decides whether the win32 resource plan resolves.
54 lines
2.3 KiB
JavaScript
54 lines
2.3 KiB
JavaScript
import { execFileSync } from 'node:child_process'
|
|
import { existsSync, readFileSync } from 'node:fs'
|
|
import { isAbsolute, join, resolve } from 'node:path'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const projectDir = resolve(import.meta.dirname, '../..')
|
|
const PATCH = readFileSync(
|
|
join(projectDir, 'config/patches/@vscode__windows-process-tree@0.8.0.patch'),
|
|
'utf8'
|
|
)
|
|
const PACKAGE_DIR = join(projectDir, 'node_modules', '@vscode', 'windows-process-tree')
|
|
const RESOLVED_GYP = "require.resolve('node-addon-api/node_addon_api.gyp')"
|
|
|
|
describe('windows-process-tree node-addon-api gyp path', () => {
|
|
it('stages headers without a pnpm-sensitive gyp dependency', () => {
|
|
expect(PATCH).not.toContain('+ "../../node-addon-api')
|
|
expect(PATCH).toContain('+ "include_dirs": ["deps/node-addon-api"],')
|
|
expect(PATCH).toContain('+ "defines": ["NAPI_CPP_EXCEPTIONS", "_HAS_EXCEPTIONS=1"],')
|
|
const buildScript = readFileSync(
|
|
join(projectDir, 'config/scripts/build-windows-process-tree-relay-addon.mjs'),
|
|
'utf8'
|
|
)
|
|
expect(buildScript).toContain('stageWindowsProcessTreeNodeAddonApiHeaders(PACKAGE_DIR)')
|
|
expect(buildScript).toContain('Repaired un-applied pnpm patch hunks before build.')
|
|
const rebuildHelper = readFileSync(
|
|
join(projectDir, 'config/scripts/windows-process-tree-gyp-rebuild.mjs'),
|
|
'utf8'
|
|
)
|
|
expect(rebuildHelper).toContain("createRequire(join(packageDir, 'package.json'))")
|
|
expect(rebuildHelper).toContain("resolve('node-addon-api/package.json')")
|
|
expect(rebuildHelper).toContain("'napi.h'")
|
|
expect(rebuildHelper).toContain("'napi-inl.h'")
|
|
expect(rebuildHelper).toContain("'napi-inl.deprecated.h'")
|
|
const rebuildScript = readFileSync(
|
|
join(projectDir, 'config/scripts/rebuild-native-deps.mjs'),
|
|
'utf8'
|
|
)
|
|
expect(rebuildScript).toContain('stageWindowsProcessTreeNodeAddonApiHeaders()')
|
|
})
|
|
|
|
// The installed Windows dependency is exercised by the Windows CI lane.
|
|
it.runIf(process.platform === 'win32')(
|
|
'resolves node_addon_api.gyp to a real file from the package directory',
|
|
() => {
|
|
const resolved = execFileSync(process.execPath, ['-p', RESOLVED_GYP], {
|
|
cwd: PACKAGE_DIR,
|
|
encoding: 'utf8'
|
|
}).trim()
|
|
expect(isAbsolute(resolved)).toBe(true)
|
|
expect(existsSync(resolved)).toBe(true)
|
|
}
|
|
)
|
|
})
|