mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
feat(native): add prebuilt Node-API flock support
This commit is contained in:
@@ -41,6 +41,7 @@ function main(): void {
|
||||
const buildEnvironment = clientBuildProcessEnvironment(process.env, clientEnvironment)
|
||||
|
||||
rmSync(resolve(root, CLIENT_BUILD_RECORD_PATH), { force: true })
|
||||
runScript('build:native-system', buildEnvironment)
|
||||
runScript('build:lib', buildEnvironment)
|
||||
runScript('build:web', buildEnvironment)
|
||||
const record = writeClientBuildRecord(root, clientEnvironment)
|
||||
|
||||
@@ -34,12 +34,14 @@ const vendoredPackages = new Set([
|
||||
])
|
||||
const publicNativePackages = new Set([
|
||||
'@deepseek-ai/node-addon-system',
|
||||
'@deepseek-ai/node-addon-system-darwin-arm64',
|
||||
'@deepseek-ai/node-addon-system-darwin-x64',
|
||||
'@deepseek-ai/node-addon-system-linux-arm64',
|
||||
'@deepseek-ai/node-addon-system-linux-x64',
|
||||
])
|
||||
/** Deliberate source payloads whose exact bytes are part of the package's audit surface. */
|
||||
const publicationSourceAllowlist: Readonly<Record<string, readonly string[]>> = {
|
||||
'@deepseek-ai/node-addon-system': ['src/main.c'],
|
||||
'@deepseek-ai/node-addon-system': ['src/main.c', 'src/flock.c'],
|
||||
}
|
||||
const repositoryUrl = 'git+https://github.com/deepseek-harness/deepseek-harness.git'
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,8 @@ const DEV_ONLY_AREAS = [
|
||||
/** First-party public native packages: reachable at runtime but not third-party. */
|
||||
const FIRST_PARTY = new Set([
|
||||
'@deepseek-ai/node-addon-system',
|
||||
'@deepseek-ai/node-addon-system-darwin-arm64',
|
||||
'@deepseek-ai/node-addon-system-darwin-x64',
|
||||
'@deepseek-ai/node-addon-system-linux-arm64',
|
||||
'@deepseek-ai/node-addon-system-linux-x64',
|
||||
])
|
||||
@@ -75,7 +77,6 @@ const OVERRIDES: Record<string, { license?: string; repo?: string }> = {
|
||||
// No repository field in the published manifest.
|
||||
'node-addon-require-builtin': { repo: 'https://www.npmjs.com/package/node-addon-require-builtin' },
|
||||
// No `license` field in the published manifest; the tarball's LICENSE.txt is the MIT text.
|
||||
'fs-ext': { license: 'MIT' },
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,6 +160,27 @@ describe('gate graph validation', () => {
|
||||
await expect(runGates(subject, subject.length, execute)).resolves.toHaveLength(subject.length)
|
||||
})
|
||||
|
||||
it('builds the native addon before benchmarks through the ci-bench script chain', () => {
|
||||
const subject = withPnpmEntrypoint(() => gatesForMode('ci-bench'))
|
||||
const { scripts } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')) as {
|
||||
scripts: Record<string, string>
|
||||
}
|
||||
|
||||
expect(scripts['check:ci:bench']).toBe('tsx scripts/run-gates.ts ci-bench')
|
||||
expect(subject).toHaveLength(1)
|
||||
expect(subject[0]).toMatchObject({
|
||||
id: 'bench',
|
||||
displayCommand: 'pnpm run test:bench',
|
||||
args: ['/private/pnpm.cjs', 'run', 'test:bench'],
|
||||
})
|
||||
expect(scripts['test:bench']).toBe('npm run build:bench && npm run build:web && npm run test:bench:built')
|
||||
expect(scripts['build:bench']).toBe(
|
||||
'npm run build:native-system && npm run build:lib && tsdown --config benchmarks/tsdown.config.ts',
|
||||
)
|
||||
expect(scripts['build:native-system']).toBe('tsx native/system/scripts/build.ts --host-addon-only')
|
||||
expect(scripts['test:bench:built']).toBe('vitest run --config vitest.bench.config.ts')
|
||||
})
|
||||
|
||||
it('keeps the public repository link policy in the documentation gate', () => {
|
||||
const ids = withPnpmEntrypoint(() => gatesForMode('doc-sync').map(subject => subject.id))
|
||||
|
||||
|
||||
@@ -631,7 +631,8 @@ function coverageGates(): Gate[] {
|
||||
streamOutput: true,
|
||||
})
|
||||
return [
|
||||
instrumented,
|
||||
pnpmScript('native-system', 'build:native-system'),
|
||||
{ ...instrumented, needs: ['native-system'] },
|
||||
pnpmExec('coverage-exempt-heavy', [
|
||||
'vitest',
|
||||
'run',
|
||||
@@ -640,6 +641,7 @@ function coverageGates(): Gate[] {
|
||||
...timeouts,
|
||||
], {
|
||||
label: 'test:coverage-exempt-heavy',
|
||||
needs: ['native-system'],
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user