Merge branch 'feat/plugin-mgmt-1-boot' into feat/plugin-mgmt-2-manager
This commit is contained in:
commit
c22d66ffd8
528 files changed
+16507
-7856
No files matched your search
@@ -156,6 +156,9 @@ const packageFileExtras: Readonly<Record<string, readonly string[]>> = {
|
||||
// The Web Host mounts the default-off settings owner independently of each
|
||||
// Agent-scoped delegation-tool instance.
|
||||
'@deepseek-ai/dsh-tool-subagent': ['lib/model-selection-settings.js'],
|
||||
// The JSONL backend resolves its private verification Worker relative to
|
||||
// import.meta.url; it is shipped without a public package subpath.
|
||||
'@deepseek-ai/dsh-session-persistence-jsonl': ['lib/worker.cjs'],
|
||||
// The argv-prefix runner entry ships beside the lib as its own bundle;
|
||||
// sandbox-local resolves it through the package's ./runner export. tsdown
|
||||
// also shares its generated FFI code through a hashed runtime chunk.
|
||||
|
||||
@@ -66,13 +66,14 @@ describe('CI workflow', () => {
|
||||
|| !isRecord(workflow.jobs['windows-observational'])
|
||||
|| !isRecord(workflow.jobs['node-24'])
|
||||
|| !isRecord(workflow.jobs['node-24-coverage'])
|
||||
|| !isRecord(workflow.jobs['node-24-bench'])
|
||||
|| !isRecord(workflow.jobs['node-24-consumers'])
|
||||
|| !isRecord(workflow.jobs['node-compat'])
|
||||
|| !isRecord(workflow.jobs['all-checks-passed'])
|
||||
|| !isRecord(masterWorkflow.jobs)
|
||||
|| !isRecord(masterWorkflow.jobs['wine-apt-cache'])
|
||||
|| !isRecord(masterWorkflow.jobs['serial-windows'])) {
|
||||
throw new TypeError('CI workflow must define windows, windows-build, windows-coverage, windows-native-tests, windows-observational, node-24, node-24-coverage, node-24-consumers, node-compat, and all-checks-passed; ci-master must define wine-apt-cache and serial-windows')
|
||||
throw new TypeError('CI workflow must define windows, windows-build, windows-coverage, windows-native-tests, windows-observational, node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, and all-checks-passed; ci-master must define wine-apt-cache and serial-windows')
|
||||
}
|
||||
|
||||
const windows = workflow.jobs.windows
|
||||
@@ -84,6 +85,7 @@ describe('CI workflow', () => {
|
||||
const serialWindows = masterWorkflow.jobs['serial-windows']
|
||||
const node24 = workflow.jobs['node-24']
|
||||
const node24Coverage = workflow.jobs['node-24-coverage']
|
||||
const node24Bench = workflow.jobs['node-24-bench']
|
||||
const node24Consumers = workflow.jobs['node-24-consumers']
|
||||
const nodeCompat = workflow.jobs['node-compat']
|
||||
const aggregate = workflow.jobs['all-checks-passed']
|
||||
@@ -223,12 +225,17 @@ describe('CI workflow', () => {
|
||||
// half-close tests are stabilized; observational stays out too.
|
||||
expect(aggregate.needs).toContain('windows')
|
||||
expect(aggregate.needs).toContain('windows-build')
|
||||
// The benchmark lane is a required verdict input and runs alone so its
|
||||
// wall-clock budgets never share a runner with a concurrent aggregate.
|
||||
expect(aggregate.needs).toContain('node-24-bench')
|
||||
expect(node24Bench.name).toBe('node 24 / benchmarks')
|
||||
expect(node24Bench.env).toBeUndefined()
|
||||
expect(aggregate.needs).not.toContain('windows-coverage')
|
||||
expect(aggregate.needs).toContain('windows-native-tests')
|
||||
expect(aggregate.needs).not.toContain('windows-observational')
|
||||
expect(aggregate.needs).not.toContain('serial-windows')
|
||||
|
||||
// Linux failover is a separate switch: the three required Linux workers
|
||||
// Linux failover is a separate switch: the three enterprise Linux workers
|
||||
// and the verdict job resolve their pool through DSH_CI_FAILOVER_LINUX,
|
||||
// never the Windows switch.
|
||||
for (const [jobName, job] of [['node-24', node24], ['node-24-coverage', node24Coverage], ['node-24-consumers', node24Consumers]] as const) {
|
||||
@@ -262,6 +269,45 @@ describe('CI workflow', () => {
|
||||
expect(windowsObservational.env).not.toMatchObject({ DSH_GATE_FAIL_FAST: '1' })
|
||||
})
|
||||
|
||||
it('runs required benchmarks on standard hosted Linux independently of failover', () => {
|
||||
const workflow = loadWorkflow('.github/workflows/ci.yml')
|
||||
const benchmark = workflowJob(workflow, 'node-24-bench')
|
||||
const aggregate = workflowJob(workflow, 'all-checks-passed')
|
||||
|
||||
expect(benchmark['runs-on']).toBe('ubuntu-24.04')
|
||||
expect(benchmark.if).toBe("github.event_name == 'pull_request'")
|
||||
expect(benchmark.needs).toBeUndefined()
|
||||
expect(benchmark['continue-on-error']).toBeUndefined()
|
||||
expect(benchmark.env).toBeUndefined()
|
||||
expect(aggregate.needs).toContain('node-24-bench')
|
||||
})
|
||||
|
||||
it('always restores the hosted benchmark pnpm cache', () => {
|
||||
const benchmark = workflowJob(loadWorkflow('.github/workflows/ci.yml'), 'node-24-bench')
|
||||
if (!Array.isArray(benchmark.steps)) throw new TypeError('benchmark job must define steps')
|
||||
const caches = benchmark.steps.filter(step => isRecord(step) && step.uses === 'actions/cache/restore@v4')
|
||||
|
||||
expect(caches).toHaveLength(1)
|
||||
expect(caches[0]).not.toHaveProperty('if')
|
||||
expect(caches[0]).toMatchObject({
|
||||
with: {
|
||||
path: '${{ steps.pnpm-store.outputs.path }}',
|
||||
key: "${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}",
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('bounds the complete benchmark job to fifteen minutes', () => {
|
||||
const benchmark = workflowJob(loadWorkflow('.github/workflows/ci.yml'), 'node-24-bench')
|
||||
|
||||
expect(benchmark['timeout-minutes']).toBe(15)
|
||||
expect(benchmark.steps).toContainEqual({
|
||||
name: 'Run performance benchmarks',
|
||||
env: { DSH_GATE_VERBOSE: '1' },
|
||||
run: 'pnpm run check:ci:bench',
|
||||
})
|
||||
})
|
||||
|
||||
it('gives the Wine Host TypeScript compile the repository heap budget', () => {
|
||||
const wineGates = readFileSync(resolve(root, 'scripts/wine-windows-gates.sh'), 'utf8')
|
||||
|
||||
|
||||
@@ -101,6 +101,13 @@ describe('client bundle purity gate', () => {
|
||||
expect(() => resolveId('@deepseek-ai/dsh-token-meter/client/internal')).toThrow(/purity/)
|
||||
})
|
||||
|
||||
it('admits only the pure spill notice entry, not its Host policy', () => {
|
||||
expect(resolveId('@deepseek-ai/dsh-spill-policy/notice')).toBeNull()
|
||||
expect(resolveId('@deepseek-ai/dsh-output-retention')).toBeNull()
|
||||
expect(() => resolveId('@deepseek-ai/dsh-spill-policy')).toThrow(/purity/)
|
||||
expect(() => resolveId('@deepseek-ai/dsh-spill-policy/notice/internal')).toThrow(/purity/)
|
||||
})
|
||||
|
||||
it('lets exact generated Remote contributions inline without admitting their package implementation', () => {
|
||||
expect(resolveId('@deepseek-ai/dsh-goal/remote')).toBeNull()
|
||||
expect(() => resolveId('@deepseek-ai/dsh-goal')).toThrow(/purity/)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"docs/architecture.md": 2400,
|
||||
"docs/cordis-primer.md": 600,
|
||||
"docs/defensive-patterns.md": 550,
|
||||
"docs/testing.md": 1300,
|
||||
"docs/testing.md": 1350,
|
||||
"packages/AGENTS.md": 750,
|
||||
"packages/README.md": 994
|
||||
}
|
||||
@@ -208,6 +208,7 @@ export const EVENT_SCOPE_PAGE: Record<string, string> = {
|
||||
'subagent': 'subagent.md',
|
||||
'system-prompt': 'system-prompt.md',
|
||||
'session-telemetry': 'session-telemetry.md',
|
||||
'feedback': 'feedback.md',
|
||||
'tools': 'tools.md',
|
||||
'user-questions': 'user-questions.md',
|
||||
'webserver': 'web-server.md',
|
||||
|
||||
@@ -296,7 +296,7 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
pkg: 'storage-domain',
|
||||
title: 'Domain data facility',
|
||||
mode: 'core',
|
||||
consumers: ['workspace', 'message-feedback'],
|
||||
consumers: ['workspace'],
|
||||
note: 'Waits for every configured backend, then publishes the domain form as one lifecycle-bound service for typed durable state.',
|
||||
},
|
||||
{
|
||||
@@ -304,7 +304,7 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
pkg: 'message-feedback',
|
||||
title: 'Lifecycle-bound message feedback',
|
||||
mode: 'core',
|
||||
note: 'Owns local per-assistant-message feedback, lifecycle and target validation, per-item compare-and-set, and the Host unary Remote contract without entering Session history or telemetry.',
|
||||
note: 'Owns per-assistant-message feedback in the canonical Session log, target validation, per-item compare-and-set, and the Host unary Remote contract. Feedback stays outside model history; log export follows the consumer policy.',
|
||||
},
|
||||
{
|
||||
key: 'workspaceRegistry',
|
||||
|
||||
@@ -103,8 +103,9 @@ describe('session format catalog generator', () => {
|
||||
expect(declarations.map(item => [item.from, item.to])).toEqual([[0, 1], [1, 2]])
|
||||
expect(output).toContain("from '@deepseek-ai/dsh-session-format-v0-to-v1'")
|
||||
expect(output).toContain('currentVersion: 2')
|
||||
expect(output).toContain('encodeCurrentArtifact: artifact => releasedV2SessionFormatCodec.encodeArtifact(artifact)')
|
||||
expect(output).toContain('currentEncoder: releasedV2SessionFormatCodec')
|
||||
expect(output).toContain('restoreReleasedV2Artifact(artifact, KNOWN_SESSION_EVENT_TYPES)')
|
||||
expect(output).toContain('restoreTransformedCurrent(artifact)')
|
||||
expect(output).toContain('assertReleasedV2Header(header)')
|
||||
expect(output).toContain('validateInstalledCurrentSessionHeader(header)')
|
||||
expect(output).toContain("from '@deepseek-ai/dsh-session'")
|
||||
|
||||
@@ -191,13 +191,16 @@ export function renderSessionFormatCatalog(
|
||||
'export const sessionFormatCatalog = createSessionFormatCatalog({',
|
||||
` currentVersion: ${currentVersion},`,
|
||||
` codecs: [${codecs.join(', ')}],`,
|
||||
` encodeCurrentArtifact: artifact => ${currentCodec}.encodeArtifact(artifact),`,
|
||||
` currentEncoder: ${currentCodec},`,
|
||||
` migrations: [${declarations.map(item => item.migration).join(', ')}],`,
|
||||
' restoreCurrent(artifact) {',
|
||||
` const restored = ${restorer}(artifact, KNOWN_SESSION_EVENT_TYPES)`,
|
||||
' validateInstalledCurrentSessionArtifact(restored)',
|
||||
' return restored',
|
||||
' },',
|
||||
' restoreTransformedCurrent(artifact) {',
|
||||
` return ${restorer}(artifact, KNOWN_SESSION_EVENT_TYPES)`,
|
||||
' },',
|
||||
' restoreCurrentHeader(header) {',
|
||||
` ${headerValidator}(header)`,
|
||||
' validateInstalledCurrentSessionHeader(header)',
|
||||
|
||||
@@ -39,11 +39,14 @@ const DUPLICATE_SAFE_PACKAGES: readonly string[] = [
|
||||
|
||||
/**
|
||||
* Runtime exports whose values remain valid when npm installs another package copy.
|
||||
* New entries are forbidden by default. Automated agents must not add an
|
||||
* exception; every addition requires explicit human review and a dedicated,
|
||||
* prominent heading in the pull request description.
|
||||
*/
|
||||
const SAFE_HOST_DEPENDENCY_EXPORTS = {
|
||||
'@deepseek-ai/dsh-credentials': ['credentialKey'],
|
||||
'@deepseek-ai/dsh-deque': ['Deque'],
|
||||
'@deepseek-ai/dsh-llm': ['BlockAssembler', 'callConfigEquals', 'expandAssistantStream'],
|
||||
'@deepseek-ai/dsh-llm': ['callConfigEquals'],
|
||||
'@deepseek-ai/dsh-session-format': ['sessionFormatLogFilename'],
|
||||
'@deepseek-ai/dsh-timeout': ['MAX_TIMER_DELAY_MS'],
|
||||
'@deepseek-ai/schemastery': ['default'],
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const workflow = yaml.load(readFileSync(resolve(import.meta.dirname, '../.github/workflows/build-preview-cloudflare.yml'), 'utf8')) as {
|
||||
on: unknown
|
||||
permissions: unknown
|
||||
concurrency: unknown
|
||||
env: Record<string, string>
|
||||
jobs: Record<'preview', {
|
||||
'runs-on': string
|
||||
steps: Array<{ name?: string; uses?: string; run?: string; with?: Record<string, unknown>; env?: Record<string, string> }>
|
||||
}>
|
||||
}
|
||||
const preview = workflow.jobs.preview
|
||||
|
||||
describe('PR preview workflow', () => {
|
||||
it('keeps every PR author on the selected GitHub-hosted runner', () => {
|
||||
expect(Object.keys(workflow.jobs)).toEqual(['preview'])
|
||||
expect(preview['runs-on']).toBe('ubuntu-24.04')
|
||||
expect(workflow.on).toEqual({ pull_request: { types: ['opened', 'synchronize', 'reopened'] } })
|
||||
expect(workflow.permissions).toEqual({ contents: 'read', 'pull-requests': 'write' })
|
||||
expect(preview.steps.find(step => step.uses === 'actions/checkout@v6')?.with).toEqual({ 'persist-credentials': false })
|
||||
})
|
||||
|
||||
it('keeps the immutable full build and restore-only dependency cache', () => {
|
||||
expect(workflow.env.PRIMARY_NODE_VERSION).toBe('24')
|
||||
expect(workflow.env.DSH_TELEMETRY_DISABLED).toBe('1')
|
||||
const commands = preview.steps.map(step => step.run)
|
||||
expect(commands).toContain('pnpm install --frozen-lockfile')
|
||||
expect(commands).toContain('pnpm run build')
|
||||
expect(commands).toContain('pnpm --filter @deepseek-ai/dsh-web-frontend run build:preview')
|
||||
expect(commands.indexOf('pnpm run build')).toBeLessThan(commands.indexOf('pnpm --filter @deepseek-ai/dsh-web-frontend run build:preview'))
|
||||
expect(preview.steps.filter(step => step.uses?.startsWith('actions/cache'))).toHaveLength(1)
|
||||
expect(preview.steps.find(step => step.uses === 'actions/cache/restore@v4')?.with).toMatchObject({
|
||||
key: "${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}",
|
||||
})
|
||||
})
|
||||
|
||||
it('retains per-PR deployment, protected image verification, and idempotent URL comments', () => {
|
||||
expect(workflow.concurrency).toEqual({
|
||||
group: 'build-preview-cloudflare-${{ github.event.pull_request.number }}',
|
||||
'cancel-in-progress': true,
|
||||
})
|
||||
expect(workflow.env.CF_PROJECT).toBe('dsh-build-preview')
|
||||
const shape = preview.steps.find(step => step.name === 'Shape the upload')!
|
||||
expect(shape.run).toContain("find apps/web/dist -name '*.map' -delete")
|
||||
expect(shape.run).toContain('cp apps/web/dist/preview.html apps/web/dist/index.html')
|
||||
const deploy = preview.steps.find(step => step.name === 'Upload to Cloudflare Pages')!
|
||||
expect(deploy.run).toContain('npx --yes wrangler@4 pages deploy apps/web/dist')
|
||||
expect(deploy.run).toContain('--branch "pr-${{ github.event.pull_request.number }}"')
|
||||
const verify = preview.steps.find(step => step.name === 'Verify the protected deployment serves the image')!
|
||||
expect(verify.run).toContain('/preview/vfs-image.tar.gz')
|
||||
expect(verify.run).toContain('"$code" != "200"')
|
||||
expect(verify.run).toContain('content-encoding:')
|
||||
expect(verify.run).toContain('"$magic" != "1f8b"')
|
||||
expect(verify.env?.CF_ACCESS_CLIENT_SECRET).toBe('${{ secrets.CF_ACCESS_CLIENT_SECRET }}')
|
||||
const comment = preview.steps.find(step => step.name === 'Comment the preview URL')!
|
||||
expect(comment.run).toContain('<!-- dsh-preview-url -->')
|
||||
expect(comment.run).toContain('gh pr comment "$PR" --body-file -')
|
||||
})
|
||||
})
|
||||
@@ -141,6 +141,7 @@ describe('gate graph validation', () => {
|
||||
'ci-static',
|
||||
'ci-lint-contracts-ready',
|
||||
'ci-coverage',
|
||||
'ci-bench',
|
||||
'ci-snapshot',
|
||||
'ci-artifacts',
|
||||
'ci-consumers',
|
||||
|
||||
@@ -27,6 +27,7 @@ export type Mode =
|
||||
| 'ci-static'
|
||||
| 'ci-lint-contracts-ready'
|
||||
| 'ci-coverage'
|
||||
| 'ci-bench'
|
||||
| 'ci-snapshot'
|
||||
| 'ci-artifacts'
|
||||
| 'ci-consumers'
|
||||
@@ -137,6 +138,7 @@ function parseMode(raw: string | undefined): Mode {
|
||||
case 'ci-static':
|
||||
case 'ci-lint-contracts-ready':
|
||||
case 'ci-coverage':
|
||||
case 'ci-bench':
|
||||
case 'ci-snapshot':
|
||||
case 'ci-artifacts':
|
||||
case 'ci-consumers':
|
||||
@@ -151,7 +153,7 @@ function parseMode(raw: string | undefined): Mode {
|
||||
return raw
|
||||
default:
|
||||
throw new Error(
|
||||
`run-gates: expected mode ci-primary | ci-linux-primary | ci-static | ci-lint-contracts-ready | ci-coverage | ci-snapshot | ci-artifacts | ci-consumers | ci-windows-blocking | ci-windows-complete | ci-windows-observational | node-compat | check-all | hygiene | doc-sync | doc-quick, got ${JSON.stringify(raw)}.`,
|
||||
`run-gates: expected mode ci-primary | ci-linux-primary | ci-static | ci-lint-contracts-ready | ci-coverage | ci-bench | ci-snapshot | ci-artifacts | ci-consumers | ci-windows-blocking | ci-windows-complete | ci-windows-observational | node-compat | check-all | hygiene | doc-sync | doc-quick, got ${JSON.stringify(raw)}.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -242,6 +244,8 @@ export function gatesForMode(selected: Mode): Gate[] {
|
||||
]
|
||||
case 'ci-coverage':
|
||||
return coverageGates()
|
||||
case 'ci-bench':
|
||||
return [pnpmScript('bench', 'test:bench', { label: 'performance benchmarks' })]
|
||||
case 'ci-snapshot':
|
||||
return [ciBuildGate(), snapshotGate()]
|
||||
case 'ci-artifacts':
|
||||
@@ -787,6 +791,7 @@ function builtBinSmokeGate(needs: string[] = ['build']): Gate {
|
||||
// unbuilt, so these files self-skip there.
|
||||
'packages/workflow/workflow-worker-thread/tests/built-worker.e2e.ts',
|
||||
'packages/code-runtime/code-runtime-worker-thread/tests/built-lib.e2e.ts',
|
||||
'packages/session/session-persistence-jsonl/tests/built-migration-worker.e2e.ts',
|
||||
'packages/lsp/lsp-stdio/tests/built-lib.e2e.ts',
|
||||
], {
|
||||
label: 'built-bin smoke',
|
||||
|
||||
@@ -58,6 +58,51 @@ function validationHeader(value: unknown): unknown {
|
||||
return header
|
||||
}
|
||||
|
||||
function validationRow(source: Readonly<Record<string, unknown>>): Record<string, unknown> {
|
||||
if (source.type !== 'request/header') return { ...source }
|
||||
const data = source.data
|
||||
if (data === null || typeof data !== 'object' || Array.isArray(data)) return { ...source }
|
||||
const header = (data as Record<string, unknown>).header
|
||||
if (header === null || typeof header !== 'object' || Array.isArray(header)) return { ...source }
|
||||
if ((header as Record<string, unknown>).tools !== '{{tools}}') return { ...source }
|
||||
return {
|
||||
...source,
|
||||
data: {
|
||||
...data,
|
||||
header: { ...header, tools: [] },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function restoreRequestHeaderTokens(
|
||||
events: readonly SessionEvent[],
|
||||
rows: readonly Readonly<Record<string, unknown>>[],
|
||||
): SessionEvent[] {
|
||||
const sources = rows.filter(row => row.type === 'request/header')
|
||||
let sourceIndex = 0
|
||||
return events.map((event) => {
|
||||
if (event.type !== 'request/header') return event
|
||||
const source = sources[sourceIndex]
|
||||
sourceIndex += 1
|
||||
const sourceData = source?.data
|
||||
const sourceHeader = sourceData !== null && typeof sourceData === 'object' && !Array.isArray(sourceData)
|
||||
? (sourceData as Record<string, unknown>).header
|
||||
: undefined
|
||||
if (sourceHeader === null || typeof sourceHeader !== 'object' || Array.isArray(sourceHeader)
|
||||
|| (sourceHeader as Record<string, unknown>).tools !== '{{tools}}') return event
|
||||
return {
|
||||
...event,
|
||||
data: {
|
||||
...event.data,
|
||||
header: {
|
||||
...(event.data as unknown as { header: Record<string, unknown> }).header,
|
||||
tools: '{{tools}}',
|
||||
},
|
||||
},
|
||||
} as SessionEvent
|
||||
})
|
||||
}
|
||||
|
||||
function renderFixture(headerLine: string, events: readonly SessionEvent[]): string {
|
||||
return [
|
||||
headerLine,
|
||||
@@ -95,6 +140,7 @@ function parseFixtureObjectLine(line: string, lineNumber: number): Record<string
|
||||
function parseFixtureRows(content: string, headerValue: unknown): SessionEvent[] {
|
||||
const rows: Record<string, unknown>[] = []
|
||||
const rowLines: number[] = []
|
||||
const eventLines: number[] = []
|
||||
let nextSeq: SessionLogOffsetType = SessionLogOffset(0)
|
||||
let headerSkipped = false
|
||||
for (const [index, line] of content.split(/\r?\n/).entries()) {
|
||||
@@ -113,7 +159,9 @@ function parseFixtureRows(content: string, headerValue: unknown): SessionEvent[]
|
||||
if (!Object.hasOwn(record, timeKey)) record[timeKey] = 0
|
||||
rows.push(record)
|
||||
rowLines.push(index + 1)
|
||||
nextSeq = SessionLogOffset(nextSeq + projectedRowCardinality(record))
|
||||
const cardinality = projectedRowCardinality(record)
|
||||
for (let offset = 0; offset < cardinality; offset += 1) eventLines.push(index + 1)
|
||||
nextSeq = SessionLogOffset(nextSeq + cardinality)
|
||||
}
|
||||
// Versionless protocol fixtures and current projected snapshots use scalar
|
||||
// event rows. Current snapshots may contain owner-restored scrub tokens such
|
||||
@@ -143,18 +191,52 @@ function parseFixtureRows(content: string, headerValue: unknown): SessionEvent[]
|
||||
}
|
||||
})
|
||||
}
|
||||
let restore: ReturnType<typeof sessionFormatCatalog.createRestore>
|
||||
try {
|
||||
return [
|
||||
...sessionFormatCatalog.decodeArtifact(validationHeader(headerValue), rows).events,
|
||||
] as unknown as SessionEvent[]
|
||||
restore = sessionFormatCatalog.createRestore(validationHeader(headerValue), {
|
||||
recovery: 'strict',
|
||||
validation: 'current',
|
||||
})
|
||||
} catch (error) {
|
||||
const detail = error instanceof Error ? error.message : String(error)
|
||||
const storedRow = /\brow (\d+)\b/.exec(detail)
|
||||
const line = storedRow === null ? 1 : rowLines[Number(storedRow[1])] ?? 1
|
||||
throw new Error(`session snapshot line 1: ${detail}`, { cause: error })
|
||||
}
|
||||
for (const [index, row] of rows.entries()) {
|
||||
try {
|
||||
restore.decodeRow(validationRow(row))
|
||||
} catch (error) {
|
||||
const detail = error instanceof Error ? error.message : String(error)
|
||||
throw new Error(`session snapshot line ${rowLines[index] ?? 1}: ${detail}`, { cause: error })
|
||||
}
|
||||
}
|
||||
try {
|
||||
return restoreRequestHeaderTokens(
|
||||
[...restore.finish().events] as unknown as SessionEvent[],
|
||||
rows,
|
||||
)
|
||||
} catch (error) {
|
||||
const detail = error instanceof Error ? error.message : String(error)
|
||||
const line = fixtureDiagnosticLine(error, rowLines, eventLines)
|
||||
throw new Error(`session snapshot line ${line}: ${detail}`, { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
function fixtureDiagnosticLine(
|
||||
error: unknown,
|
||||
rowLines: readonly number[],
|
||||
eventLines: readonly number[],
|
||||
): number {
|
||||
const detail = error instanceof Error && error.cause instanceof Error
|
||||
? error.cause.message
|
||||
: error instanceof Error ? error.message : String(error)
|
||||
const physicalRow = /^released Session row (\d+)/.exec(detail)
|
||||
if (physicalRow !== null) return rowLines[Number(physicalRow[1])] ?? 1
|
||||
const event = /Session event (\d+)/.exec(detail)
|
||||
?? / at seq (\d+)/.exec(detail)
|
||||
?? /inherited Session cut (\d+)/.exec(detail)
|
||||
return event === null ? 1 : eventLines[Number(event[1])] ?? 1
|
||||
}
|
||||
|
||||
function withoutEnvelope(events: readonly SessionEvent[]): Array<Omit<SessionEvent, 'seq' | 'time'>> {
|
||||
return events.map((event) => {
|
||||
const { seq: _seq, time: _time, ...projected } = event
|
||||
|
||||
@@ -1227,6 +1227,7 @@ def smoke_sdk_profile_plugin(base_url: str) -> None:
|
||||
if installed.returncode != 0:
|
||||
raise AssertionError(
|
||||
f"Python-installed dsh could not add the external profile plugin: "
|
||||
f"returncode={installed.returncode} (0x{installed.returncode & 0xffffffff:08x}) "
|
||||
f"stdout={installed.stdout!r} stderr={installed.stderr!r}"
|
||||
)
|
||||
manifest = json.loads((dsh_home / "profiles" / "sdk" / "package.json").read_text())
|
||||
@@ -1269,13 +1270,20 @@ def smoke_sdk_snapshot(base_url: str, executable: Path, update_snapshots: bool)
|
||||
dsh_home = root / "home"
|
||||
sessions = dsh_home / "sessions"
|
||||
patch = write_advanced_profile_patch(root, "snapshot.patch.yml", sessions)
|
||||
feedback_patch = write_profile_patch(root, "feedback.patch.yml", sessions, [{"insert": [
|
||||
{"id": "snapshot-message-feedback", "name": "@deepseek-ai/dsh-message-feedback",
|
||||
"config": {"maxNoteBytes": 1024}},
|
||||
{"id": "snapshot-feedback-producer", "name": (
|
||||
Path(__file__).resolve().parent.parent / "snapshots/sdk/text-turn/feedback-producer.mjs"
|
||||
).as_uri()},
|
||||
]}])
|
||||
with DeepSeekHarness(
|
||||
provider="deepseek-official",
|
||||
model="smoke-model",
|
||||
cwd=str(root),
|
||||
dsh_bin=str(executable),
|
||||
dsh_home=str(dsh_home),
|
||||
patches=(str(patch),),
|
||||
patches=(str(patch), str(feedback_patch)),
|
||||
env={
|
||||
"DSH_PERMISSION_MODE": "danger-full-access",
|
||||
"DSH_TELEMETRY_DISABLED": "1",
|
||||
@@ -1287,6 +1295,10 @@ def smoke_sdk_snapshot(base_url: str, executable: Path, update_snapshots: bool)
|
||||
result = harness.run(SNAPSHOT_PROMPT, session_id=SNAPSHOT_SESSION_ID)
|
||||
|
||||
assert result.final_response == SNAPSHOT_FINAL_TEXT, result.final_response
|
||||
feedback_types = [event.get("type") for event in result.events
|
||||
if str(event.get("type")).startswith("feedback/")]
|
||||
if feedback_types != ["feedback/record", "feedback/message-put", "feedback/message-put", "feedback/message-delete"]:
|
||||
raise AssertionError(f"advanced snapshot did not exercise all feedback mutations: {feedback_types}")
|
||||
methods = [notification.method for notification in result.notifications]
|
||||
if methods.count("subagent.started") != 2 or methods.count("subagent.finished") != 2:
|
||||
raise AssertionError(f"advanced snapshot emitted unexpected subagent lifecycle: {methods}")
|
||||
@@ -1725,6 +1737,30 @@ def build_snapshot_files(
|
||||
replacements.append((child_id, f"{{{{child-{index}}}}}"))
|
||||
agent_id = snapshot_agent_id(result, child_id)
|
||||
replacements.append((agent_id, f"{{{{agent-{index}}}}}"))
|
||||
command_index = 0
|
||||
for record in logs[SNAPSHOT_SESSION_ID]:
|
||||
data = record.get("data")
|
||||
if record.get("type") == "command/run" and isinstance(data, dict):
|
||||
command_index += 1
|
||||
replacements.append((data["commandId"], f"{{{{command:{command_index}}}}}"))
|
||||
if record.get("type") == "command/done" and isinstance(data, dict):
|
||||
anonymous = re.search(r"Anonymous user: ([0-9a-f-]{36})", str(data.get("text")))
|
||||
if anonymous is not None:
|
||||
replacements.append((anonymous.group(1), "{{anonymous-user}}"))
|
||||
feedback_targets = dict.fromkeys(
|
||||
record["data"]["item"]["messageId"]
|
||||
for record in logs[SNAPSHOT_SESSION_ID]
|
||||
if record.get("type") == "feedback/message-put"
|
||||
)
|
||||
for index, message_id in enumerate(feedback_targets, start=1):
|
||||
replacements.append((message_id, f"{{{{message:{index}}}}}"))
|
||||
feedback_versions = dict.fromkeys(
|
||||
record["data"]["item"]["version"]
|
||||
for record in logs[SNAPSHOT_SESSION_ID]
|
||||
if record.get("type") == "feedback/message-put"
|
||||
)
|
||||
for index, version in enumerate(feedback_versions, start=1):
|
||||
replacements.append((version, f"{{{{feedback-version:{index}}}}}"))
|
||||
replacements.sort(key=lambda pair: len(pair[0]), reverse=True)
|
||||
|
||||
result_value = {
|
||||
@@ -1902,7 +1938,16 @@ def normalize_snapshot_value(
|
||||
if isinstance(dt, list):
|
||||
member["dt"] = [0] * len(dt)
|
||||
if isinstance(normalized.get("id"), str) and normalized.get("role") in ("assistant", "user"):
|
||||
normalized["id"] = "{{messageId}}"
|
||||
if not normalized["id"].startswith("{{message:"):
|
||||
normalized["id"] = "{{messageId}}"
|
||||
if normalized.get("type") in ("feedback/message-put", "feedback/message-delete"):
|
||||
data = normalized.get("data")
|
||||
if isinstance(data, dict):
|
||||
item = data.get("item") if normalized["type"] == "feedback/message-put" else data
|
||||
if isinstance(item, dict):
|
||||
if normalized["type"] == "feedback/message-put":
|
||||
item["createdAt"] = 0
|
||||
item["updatedAt"] = 0
|
||||
scrub_snapshot_header(normalized)
|
||||
return normalized
|
||||
|
||||
|
||||
@@ -1335,7 +1335,7 @@
|
||||
"provider": "deepseek-official",
|
||||
"model": "smoke-model"
|
||||
},
|
||||
"id": "{{messageId}}"
|
||||
"id": "{{message:1}}"
|
||||
},
|
||||
"usage": {
|
||||
"inputTokens": 3,
|
||||
@@ -1409,9 +1409,80 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "turn/end",
|
||||
"type": "command/run",
|
||||
"seq": 59,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"commandId": "{{command:1}}",
|
||||
"name": "feedback",
|
||||
"source": {
|
||||
"kind": "user"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "feedback/record",
|
||||
"seq": 60,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"text": "The session needs a clearer explanation."
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "command/done",
|
||||
"seq": 61,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"commandId": "{{command:1}}",
|
||||
"kind": "success",
|
||||
"text": "Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "feedback/message-put",
|
||||
"seq": 62,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"sessionId": "{{parent}}",
|
||||
"item": {
|
||||
"messageId": "{{message:1}}",
|
||||
"rating": "negative",
|
||||
"note": "Explain the result.",
|
||||
"version": "{{feedback-version:1}}",
|
||||
"createdAt": 0,
|
||||
"updatedAt": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "feedback/message-put",
|
||||
"seq": 63,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"sessionId": "{{parent}}",
|
||||
"item": {
|
||||
"messageId": "{{message:1}}",
|
||||
"rating": "positive",
|
||||
"note": "The explanation is clear now.",
|
||||
"version": "{{feedback-version:2}}",
|
||||
"createdAt": 0,
|
||||
"updatedAt": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "feedback/message-delete",
|
||||
"seq": 64,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"sessionId": "{{parent}}",
|
||||
"messageId": "{{message:1}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "turn/end",
|
||||
"seq": 65,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"turn": 1,
|
||||
"reason": {
|
||||
@@ -3942,7 +4013,7 @@
|
||||
"provider": "deepseek-official",
|
||||
"model": "smoke-model"
|
||||
},
|
||||
"id": "{{messageId}}"
|
||||
"id": "{{message:1}}"
|
||||
},
|
||||
"usage": {
|
||||
"inputTokens": 3,
|
||||
@@ -4028,9 +4099,116 @@
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "turn/end",
|
||||
"type": "command/run",
|
||||
"seq": 59,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"commandId": "{{command:1}}",
|
||||
"name": "feedback",
|
||||
"source": {
|
||||
"kind": "user"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "feedback/record",
|
||||
"seq": 60,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"text": "The session needs a clearer explanation."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "command/done",
|
||||
"seq": 61,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"commandId": "{{command:1}}",
|
||||
"kind": "success",
|
||||
"text": "Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "feedback/message-put",
|
||||
"seq": 62,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"sessionId": "{{parent}}",
|
||||
"item": {
|
||||
"messageId": "{{message:1}}",
|
||||
"rating": "negative",
|
||||
"note": "Explain the result.",
|
||||
"version": "{{feedback-version:1}}",
|
||||
"createdAt": 0,
|
||||
"updatedAt": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "feedback/message-put",
|
||||
"seq": 63,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"sessionId": "{{parent}}",
|
||||
"item": {
|
||||
"messageId": "{{message:1}}",
|
||||
"rating": "positive",
|
||||
"note": "The explanation is clear now.",
|
||||
"version": "{{feedback-version:2}}",
|
||||
"createdAt": 0,
|
||||
"updatedAt": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "feedback/message-delete",
|
||||
"seq": 64,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"sessionId": "{{parent}}",
|
||||
"messageId": "{{message:1}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "{{parent}}",
|
||||
"event": {
|
||||
"type": "turn/end",
|
||||
"seq": 65,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"turn": 1,
|
||||
"reason": {
|
||||
|
||||
@@ -56,6 +56,12 @@
|
||||
{"type":"step/start","data":{"turn":1,"step":7}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"system":"{{system}}","tools":["cordis_define","cordis_inspect_list","cordis_inspect_query","cordis_inspect_self","cordis_run","cordis_stop","cordis_undefine","job_kill","job_list","job_output","run_code","subagent","workflow"]},"reason":"change"}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":2,"throughSeq":55}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":7,"message":{"role":"assistant","content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model"},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ADVANCED_EXECUTABLE_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":7,"message":{"role":"assistant","content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model"},"id":"{{message:1}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ADVANCED_EXECUTABLE_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":7}}
|
||||
{"type":"command/run","data":{"commandId":"{{command:1}}","name":"feedback","source":{"kind":"user"}}}
|
||||
{"type":"feedback/record","data":{"text":"The session needs a clearer explanation."}}
|
||||
{"type":"command/done","data":{"commandId":"{{command:1}}","kind":"success","text":"Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."}}
|
||||
{"type":"feedback/message-put","data":{"sessionId":"{{parent}}","item":{"messageId":"{{message:1}}","rating":"negative","note":"Explain the result.","version":"{{feedback-version:1}}","createdAt":0,"updatedAt":0}}}
|
||||
{"type":"feedback/message-put","data":{"sessionId":"{{parent}}","item":{"messageId":"{{message:1}}","rating":"positive","note":"The explanation is clear now.","version":"{{feedback-version:2}}","createdAt":0,"updatedAt":0}}}
|
||||
{"type":"feedback/message-delete","data":{"sessionId":"{{parent}}","messageId":"{{message:1}}"}}
|
||||
{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}}
|
||||
@@ -33,7 +33,8 @@ describe('ambient proxy environment', () => {
|
||||
it('finds the configurations that declare a setup at all', () => {
|
||||
// Guards the discovery itself: a glob that stopped matching would make every case below vacuous.
|
||||
expect(declared.map(entry => entry.config)).toEqual([
|
||||
'vitest.config.ts', 'vitest.e2e.config.ts', 'vitest.expected.config.ts', 'vitest.snapshot.config.ts',
|
||||
'vitest.bench.config.ts', 'vitest.config.ts', 'vitest.e2e.config.ts', 'vitest.expected.config.ts',
|
||||
'vitest.snapshot.config.ts',
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/** Release rehearsal routing and persistent-runner isolation, without executing release builds. */
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { runInNewContext } from 'node:vm'
|
||||
import { load } from 'js-yaml'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const root = resolve(import.meta.dirname, '../..')
|
||||
const repository = 'deepseek-harness/deepseek-harness'
|
||||
const selfhosted = ['self-hosted', 'linux', 'x64', 'vm-backup']
|
||||
const hosted = 'ubuntu-24.04'
|
||||
|
||||
interface Step {
|
||||
name?: string
|
||||
uses?: string
|
||||
run?: string
|
||||
if?: string
|
||||
with?: Record<string, unknown>
|
||||
}
|
||||
interface Workflow {
|
||||
on: Record<string, unknown>
|
||||
permissions: Record<string, string>
|
||||
concurrency?: Record<string, unknown>
|
||||
jobs: Record<string, { name: string; 'runs-on': string; steps: Step[] }>
|
||||
}
|
||||
|
||||
function workflow(file: string): Workflow {
|
||||
return load(readFileSync(resolve(root, '.github/workflows', file), 'utf8')) as Workflow
|
||||
}
|
||||
|
||||
// This canonical-case corpus has matching Actions/JavaScript comparison results.
|
||||
// This is not an Actions interpreter: string case-folding and general coercion differ.
|
||||
// Missing context properties use the Actions empty-string value.
|
||||
function evaluate(expression: string, context: Record<string, string | boolean>): unknown {
|
||||
const source = expression.trim().replace(/^\$\{\{|\}\}$/g, '')
|
||||
.replace(/\b(?:github|vars|runner)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+/g,
|
||||
key => JSON.stringify(context[key] ?? ''))
|
||||
return runInNewContext(source, { fromJSON: JSON.parse }, { timeout: 1000 }) as unknown
|
||||
}
|
||||
|
||||
const trustedPr = {
|
||||
'vars.DSH_CI_FAILOVER_LINUX': 'selfhosted',
|
||||
'github.repository': repository,
|
||||
'github.actor': 'maintainer',
|
||||
'github.event_name': 'pull_request',
|
||||
'github.ref': 'refs/pull/42/merge',
|
||||
'github.event.pull_request.head.repo.full_name': repository,
|
||||
'github.event.pull_request.head.repo.fork': false,
|
||||
'github.event.pull_request.user.login': 'contributor',
|
||||
}
|
||||
const trustedPush = {
|
||||
'vars.DSH_CI_FAILOVER_LINUX': 'selfhosted',
|
||||
'github.repository': repository,
|
||||
'github.actor': 'maintainer',
|
||||
'github.event_name': 'push',
|
||||
'github.ref': 'refs/heads/master',
|
||||
}
|
||||
const fallbackCases: Array<[string, Record<string, string | boolean>]> = [
|
||||
['unset switch', { ...trustedPr, 'vars.DSH_CI_FAILOVER_LINUX': '' }],
|
||||
['hosted switch', { ...trustedPr, 'vars.DSH_CI_FAILOVER_LINUX': 'hosted' }],
|
||||
['unknown switch', { ...trustedPr, 'vars.DSH_CI_FAILOVER_LINUX': 'true' }],
|
||||
['fork PR', { ...trustedPr, 'github.event.pull_request.head.repo.full_name': 'outsider/fork', 'github.event.pull_request.head.repo.fork': true }],
|
||||
['different head repository', { ...trustedPr, 'github.event.pull_request.head.repo.full_name': 'outsider/repo' }],
|
||||
['fork flag', { ...trustedPr, 'github.event.pull_request.head.repo.fork': true }],
|
||||
['Dependabot author rerun by maintainer', { ...trustedPr, 'github.event.pull_request.user.login': 'dependabot[bot]' }],
|
||||
['Dependabot PR actor', { ...trustedPr, 'github.actor': 'dependabot[bot]' }],
|
||||
['Dependabot push actor', { ...trustedPush, 'github.actor': 'dependabot[bot]' }],
|
||||
['non-master push', { ...trustedPush, 'github.ref': 'refs/heads/topic' }],
|
||||
['tag push', { ...trustedPush, 'github.ref': 'refs/tags/dsh-v1.0.0' }],
|
||||
['push in another repository', { ...trustedPush, 'github.repository': 'outsider/fork' }],
|
||||
['dispatch on master', { ...trustedPush, 'github.event_name': 'workflow_dispatch' }],
|
||||
['dispatch on topic', { ...trustedPush, 'github.event_name': 'workflow_dispatch', 'github.ref': 'refs/heads/topic' }],
|
||||
['dispatch on tag', { ...trustedPush, 'github.event_name': 'workflow_dispatch', 'github.ref': 'refs/tags/dsh-v1.0.0' }],
|
||||
['pull_request_target', { ...trustedPr, 'github.event_name': 'pull_request_target' }],
|
||||
['missing PR payload', { ...trustedPush, 'github.event_name': 'pull_request' }],
|
||||
]
|
||||
|
||||
for (const [file, jobIds] of [['release.yml', ['dependencies', 'pack']], ['release-vendor.yml', ['pack']]] as const) {
|
||||
describe(file, () => {
|
||||
const release = workflow(file)
|
||||
it('preserves the logical jobs, rehearsal events and read-only permission', () => {
|
||||
expect(Object.keys(release.jobs)).toEqual(jobIds)
|
||||
expect(release.on).toEqual({ pull_request: null, push: { branches: ['master'] }, workflow_dispatch: null })
|
||||
expect(release.permissions).toEqual({ contents: 'read' })
|
||||
expect(release.concurrency).toEqual({ group: '${{ github.workflow }}-${{ github.ref }}', 'cancel-in-progress': false })
|
||||
})
|
||||
for (const jobId of jobIds) {
|
||||
describe(jobId, () => {
|
||||
const job = release.jobs[jobId]!
|
||||
it('routes trusted PRs and master pushes onto the existing Linux pool', () => {
|
||||
expect(evaluate(job['runs-on'], trustedPr)).toEqual(selfhosted)
|
||||
expect(evaluate(job['runs-on'], trustedPush)).toEqual(selfhosted)
|
||||
expect(evaluate(job['runs-on'], { ...trustedPush, 'vars.DSH_CI_FAILOVER_LINUX': '' })).toBe(hosted)
|
||||
})
|
||||
it.each(fallbackCases)('keeps %s hosted', (_name, context) => {
|
||||
expect(evaluate(job['runs-on'], context)).toBe(hosted)
|
||||
})
|
||||
it('cleans stale checkout output and isolates setup before any pnpm invocation', () => {
|
||||
expect(job.steps[0]).toMatchObject({ uses: 'actions/checkout@v6', with: { clean: true, 'persist-credentials': false } })
|
||||
const cacheIndex = job.steps.findIndex(step => step.run?.includes('NODE_COMPILE_CACHE='))
|
||||
const pnpmIndex = job.steps.findIndex(step => step.uses?.startsWith('pnpm/') || /\bpnpm\b/.test(step.run ?? ''))
|
||||
expect(cacheIndex).toBeGreaterThan(0)
|
||||
expect(cacheIndex).toBeLessThan(pnpmIndex)
|
||||
expect(job.steps[cacheIndex]?.run).toContain('echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"')
|
||||
expect(job.steps[cacheIndex]?.run).toContain('echo "npm_config_devdir=${{ runner.temp }}/node-gyp" >> "$GITHUB_ENV"')
|
||||
expect(job.steps[cacheIndex]?.run).toContain('echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"')
|
||||
expect(job.steps.find(step => step.uses === 'pnpm/action-setup@v4')?.with?.dest)
|
||||
.toBe('${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}')
|
||||
expect(job.steps.find(step => step.name === 'Install (immutable)')?.run).toBe('pnpm install --frozen-lockfile')
|
||||
})
|
||||
it('uses the persistent store without remote cache reads or writes on self-hosted', () => {
|
||||
expect(job.steps.find(step => step.name === 'Configure pnpm store path')?.run).toContain('store_root="$HOME/.local/share/pnpm/store"')
|
||||
const caches = job.steps.filter(step => step.uses?.startsWith('actions/cache'))
|
||||
expect(caches.map(step => step.uses)).toEqual(['actions/cache/restore@v4'])
|
||||
for (const step of caches) {
|
||||
expect(evaluate(step.if!, { 'runner.environment': 'self-hosted' })).toBe(false)
|
||||
expect(evaluate(step.if!, { 'runner.environment': 'github-hosted' })).toBe(true)
|
||||
}
|
||||
const nodeSetup = job.steps.find(step => step.uses === 'actions/setup-node@v6')
|
||||
expect(nodeSetup?.with?.cache).toBeUndefined()
|
||||
expect(nodeSetup?.with?.['package-manager-cache']).toBe(false)
|
||||
})
|
||||
it('retains the dependency and pack verification commands', () => {
|
||||
const commands = job.steps.flatMap(step => step.run === undefined ? [] : [step.run])
|
||||
if (jobId === 'dependencies') {
|
||||
expect(commands).toContain('pnpm run verify-package-dependencies')
|
||||
expect(commands).toContain('pnpm run verify-npm-install-layout')
|
||||
} else {
|
||||
const family = file === 'release.yml' ? 'dsh' : 'vendor'
|
||||
const output = family === 'dsh' ? 'dist/npm' : 'dist/npm-vendor'
|
||||
expect(job.steps[0]?.with?.['fetch-depth']).toBe(0)
|
||||
expect(commands).toContain('pnpm run release:verify --family ' + family)
|
||||
expect(commands).toContain('pnpm run ' + (family === 'dsh' ? 'build:official' : 'build:lib:host'))
|
||||
expect(commands).toContain('pnpm run release:pack --family ' + family + ' --out ' + output + ' --concurrency 8')
|
||||
expect(commands).toContain('pnpm run release:verify-packed-install --family ' + family + ' --from ' + output
|
||||
+ (family === 'dsh' ? ' --from dist/npm-vendor --from dist/npm-landlock' : ''))
|
||||
expect(job.steps.at(-1)).toMatchObject({ uses: 'actions/upload-artifact@v4', with: { path: output + '/*', 'retention-days': 7 } })
|
||||
}
|
||||
expect(JSON.stringify(job)).not.toMatch(/secrets\.|release:publish|npm-publish/)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
it.each(['release-publish.yml', 'release-vendor-publish.yml'])('keeps %s manual and entirely hosted', (file) => {
|
||||
const publish = workflow(file)
|
||||
expect(publish.on).toEqual({ workflow_dispatch: null })
|
||||
for (const job of Object.values(publish.jobs)) expect(job['runs-on']).toBe(hosted)
|
||||
})
|
||||
@@ -545,6 +545,11 @@
|
||||
"source": "packages/core/session/src/index.ts",
|
||||
"projection": "public-api"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/persistence.md",
|
||||
"symbol": "SessionHandleReadResult",
|
||||
"source": "packages/session/session-persistence/src/handle.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/persistence.md",
|
||||
"symbol": "SessionHandle",
|
||||
@@ -560,6 +565,11 @@
|
||||
"symbol": "CreateSessionOptions",
|
||||
"source": "packages/core/session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/persistence.md",
|
||||
"symbol": "SessionSeedEventState",
|
||||
"source": "packages/core/session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/persistence.md",
|
||||
"symbol": "RestoredSessionOptions",
|
||||
@@ -1811,6 +1821,16 @@
|
||||
"symbol": "ClientArtifactBaseline",
|
||||
"source": "packages/client/modules/src/index.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/session-telemetry.md",
|
||||
"symbol": "SessionTelemetryCapture",
|
||||
"source": "packages/session/session-telemetry/src/coordinator.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/session-telemetry.md",
|
||||
"symbol": "SessionTelemetryCaptureOptions",
|
||||
"source": "packages/session/session-telemetry/src/coordinator.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/session-telemetry.md",
|
||||
"symbol": "SessionTelemetrySharingStatus",
|
||||
@@ -1951,6 +1971,16 @@
|
||||
"symbol": "MessageFeedbackItem",
|
||||
"source": "packages/feedback/message-feedback/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/feedback.md",
|
||||
"symbol": "MessageFeedbackPut",
|
||||
"source": "packages/feedback/message-feedback/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/feedback.md",
|
||||
"symbol": "MessageFeedbackDelete",
|
||||
"source": "packages/feedback/message-feedback/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/feedback.md",
|
||||
"symbol": "MessageFeedbackListRequest",
|
||||
|
||||
@@ -91,7 +91,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/ui-conversation': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/ui-approval': { kind: 'none', reason: 'Browser-side approval presentation; registers nothing model-facing.' },
|
||||
'packages/client/ui-chat': { kind: 'none', reason: 'Browser-side Chat presentation; registers nothing model-facing.' },
|
||||
'packages/client/ui-message-feedback': { kind: 'none', reason: 'Browser-side controls over the message-feedback sidecar; ratings and notes never enter the Session log, model context, or telemetry.' },
|
||||
'packages/client/ui-message-feedback': { kind: 'none', reason: 'Browser-side controls over log-only message feedback; ratings and notes never enter model context or change model-input tokens.' },
|
||||
'packages/client/ui-tool': { kind: 'none', reason: 'Browser-side Tool presentation layer; renders logged calls without changing model context.' },
|
||||
'packages/client/ui-jobs': { kind: 'none', reason: 'Browser-side read-only projection of ctx.jobs records; dsh-tool-jobs owns the model-facing behavior.' },
|
||||
'packages/client/ui-schedule': { kind: 'none', reason: 'Browser-side read-only projection of active Schedule records; dsh-schedule owns the model-facing tools and delivery.' },
|
||||
|
||||
Reference in new issue
Block a user