mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-12-01 01:29:35 +08:00
The release family test lists every published experimental package; add dsh-speech-to-text-deepseek. The new package and its edges push the dual-release npm graph to 341 packages x 3332 internal edges, above the 1,134,400-unit budget, so raise MAX_RESOLUTION_WORK_UNITS to 1,420,265 (1.25x the measured 1,136,212 units) and record the new timings in the Agent Note. The voice bundle summary now names cloud recognition, which the recorded plugin and recommendation catalogs repeat; update those recordings, their expected output, and the browser assertion. Refs #8059
153 lines
5.9 KiB
TypeScript
153 lines
5.9 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import type { NpmPackageLock, RegistryIndex } from './benchmark-npm-resolution.ts'
|
|
import {
|
|
assertDualDshInstallLayout,
|
|
assertResolutionWorkBudget,
|
|
buildDualDshRegistry,
|
|
MAX_RESOLUTION_WORK_UNITS,
|
|
} from './verify-npm-install-layout.ts'
|
|
|
|
function validLayout(): NpmPackageLock {
|
|
return {
|
|
lockfileVersion: 3,
|
|
packages: {
|
|
'': { dependencies: { '@deepseek-ai/dsh': '0.2.0', 'dsh-previous': 'npm:@deepseek-ai/dsh@0.1.0' } },
|
|
'node_modules/@deepseek-ai/cordis': { version: '4.0.1' },
|
|
'node_modules/@deepseek-ai/dsh': {
|
|
version: '0.2.0',
|
|
dependencies: { '@deepseek-ai/dsh-child': '^0.2.0' },
|
|
peerDependencies: { '@deepseek-ai/cordis': '^4.0.1' },
|
|
},
|
|
'node_modules/@deepseek-ai/dsh-child': {
|
|
version: '0.2.0',
|
|
dependencies: { '@deepseek-ai/dsh-leaf': '^0.2.0' },
|
|
},
|
|
'node_modules/@deepseek-ai/dsh-leaf': { version: '0.2.0' },
|
|
'node_modules/dsh-previous': {
|
|
name: '@deepseek-ai/dsh',
|
|
version: '0.1.0',
|
|
dependencies: { '@deepseek-ai/dsh-child': '^0.1.0' },
|
|
peerDependencies: { '@deepseek-ai/cordis': '^4.0.1' },
|
|
},
|
|
'node_modules/dsh-previous/node_modules/@deepseek-ai/dsh-child': {
|
|
version: '0.1.0',
|
|
dependencies: { '@deepseek-ai/dsh-leaf': '^0.1.0' },
|
|
},
|
|
'node_modules/dsh-previous/node_modules/@deepseek-ai/dsh-leaf': { version: '0.1.0' },
|
|
},
|
|
}
|
|
}
|
|
|
|
describe('npm install layout verifier', () => {
|
|
it('creates two incompatible versions of every DSH package', () => {
|
|
const index: RegistryIndex = new Map([
|
|
['@deepseek-ai/dsh', new Map([['0.1.1-rc.2', {
|
|
name: '@deepseek-ai/dsh',
|
|
version: '0.1.1-rc.2',
|
|
dependencies: { '@deepseek-ai/dsh-child': '^0.1.1-rc.2' },
|
|
peerDependencies: { '@deepseek-ai/cordis': '^4.0.1' },
|
|
}]])],
|
|
['@deepseek-ai/dsh-child', new Map([['0.1.1-rc.2', {
|
|
name: '@deepseek-ai/dsh-child',
|
|
version: '0.1.1-rc.2',
|
|
}]])],
|
|
['@deepseek-ai/cordis', new Map([['4.0.1', {
|
|
name: '@deepseek-ai/cordis',
|
|
version: '4.0.1',
|
|
}]])],
|
|
])
|
|
|
|
const dual = buildDualDshRegistry(index, '0.1.1-rc.2')
|
|
|
|
expect([...dual.get('@deepseek-ai/dsh')?.keys() ?? []]).toEqual(['0.1.0', '0.2.0'])
|
|
expect(dual.get('@deepseek-ai/dsh')?.get('0.1.0')).toMatchObject({
|
|
version: '0.1.0',
|
|
dependencies: { '@deepseek-ai/dsh-child': '^0.1.0' },
|
|
peerDependencies: { '@deepseek-ai/cordis': '^4.0.1' },
|
|
})
|
|
expect(dual.get('@deepseek-ai/dsh')?.get('0.2.0')).toMatchObject({
|
|
version: '0.2.0',
|
|
dependencies: { '@deepseek-ai/dsh-child': '^0.2.0' },
|
|
})
|
|
expect(dual.get('@deepseek-ai/cordis')).toBe(index.get('@deepseek-ai/cordis'))
|
|
})
|
|
|
|
it('accepts isolated DSH releases with one shared Cordis installation', () => {
|
|
expect(assertDualDshInstallLayout(validLayout())).toEqual({
|
|
dshPackagesPerVersion: 3,
|
|
checkedDshEdges: 4,
|
|
})
|
|
})
|
|
|
|
it.each([
|
|
['react', 'node_modules/react'],
|
|
['react-dom', 'node_modules/react-dom'],
|
|
['react', 'node_modules/dsh-previous/node_modules/react'],
|
|
['react-dom', 'node_modules/dsh-previous/node_modules/react-dom'],
|
|
])('rejects browser runtime %s installed at %s in the DSH-only consumer', (name, path) => {
|
|
const layout = validLayout()
|
|
const packages = { ...layout.packages, [path]: { version: '18.3.1' } }
|
|
expect(() => assertDualDshInstallLayout({ ...layout, packages })).toThrow(
|
|
`${path}: ${name} is a browser build input`,
|
|
)
|
|
})
|
|
|
|
it('rejects an internal edge that crosses release versions', () => {
|
|
const layout = validLayout()
|
|
const packages = { ...layout.packages }
|
|
Reflect.deleteProperty(packages, 'node_modules/dsh-previous/node_modules/@deepseek-ai/dsh-leaf')
|
|
|
|
expect(() => assertDualDshInstallLayout({ ...layout, packages })).toThrow(
|
|
'node_modules/dsh-previous/node_modules/@deepseek-ai/dsh-child: dependencies '
|
|
+ '@deepseek-ai/dsh-leaf resolves to node_modules/@deepseek-ai/dsh-leaf@0.2.0, expected 0.1.0',
|
|
)
|
|
})
|
|
|
|
it('rejects a second Cordis installation', () => {
|
|
const layout = validLayout()
|
|
const packages = {
|
|
...layout.packages,
|
|
'node_modules/dsh-previous/node_modules/@deepseek-ai/cordis': { version: '4.0.1' },
|
|
}
|
|
|
|
expect(() => assertDualDshInstallLayout({ ...layout, packages })).toThrow(
|
|
'expected one shared @deepseek-ai/cordis',
|
|
)
|
|
})
|
|
})
|
|
|
|
describe('resolution work budget', () => {
|
|
it.each([
|
|
[277, 2524, 699_148],
|
|
[316, 2780, 878_480],
|
|
[316, 2786, 880_376],
|
|
[317, 2786, 883_162],
|
|
[320, 2836, 907_520],
|
|
[340, 3320, 1_128_800],
|
|
[341, 3332, 1_136_212],
|
|
])('accepts the measured dual-release graph with %i packages and %i edges', (packages, edges, units) => {
|
|
expect(assertResolutionWorkBudget({ dshPackagesPerVersion: packages, checkedDshEdges: edges }))
|
|
.toBe(units)
|
|
})
|
|
|
|
it('accepts a graph exactly at the budget and rejects one internal edge above it', () => {
|
|
const packages = 341
|
|
const edgesAtBudget = Math.floor(MAX_RESOLUTION_WORK_UNITS / packages)
|
|
|
|
expect(packages * edgesAtBudget).toBe(MAX_RESOLUTION_WORK_UNITS)
|
|
expect(assertResolutionWorkBudget({ dshPackagesPerVersion: packages, checkedDshEdges: edgesAtBudget }))
|
|
.toBe(MAX_RESOLUTION_WORK_UNITS)
|
|
expect(() => assertResolutionWorkBudget({
|
|
dshPackagesPerVersion: packages,
|
|
checkedDshEdges: edgesAtBudget + 1,
|
|
})).toThrow(`= ${String(MAX_RESOLUTION_WORK_UNITS + packages)} unit(s), budget ${String(MAX_RESOLUTION_WORK_UNITS)} unit(s)`)
|
|
})
|
|
|
|
it('accepts the headroom and rejects a runaway graph with its own measured counts', () => {
|
|
expect(assertResolutionWorkBudget({ dshPackagesPerVersion: 380, checkedDshEdges: 3700 }))
|
|
.toBe(1_406_000)
|
|
expect(() => assertResolutionWorkBudget({ dshPackagesPerVersion: 420, checkedDshEdges: 3500 }))
|
|
.toThrow(`420 package(s) per release x 3500 internal edge(s) = 1470000 unit(s), budget ${String(MAX_RESOLUTION_WORK_UNITS)} unit(s)`)
|
|
})
|
|
})
|