Files
deepseek-harness/scripts/snapshot-shards.ts
2026-07-21 21:28:49 +08:00

45 lines
1.6 KiB
TypeScript

/** Snapshot-lane definitions for GitHub Actions. */
/** One explicit snapshot file lane, optionally split again by ACP scenarios. */
export interface SnapshotLane {
/** Stable lane name passed through `DSH_SNAPSHOT_LANE`. */
name: string
/** Snapshot test files owned by the lane. */
files: readonly string[]
/** Optional one-based ACP scenario partition. */
scenarioShard?: string
}
/** Exhaustive file ownership plus scenario partitions for the large ACP suite. */
export const snapshotLanes: readonly SnapshotLane[] = [
{
name: 'ordinary',
files: [
'packages/sdk/scripts/tests/config.snapshot.ts',
'packages/sdk/create-sdk/tests/create.snapshot.ts',
'packages/ui/tui/tests/tui.snapshot.ts',
'examples/tui-agent/tests/tui.snapshot.ts',
'examples/acp-agent/tests/goal.snapshot.ts',
'examples/headless-agent/tests/headless.snapshot.ts',
],
},
...Array.from({ length: 4 }, (_, offset) => ({
name: `acp-${offset + 1}`,
files: ['examples/acp-agent/tests/acp.snapshot.ts'],
scenarioShard: `${offset + 1}/4`,
})),
]
/**
* Resolve one CI lane while preserving a complete ordinary snapshot run.
*
* @param name Optional stable lane name.
* @returns An empty file list for the full suite, or one explicit CI lane.
*/
export function selectSnapshotLane(name?: string): SnapshotLane {
if (name === undefined || name === '') return { name: 'complete', files: [] }
const lane = snapshotLanes.find(candidate => candidate.name === name)
if (lane === undefined) throw new Error(`run-gates: unknown DSH_SNAPSHOT_LANE ${JSON.stringify(name)}.`)
return lane
}