mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-09 04:02:35 +00:00
The dsh-family version rule lived only in the packages/ block of checkWorkspaceManifest, so apps/ members and the root-named CLI carried the shared version with no static check of their own. The name-based rule now covers every scanned manifest; regression coverage names the stale-version merge that shipped packages/util/http-proxy at 0.1.2-alpha.5 behind a 0.1.2-rc.1 family.
124 lines
4.6 KiB
TypeScript
124 lines
4.6 KiB
TypeScript
/** Experimental-package publication and dependency constraints. */
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
checkDshFamilyVersion,
|
|
checkExperimentalDependencyIsolation,
|
|
checkExperimentalManifest,
|
|
expectedDshPackageFiles,
|
|
type WorkspaceManifest,
|
|
} from './check-workspace-constraints.ts'
|
|
|
|
const experimental: WorkspaceManifest = {
|
|
dir: 'packages/experimental/prototype',
|
|
manifest: { name: '@deepseek-ai/dsh-experimental-prototype', private: true },
|
|
}
|
|
|
|
describe('experimental workspace constraints', () => {
|
|
it('requires the experimental package-name prefix', () => {
|
|
expect(checkExperimentalManifest({
|
|
...experimental,
|
|
manifest: { ...experimental.manifest, name: '@deepseek-ai/dsh-prototype' },
|
|
})).toEqual([
|
|
'@deepseek-ai/dsh-prototype: experimental package name must start with "@deepseek-ai/dsh-experimental-"',
|
|
])
|
|
})
|
|
|
|
it('requires private manifests without publication metadata', () => {
|
|
expect(checkExperimentalManifest(experimental)).toEqual([])
|
|
expect(checkExperimentalManifest({
|
|
...experimental,
|
|
manifest: { ...experimental.manifest, private: false, publishConfig: { access: 'public' } },
|
|
})).toEqual([
|
|
'@deepseek-ai/dsh-experimental-prototype: experimental package must set "private": true',
|
|
'@deepseek-ai/dsh-experimental-prototype: experimental package must omit publishConfig',
|
|
])
|
|
})
|
|
|
|
it.each(['dependencies', 'optionalDependencies', 'peerDependencies'] as const)(
|
|
'rejects release %s on an experimental package',
|
|
(section) => {
|
|
expect(checkExperimentalDependencyIsolation([experimental, {
|
|
dir: 'packages/core/consumer',
|
|
manifest: {
|
|
name: '@deepseek-ai/dsh-consumer',
|
|
[section]: { '@deepseek-ai/dsh-experimental-prototype': 'workspace:^' },
|
|
},
|
|
}])).toEqual([
|
|
`@deepseek-ai/dsh-consumer: ${section}.@deepseek-ai/dsh-experimental-prototype must not reference an experimental package`,
|
|
])
|
|
},
|
|
)
|
|
|
|
it('allows development and experimental consumers but rejects the Python release runtime', () => {
|
|
const manifests: WorkspaceManifest[] = [experimental, {
|
|
dir: 'packages/core/test-only',
|
|
manifest: {
|
|
name: '@deepseek-ai/dsh-test-only',
|
|
devDependencies: { '@deepseek-ai/dsh-experimental-prototype': 'workspace:^' },
|
|
},
|
|
}, {
|
|
dir: 'packages/experimental/consumer',
|
|
manifest: {
|
|
name: '@deepseek-ai/dsh-experimental-consumer',
|
|
dependencies: { '@deepseek-ai/dsh-experimental-prototype': 'workspace:^' },
|
|
},
|
|
}, {
|
|
dir: 'python/sdk-runtime',
|
|
manifest: {
|
|
name: '@deepseek-ai/dsh-python-runtime',
|
|
dependencies: { '@deepseek-ai/dsh-experimental-prototype': 'workspace:^' },
|
|
},
|
|
}]
|
|
|
|
expect(checkExperimentalDependencyIsolation(manifests)).toEqual([
|
|
'@deepseek-ai/dsh-python-runtime: dependencies.@deepseek-ai/dsh-experimental-prototype must not reference an experimental package',
|
|
])
|
|
})
|
|
})
|
|
|
|
describe('dsh family version coherence', () => {
|
|
it('rejects a package carrying a stale shared version', () => {
|
|
expect(checkDshFamilyVersion(
|
|
{ name: '@deepseek-ai/dsh-http-proxy', version: '0.1.2-alpha.5' },
|
|
'0.1.2-rc.1',
|
|
)).toBe('@deepseek-ai/dsh-http-proxy: package.json version must match root version 0.1.2-rc.1')
|
|
})
|
|
|
|
it('rejects the root-named CLI app on a stale shared version', () => {
|
|
expect(checkDshFamilyVersion(
|
|
{ name: '@deepseek-ai/dsh', version: '0.1.2-alpha.5' },
|
|
'0.1.2-rc.1',
|
|
)).toBe('@deepseek-ai/dsh: package.json version must match root version 0.1.2-rc.1')
|
|
})
|
|
|
|
it('accepts a manifest carrying the shared version', () => {
|
|
expect(checkDshFamilyVersion(
|
|
{ name: '@deepseek-ai/dsh-http-proxy', version: '0.1.2-rc.1' },
|
|
'0.1.2-rc.1',
|
|
)).toBeUndefined()
|
|
})
|
|
|
|
it('leaves other sequences to their own version lines', () => {
|
|
expect(checkDshFamilyVersion({ name: '@deepseek-ai/cordis', version: '4.0.1' }, '0.1.2-rc.1')).toBeUndefined()
|
|
expect(checkDshFamilyVersion(
|
|
{ name: '@deepseek-ai/node-addon-landlock-run', version: '0.1.1' },
|
|
'0.1.2-rc.1',
|
|
)).toBeUndefined()
|
|
expect(checkDshFamilyVersion({ version: '0.1.2-alpha.5' }, '0.1.2-rc.1')).toBeUndefined()
|
|
})
|
|
})
|
|
|
|
describe('package payload constraints', () => {
|
|
it('includes a declared profile patch without a package-name allowlist', () => {
|
|
expect(expectedDshPackageFiles({
|
|
name: '@deepseek-ai/dsh-private-profile',
|
|
dsh: { bundle: { patch: './cordis.patch.yml' } },
|
|
})).toEqual([
|
|
'lib/index.js',
|
|
'cordis.patch.yml',
|
|
'lib/types/**/*.d.ts',
|
|
])
|
|
})
|
|
})
|