mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-10-26 16:55:08 +00:00
test(experimental): resolve optional fixtures from their owners
This commit is contained in:
1 parent
b48384223a
commit
b7ed2a5e85
7 files changed
+42
-22
No files matched your search
@@ -4,15 +4,16 @@ import type { ChildProcess } from 'node:child_process'
|
||||
import { spawn } from 'node:child_process'
|
||||
import { createHmac, randomUUID } from 'node:crypto'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { mkdir, mkdtemp, realpath, rm } from 'node:fs/promises'
|
||||
import { mkdir, mkdtemp, readFile, realpath, rm, symlink, writeFile } from 'node:fs/promises'
|
||||
import { createServer } from 'node:net'
|
||||
import type { AddressInfo } from 'node:net'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { setTimeout as delay } from 'node:timers/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import WebSocket from 'ws'
|
||||
import { initProfile, PROFILE_TEMPLATES } from '@deepseek-ai/dsh-app-boot'
|
||||
|
||||
const REPO_ROOT = fileURLToPath(new URL('../../..', import.meta.url))
|
||||
const BUILT_BIN = join(REPO_ROOT, 'apps/cli/lib/bin.js')
|
||||
@@ -357,6 +358,18 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('GitHub webhook through the real
|
||||
const workspacePath = join(root, 'workspace')
|
||||
await mkdir(workspacePath)
|
||||
const canonicalWorkspacePath = await realpath(workspacePath)
|
||||
const profile = join(root, '.dsh/profiles/web')
|
||||
initProfile(profile, PROFILE_TEMPLATES.web!.bundles)
|
||||
const manifestPath = join(profile, 'package.json')
|
||||
const manifest = JSON.parse(await readFile(manifestPath, 'utf8')) as { dependencies: Record<string, string> }
|
||||
for (const name of ['@deepseek-ai/dsh-experimental-webhook', '@deepseek-ai/dsh-experimental-webhook-github']) {
|
||||
const directory = dirname(fileURLToPath(import.meta.resolve(`${name}/package.json`)))
|
||||
const link = join(profile, 'node_modules', name)
|
||||
await mkdir(dirname(link), { recursive: true })
|
||||
await symlink(directory, link, 'junction')
|
||||
manifest.dependencies[name] = `file:${directory}`
|
||||
}
|
||||
await writeFile(manifestPath, `${JSON.stringify(manifest)}\n`)
|
||||
const webhookPort = await freePort()
|
||||
const child = spawn(process.execPath, [
|
||||
BUILT_BIN,
|
||||
|
||||
@@ -105,8 +105,11 @@ it.skipIf(!built)('loads the packed GitHub example with its explicitly installed
|
||||
const initialLinks = await workspaceLinks(sourceDirectories)
|
||||
onTestFinished(async () => { expect(await workspaceLinks(sourceDirectories)).toEqual(initialLinks) })
|
||||
const closure = packedWorkspaceClosure('@deepseek-ai/dsh', packages)
|
||||
// A signed ping creates no Session and runs no confined process. The native
|
||||
// platform packages load lazily for those operations and have separate smokes.
|
||||
const runtimeMembers = closure.filter(member => (
|
||||
(!Array.isArray(member.manifest.os) || member.manifest.os.includes(process.platform))
|
||||
!member.name.startsWith('@deepseek-ai/node-addon-system-')
|
||||
&& (!Array.isArray(member.manifest.os) || member.manifest.os.includes(process.platform))
|
||||
&& (!Array.isArray(member.manifest.cpu) || member.manifest.cpu.includes(process.arch))
|
||||
))
|
||||
const members = new Map(runtimeMembers.map(member => [member.name, member]))
|
||||
|
||||
@@ -93,7 +93,7 @@ async function bootWeb(
|
||||
// A deployment-level skill on the host registry's GLOBAL layer — the same
|
||||
// registration shape a repository plugin's skill root uses. The layered
|
||||
// skills test below proves it reaches preset-composed agents.
|
||||
{ insert: [{ id: 'skill-badge', name: '@deepseek-ai/dsh-experimental-skill-badge' }] },
|
||||
{ insert: [{ id: 'skill-badge', name: import.meta.resolve('@deepseek-ai/dsh-experimental-skill-badge') }] },
|
||||
{ id: 'modules', disabled: true },
|
||||
// The physical Connection row owns the disabled HTTP server. bootWeb
|
||||
// supplies only its in-process registries so Host services still prove
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/** File creation shared by repository scanner fixtures. */
|
||||
import { mkdirSync, writeFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
|
||||
/**
|
||||
* Write a text or JSON fixture, creating its containing directories.
|
||||
* @param root - Owning temporary fixture directory.
|
||||
* @param path - Path relative to that directory.
|
||||
* @param value - Literal text or JSON-serializable fixture value.
|
||||
*/
|
||||
export function writeFixtureFile(root: string, path: string, value: unknown): void {
|
||||
const target = join(root, path)
|
||||
mkdirSync(dirname(target), { recursive: true })
|
||||
writeFileSync(target, typeof value === 'string' ? value : `${JSON.stringify(value)}\n`)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
/** Source, installation, and composition regressions for default-product isolation. */
|
||||
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { verifyDefaultProductIsolation } from './verify-default-product-isolation.ts'
|
||||
import { writeFixtureFile as write } from './fixture-file.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
const experimental = '@deepseek-ai/dsh-experimental-prototype'
|
||||
@@ -15,12 +16,6 @@ const profile = 'packages/boot/app-boot/src/profile.ts'
|
||||
const preset = 'packages/bundle/web-app/presets/standard.patch.yml'
|
||||
const patch = 'packages/bundle/base/cordis.patch.yml'
|
||||
|
||||
function write(root: string, path: string, value: unknown): void {
|
||||
const target = join(root, path)
|
||||
mkdirSync(dirname(target), { recursive: true })
|
||||
writeFileSync(target, typeof value === 'string' ? value : `${JSON.stringify(value)}\n`)
|
||||
}
|
||||
|
||||
function manifest(root: string, path: string, fields: Record<string, unknown>): void {
|
||||
const existing = JSON.parse(readFileSync(join(root, path), 'utf8')) as Record<string, unknown>
|
||||
write(root, path, { ...existing, ...fields })
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/** Product-use regressions exercise source reachability and effective Loader composition. */
|
||||
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import type { ProductPackagePolicy } from './product-package-policy.ts'
|
||||
import { verifyProductUse } from './verify-product-use.ts'
|
||||
import { writeFixtureFile as write } from './fixture-file.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
const base = '@deepseek-ai/dsh-base'
|
||||
@@ -15,12 +16,6 @@ const candidateDir = 'packages/core/candidate'
|
||||
const profile = 'packages/boot/app-boot/src/profile.ts'
|
||||
const patch = 'packages/bundle/base/cordis.patch.yml'
|
||||
|
||||
function write(root: string, path: string, value: unknown): void {
|
||||
const target = join(root, path)
|
||||
mkdirSync(dirname(target), { recursive: true })
|
||||
writeFileSync(target, typeof value === 'string' ? value : `${JSON.stringify(value)}\n`)
|
||||
}
|
||||
|
||||
function pkg(root: string, directory: string, name: string, fields: Record<string, unknown> = {}): void {
|
||||
write(root, `${directory}/package.json`, { name, ...fields })
|
||||
write(root, `${directory}/src/index.ts`, 'export {}\n')
|
||||
|
||||
@@ -7,8 +7,7 @@ import { JSDOM } from 'jsdom'
|
||||
import ts from 'typescript'
|
||||
import { applyEntryPatches, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { loadOverlayPatches } from '../packages/boot/app-boot/src/index.ts'
|
||||
import { bundlePatchPaths, composeEntries } from '../packages/boot/app-boot/src/profile.ts'
|
||||
import { bundlePatchPaths, composeEntries, loadOverlayPatches } from '../packages/boot/app-boot/src/index.ts'
|
||||
import type { DshBundleManifest } from '../packages/util/package-manifest/src/types.ts'
|
||||
import { assertNever } from '../packages/util/values/src/index.ts'
|
||||
import { isAgentPresetEntry, isCordisGroupEntry, loadCordisYaml } from './cordis-yaml.ts'
|
||||
|
||||
Reference in new issue
Block a user