merge: update the session-log-v4 integration base from master
Merge a2acc7d3eb620bb52f09f7ea3b5a3a1c23353e18 after preserving the earlier master checkpoint and its successful CI. Carry current provider input-history handling, UI controls, agent targeting, and runner-concurrency changes into the integration base without changing the Session migration feature layers. Keep durable direct-child catalog semantics alongside the upstream running / inactive vocabulary. Resolve the snapshot description conflicts by retaining that upstream status text and the existing descendants-only diagnostic rule; the source and all 53 JSON tool descriptions agree. Preserve parent-session availability handling with the upstream stale-blank and batched-history fixes. The merged application builds, all 41 documentation gates pass, and focused provider, tool-control, and Session Controller tests pass (98, 29, and 125). Recorded input changes come from master: one refreshed v3 list-agents sample and three new v3 scenarios; no migration bumps an existing snapshot generation.
This commit is contained in:
commit
c3cfe83d2e
343 files changed
+8368
-2217
No files matched your search
+32
-15
@@ -155,7 +155,6 @@ describe('CI workflow', () => {
|
||||
|| !isRecord(workflow.jobs['windows-build'])
|
||||
|| !isRecord(workflow.jobs['windows-coverage'])
|
||||
|| !isRecord(workflow.jobs['windows-native-tests'])
|
||||
|| !isRecord(workflow.jobs['windows-observational'])
|
||||
|| !isRecord(workflow.jobs['node-24'])
|
||||
|| !isRecord(workflow.jobs['node-24-coverage'])
|
||||
|| !isRecord(workflow.jobs['node-24-bench'])
|
||||
@@ -164,13 +163,12 @@ describe('CI workflow', () => {
|
||||
|| !isRecord(workflow.jobs['all-checks-passed'])
|
||||
|| !isRecord(masterWorkflow.jobs)
|
||||
|| !isRecord(masterWorkflow.jobs['serial-windows'])) {
|
||||
throw new TypeError('CI workflow must define 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 serial-windows')
|
||||
throw new TypeError('CI workflow must define windows-build, windows-coverage, windows-native-tests, node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, and all-checks-passed; ci-master must define serial-windows')
|
||||
}
|
||||
|
||||
const windowsBuild = workflow.jobs['windows-build']
|
||||
const windowsCoverage = workflow.jobs['windows-coverage']
|
||||
const windowsNativeTests = workflow.jobs['windows-native-tests']
|
||||
const windowsObservational = workflow.jobs['windows-observational']
|
||||
const serialWindows = masterWorkflow.jobs['serial-windows']
|
||||
const node24 = workflow.jobs['node-24']
|
||||
const node24Coverage = workflow.jobs['node-24-coverage']
|
||||
@@ -182,7 +180,7 @@ describe('CI workflow', () => {
|
||||
throw new TypeError('CI aggregate must define needs')
|
||||
}
|
||||
// The split native jobs all resolve their pool through the Windows switch.
|
||||
for (const [jobName, job] of [['windows-build', windowsBuild], ['windows-coverage', windowsCoverage], ['windows-native-tests', windowsNativeTests], ['windows-observational', windowsObservational]] as const) {
|
||||
for (const [jobName, job] of [['windows-build', windowsBuild], ['windows-coverage', windowsCoverage], ['windows-native-tests', windowsNativeTests]] as const) {
|
||||
expect(typeof job['runs-on']).toBe('string')
|
||||
expect(job['runs-on'], `${jobName} runs-on must use the Windows failover switch`).toContain('DSH_CI_FAILOVER_WINDOWS')
|
||||
expect(job['runs-on'], `${jobName} runs-on must not use the Linux failover switch`).not.toContain('DSH_CI_FAILOVER_LINUX')
|
||||
@@ -196,20 +194,20 @@ describe('CI workflow', () => {
|
||||
}
|
||||
|
||||
// windows-build runs the blocking build/site pair.
|
||||
expect(windowsBuild.name).toBe('windows node 24 / build')
|
||||
expect(windowsBuild.name).toBe('windows node 24 / build & observational')
|
||||
const buildSteps = windowsBuild.steps as unknown[]
|
||||
const buildCommands = buildSteps.filter((step): step is Record<string, unknown> & { run: string } => (
|
||||
isRecord(step) && typeof step.run === 'string'
|
||||
))
|
||||
expect(buildCommands.map(step => step.run)).toContain('pnpm run check:ci:windows-blocking')
|
||||
|
||||
// The four native Windows installs branch on the workspace filesystem:
|
||||
// Native Windows installs branch on the workspace filesystem:
|
||||
// clone (ReFS block clone) only on ReFS, plain install elsewhere. This
|
||||
// keeps the TS6231 store-path leak (see the Windows ReFS store note) out
|
||||
// of the self-hosted pool without forcing clone onto hosted NTFS, which
|
||||
// rejects copy-on-write. The branch must stay, or a hosted fallback would
|
||||
// fail installs with ERR_PNPM_LINKING_FAILED.
|
||||
for (const [jobName, job] of [['windows-build', windowsBuild], ['windows-coverage', windowsCoverage], ['windows-native-tests', windowsNativeTests], ['windows-observational', windowsObservational]] as const) {
|
||||
for (const [jobName, job] of [['windows-build', windowsBuild], ['windows-coverage', windowsCoverage], ['windows-native-tests', windowsNativeTests]] as const) {
|
||||
const steps = job.steps as unknown[]
|
||||
const install = steps.find((step): step is Record<string, unknown> & { run: string } => (
|
||||
isRecord(step) && step.name === 'Install (immutable)' && typeof step.run === 'string'
|
||||
@@ -232,9 +230,8 @@ describe('CI workflow', () => {
|
||||
expect(install!.run).not.toContain('$cloneFlag')
|
||||
}
|
||||
|
||||
// windows-coverage uses the lower 4-partition profile.
|
||||
expect(windowsCoverage.name).toBe('windows node 24 / coverage')
|
||||
expect(windowsCoverage.env).toMatchObject({ DSH_COVERAGE_PARTITIONS: '4' })
|
||||
expect(windowsCoverage.env).toMatchObject({ DSH_COVERAGE_PARTITIONS: "${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '4' || '' }}" })
|
||||
const coverageSteps = windowsCoverage.steps as unknown[]
|
||||
const coverageCommands = coverageSteps.filter((step): step is Record<string, unknown> & { run: string } => (
|
||||
isRecord(step) && typeof step.run === 'string'
|
||||
@@ -261,9 +258,30 @@ describe('CI workflow', () => {
|
||||
expect(nativeTestCommand).toContain('tool-pwsh/tests/loader.spec.ts')
|
||||
expect(nativeTestCommand).toContain('workflow-ptc.spec.ts')
|
||||
|
||||
// windows-observational is non-blocking.
|
||||
expect(windowsObservational.name).toBe('windows node 24 / observational')
|
||||
expect(windowsObservational['continue-on-error']).toBe(true)
|
||||
expect(workflow.jobs['windows-observational']).toBeUndefined()
|
||||
expect(windowsBuild['continue-on-error']).not.toBe(true)
|
||||
const observational = buildCommands.find(step => step.id === 'observational')
|
||||
expect(observational).toMatchObject({
|
||||
run: 'pnpm run check:ci:windows-observational-ready',
|
||||
shell: 'pwsh',
|
||||
'continue-on-error': true,
|
||||
'timeout-minutes': 15,
|
||||
env: {
|
||||
DSH_GATE_FAIL_FAST: '',
|
||||
DSH_PUBLINT_CONCURRENCY: "${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '' }}",
|
||||
},
|
||||
})
|
||||
expect(observational?.if).toBeUndefined()
|
||||
expect(buildCommands.findIndex(step => step.id === 'observational'))
|
||||
.toBeGreaterThan(buildCommands.findIndex(step => step.run === 'pnpm run check:ci:windows-blocking'))
|
||||
const report = buildCommands.find(step => step.name === 'Report Windows observational failures')
|
||||
expect(report).toMatchObject({
|
||||
'continue-on-error': true,
|
||||
if: "steps.observational.outcome == 'failure'",
|
||||
shell: 'pwsh',
|
||||
})
|
||||
expect(report?.run).toContain('::warning::')
|
||||
expect(report?.run).toContain('Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append')
|
||||
|
||||
// serial-windows: master-only standby, self-hosted, non-blocking, lives in ci-master.
|
||||
expect(serialWindows.if).toBe("github.event_name == 'push' && github.ref == 'refs/heads/master'")
|
||||
@@ -332,7 +350,7 @@ describe('CI workflow', () => {
|
||||
expect(job['runs-on'], `${jobName} runs-on must not use the Windows failover switch`).not.toContain('DSH_CI_FAILOVER_WINDOWS')
|
||||
expect(job['runs-on']).toContain('vm-backup')
|
||||
expect(evaluateRunsOn(job['runs-on'], { vars: { DSH_CI_FAILOVER_LINUX: 'blacksmith' } }))
|
||||
.toBe('blacksmith-16vcpu-ubuntu-2404')
|
||||
.toBe(`blacksmith-${jobName === 'node-24' ? 8 : 16}vcpu-ubuntu-2404`)
|
||||
}
|
||||
expect(aggregate['runs-on']).toContain('DSH_CI_FAILOVER_LINUX')
|
||||
expect(aggregate['runs-on']).not.toContain('DSH_CI_FAILOVER_WINDOWS')
|
||||
@@ -386,8 +404,7 @@ describe('CI workflow', () => {
|
||||
// The observational lane stays complete: it is continue-on-error by design
|
||||
// and exists to collect as much Windows-native evidence per run as
|
||||
// possible, so the first failure must not truncate the rest.
|
||||
expect(windowsObservational.env).toBeDefined()
|
||||
expect(windowsObservational.env).not.toMatchObject({ DSH_GATE_FAIL_FAST: '1' })
|
||||
expect(observational?.env).toMatchObject({ DSH_GATE_FAIL_FAST: '' })
|
||||
})
|
||||
|
||||
it('gates standalone keyless blacksmith jobs and benchmark tiers on the failover variables', () => {
|
||||
|
||||
@@ -49,7 +49,6 @@ describe('release families', () => {
|
||||
.filter(member => member.directory.startsWith('packages/experimental/'))
|
||||
.map(member => member.name)).toEqual([
|
||||
'@deepseek-ai/dsh-experimental-agent-team-profile',
|
||||
'@deepseek-ai/dsh-experimental-agent-team-web-profile',
|
||||
'@deepseek-ai/dsh-experimental-agent-team',
|
||||
'@deepseek-ai/dsh-experimental-auto-review',
|
||||
'@deepseek-ai/dsh-experimental-browser-use-chrome-devtools-mcp',
|
||||
|
||||
+108
-8
@@ -1,7 +1,8 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { describe, expect, it, vi, type MockInstance } from 'vitest'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest'
|
||||
import {
|
||||
cliGateOptions,
|
||||
ciWorkerEnvironment,
|
||||
collectDescendants,
|
||||
defaultConcurrency,
|
||||
formatGateResultReason,
|
||||
@@ -14,6 +15,10 @@ import {
|
||||
type GateResult,
|
||||
} from './run-gates.ts'
|
||||
|
||||
// Graph fixtures select their own browser pool instead of inheriting the CI host's pool.
|
||||
beforeEach(() => vi.stubEnv('DSH_WEB_SNAPSHOT_WORKERS', undefined))
|
||||
afterEach(() => vi.unstubAllEnvs())
|
||||
|
||||
/**
|
||||
* Capture output a gate streams through runGate's streamOutput path.
|
||||
* @returns the accumulated chunks and the stdout spy to restore in finally.
|
||||
@@ -135,6 +140,59 @@ function withEnv<T>(name: string, value: string | undefined, action: () => T): T
|
||||
}
|
||||
}
|
||||
|
||||
describe('CI worker allocation', () => {
|
||||
it.each([1, 2, 4, 8, 16, 64])('shares a %i CPU coverage budget without multiplying pools', (cpus) => {
|
||||
const env = ciWorkerEnvironment('ci-coverage', {}, cpus)
|
||||
const exempt = Math.max(1, Math.floor(cpus / 3))
|
||||
const instrumented = Number(env.DSH_COVERAGE_PARTITIONS ?? 1)
|
||||
expect(Number(env.DSH_COVERAGE_MAX_WORKERS)).toBe(cpus)
|
||||
expect(instrumented + exempt).toBe(Math.max(2, cpus))
|
||||
expect(defaultConcurrency('ci-coverage', 3, cpus).workers).toBe(Math.min(3, cpus))
|
||||
if (cpus <= 2) expect(env.DSH_COVERAGE_PARTITIONS).toBeUndefined()
|
||||
})
|
||||
|
||||
it('bounds overlapping readers and lets the isolated browser pool use the runner', () => {
|
||||
const env = ciWorkerEnvironment('ci-consumers', {}, 16)
|
||||
expect(env).toMatchObject({
|
||||
DSH_OXLINT_THREADS: '8',
|
||||
DSH_PUBLINT_CONCURRENCY: '8',
|
||||
DSH_SNAPSHOT_MAX_WORKERS: '1',
|
||||
DSH_SNAPSHOT_MAX_CONCURRENCY: '8',
|
||||
DSH_WEB_SNAPSHOT_WORKERS: '16',
|
||||
})
|
||||
})
|
||||
|
||||
it('preserves serial reference overrides on large hosts', () => {
|
||||
const inherited = {
|
||||
DSH_GATE_CONCURRENCY: '1',
|
||||
DSH_COVERAGE_MAX_WORKERS: '1',
|
||||
DSH_OXLINT_THREADS: '1',
|
||||
DSH_PUBLINT_CONCURRENCY: '1',
|
||||
DSH_SNAPSHOT_MAX_CONCURRENCY: '1',
|
||||
DSH_WEB_SNAPSHOT_WORKERS: '1',
|
||||
}
|
||||
const additions = ciWorkerEnvironment('ci-primary', inherited, 64)
|
||||
expect(additions).toEqual({ DSH_SNAPSHOT_MAX_WORKERS: '1' })
|
||||
expect(inherited.DSH_COVERAGE_MAX_WORKERS).toBe('1')
|
||||
})
|
||||
|
||||
it('honors an explicit coverage budget and partition override', () => {
|
||||
expect(ciWorkerEnvironment('ci-coverage', { DSH_COVERAGE_MAX_WORKERS: '6' }, 16))
|
||||
.toHaveProperty('DSH_COVERAGE_PARTITIONS', '4')
|
||||
expect(ciWorkerEnvironment('ci-coverage', { DSH_COVERAGE_PARTITIONS: '3' }, 16))
|
||||
.not.toHaveProperty('DSH_COVERAGE_PARTITIONS')
|
||||
})
|
||||
|
||||
it.each(['0', '-1', 'NaN', '2.5'])('rejects invalid worker budget %s', (raw) => {
|
||||
expect(() => ciWorkerEnvironment('ci-coverage', { DSH_COVERAGE_MAX_WORKERS: raw }, 16))
|
||||
.toThrow('DSH_COVERAGE_MAX_WORKERS must be a positive integer')
|
||||
})
|
||||
|
||||
it('keeps local documentation defaults unchanged', () => {
|
||||
expect(ciWorkerEnvironment('doc-sync', {}, 64)).toEqual({})
|
||||
})
|
||||
})
|
||||
|
||||
describe('gate graph validation', () => {
|
||||
it.each([
|
||||
'ci-primary',
|
||||
@@ -148,7 +206,7 @@ describe('gate graph validation', () => {
|
||||
'ci-consumers',
|
||||
'ci-windows-blocking',
|
||||
'ci-windows-complete',
|
||||
'ci-windows-observational',
|
||||
'ci-windows-observational-ready',
|
||||
'node-compat',
|
||||
'check-all',
|
||||
'hygiene',
|
||||
@@ -355,8 +413,8 @@ describe('gate graph validation', () => {
|
||||
|
||||
it('keeps native Windows coverage blocking and behind the complete build', () => {
|
||||
const complete = withPnpmEntrypoint(() => gatesForMode('ci-windows-complete'))
|
||||
const observational = withPnpmEntrypoint(() => gatesForMode('ci-windows-observational'))
|
||||
.filter(gate => gate.id !== 'build' && gate.id !== 'docs-site-build')
|
||||
const observational = withPnpmEntrypoint(() => gatesForMode('ci-windows-observational-ready'))
|
||||
.filter(gate => gate.id !== 'docs-site-build')
|
||||
const byId = new Map(complete.map(subject => [subject.id, subject]))
|
||||
|
||||
expect(byId.get('coverage')?.allowFailure).not.toBe(true)
|
||||
@@ -375,12 +433,12 @@ describe('gate graph validation', () => {
|
||||
'coverage',
|
||||
'coverage-exempt-heavy',
|
||||
]))
|
||||
expect(completeGate?.needs).toEqual(gate.needs)
|
||||
expect((completeGate?.needs ?? []).filter(id => id !== 'build')).toEqual(gate.needs ?? [])
|
||||
}
|
||||
})
|
||||
|
||||
it('runs the Windows built-bin smoke after other observational gates settle', () => {
|
||||
const observational = withPnpmEntrypoint(() => gatesForMode('ci-windows-observational'))
|
||||
const observational = withPnpmEntrypoint(() => gatesForMode('ci-windows-observational-ready'))
|
||||
const builtBin = observational.find(gate => gate.id === 'built-bin-smoke')
|
||||
|
||||
expect(builtBin?.after).toEqual(
|
||||
@@ -393,6 +451,48 @@ describe('gate graph validation', () => {
|
||||
expect(completeBuiltBin?.after).not.toContain('docs-site-build')
|
||||
})
|
||||
|
||||
it('reuses the Windows build without dropping diagnostics or rebuilding the workspace', () => {
|
||||
const ready = withPnpmEntrypoint(() => gatesForMode('ci-windows-observational-ready'))
|
||||
const complete = withPnpmEntrypoint(() => gatesForMode('ci-windows-complete'))
|
||||
const { scripts } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')) as {
|
||||
scripts: Record<string, string>
|
||||
}
|
||||
|
||||
expect(scripts['check:ci:windows-observational-ready']).toBe('tsx scripts/run-gates.ts ci-windows-observational-ready')
|
||||
expect(scripts).not.toHaveProperty('check:ci:windows-observational')
|
||||
const completeOnly = new Set(['build', 'windows-site', 'native-system', 'coverage', 'coverage-exempt-heavy'])
|
||||
const shared = complete.filter(gate => !completeOnly.has(gate.id))
|
||||
expect(ready.map(gate => gate.id).sort()).toEqual([...shared.map(gate => gate.id), 'docs-site-build'].sort())
|
||||
expect(ready.some(gate => gate.id === 'build')).toBe(false)
|
||||
expect(ready.find(gate => gate.id === 'docs-site-build')?.displayCommand).toBe('pnpm run docs:build:mpa')
|
||||
for (const diagnostic of shared) {
|
||||
expect(ready.find(gate => gate.id === diagnostic.id)).toMatchObject({
|
||||
command: diagnostic.command,
|
||||
args: diagnostic.args,
|
||||
})
|
||||
expect(ready.find(gate => gate.id === diagnostic.id)?.env).toEqual(diagnostic.env)
|
||||
}
|
||||
expect(complete.find(gate => gate.id === 'build')).toBeDefined()
|
||||
expect(complete.find(gate => gate.id === 'coverage')).toBeDefined()
|
||||
})
|
||||
|
||||
it('runs built Windows smoke after failed diagnostics settle on an existing build', async () => {
|
||||
const ready = withPnpmEntrypoint(() => gatesForMode('ci-windows-observational-ready'))
|
||||
const settled = new Set<string>()
|
||||
const results = await runGates(ready, 8, async (subject) => {
|
||||
if (subject.id === 'built-bin-smoke') {
|
||||
expect(settled.size).toBe(ready.length - 1)
|
||||
expect(settled.has('doc-graphs')).toBe(true)
|
||||
}
|
||||
settled.add(subject.id)
|
||||
return resultFor(subject, subject.id === 'doc-graphs' ? 'failed' : 'passed')
|
||||
})
|
||||
|
||||
expect(results.filter(result => result.status === 'failed').map(result => result.gate.id)).toEqual(['doc-graphs'])
|
||||
expect(results.find(result => result.gate.id === 'built-bin-smoke')?.status).toBe('passed')
|
||||
expect(results.some(result => result.status === 'skipped')).toBe(false)
|
||||
})
|
||||
|
||||
it('applies one configured test, polling, and hook timeout to both coverage gates', () => {
|
||||
const gates = withEnv('DSH_COVERAGE_TEST_TIMEOUT_MS', '15000', () =>
|
||||
withPnpmEntrypoint(() => gatesForMode('ci-windows-complete')))
|
||||
@@ -601,8 +701,8 @@ describe('Node 24 lane ownership', () => {
|
||||
const subject = withPnpmEntrypoint(() => gatesForMode('ci-consumers'))
|
||||
|
||||
expect(defaultConcurrency('ci-consumers', subject.length, 4)).toEqual({
|
||||
workers: 11,
|
||||
source: 'ci-consumers gate count',
|
||||
workers: 4,
|
||||
source: '4 available CPU(s)',
|
||||
})
|
||||
expect(subject.map(item => item.id)).toEqual([
|
||||
'build',
|
||||
|
||||
+54
-11
@@ -33,7 +33,7 @@ export type Mode =
|
||||
| 'ci-consumers'
|
||||
| 'ci-windows-blocking'
|
||||
| 'ci-windows-complete'
|
||||
| 'ci-windows-observational'
|
||||
| 'ci-windows-observational-ready'
|
||||
| 'node-compat'
|
||||
| 'check-all'
|
||||
| 'hygiene'
|
||||
@@ -102,6 +102,9 @@ if (import.meta.main) {
|
||||
|
||||
async function main(args: string[]): Promise<number> {
|
||||
const mode = parseMode(args[0])
|
||||
const workerEnv = ciWorkerEnvironment(mode, process.env)
|
||||
Object.assign(process.env, workerEnv)
|
||||
if (Object.keys(workerEnv).length > 0) console.log(`run-gates: worker settings ${JSON.stringify(workerEnv)}`)
|
||||
const gates = gatesForMode(mode)
|
||||
const concurrencyDefault = defaultConcurrency(mode, gates.length)
|
||||
const concurrencyOverride = process.env.DSH_GATE_CONCURRENCY
|
||||
@@ -144,7 +147,7 @@ function parseMode(raw: string | undefined): Mode {
|
||||
case 'ci-consumers':
|
||||
case 'ci-windows-blocking':
|
||||
case 'ci-windows-complete':
|
||||
case 'ci-windows-observational':
|
||||
case 'ci-windows-observational-ready':
|
||||
case 'node-compat':
|
||||
case 'check-all':
|
||||
case 'hygiene':
|
||||
@@ -153,7 +156,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-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)}.`,
|
||||
`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-ready | node-compat | check-all | hygiene | doc-sync | doc-quick, got ${JSON.stringify(raw)}.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -170,7 +173,6 @@ export function defaultConcurrency(
|
||||
total: number,
|
||||
available = availableParallelism(),
|
||||
): ConcurrencyDefault {
|
||||
if (selectedMode === 'ci-consumers') return { workers: total, source: 'ci-consumers gate count' }
|
||||
// Local modes cap workers: several doc gates each build a full ts.Program,
|
||||
// so an uncapped default on a large host trades wall clock for memory blowups.
|
||||
const localCap = selectedMode === 'check-all'
|
||||
@@ -186,6 +188,41 @@ export function defaultConcurrency(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill CI worker defaults from the CPU allocation without replacing explicit overrides.
|
||||
* Coverage shares one budget; artifact readers share CPUs with sibling commands.
|
||||
* @param mode - aggregate selected by the caller.
|
||||
* @param env - inherited worker overrides, including serial reference settings.
|
||||
* @param available - CPUs available to this runner process.
|
||||
* @returns environment additions for this aggregate and its children.
|
||||
*/
|
||||
export function ciWorkerEnvironment(
|
||||
mode: Mode,
|
||||
env: NodeJS.ProcessEnv,
|
||||
available = availableParallelism(),
|
||||
): Record<string, string> {
|
||||
if (!mode.startsWith('ci-')) return {}
|
||||
const additions: Record<string, string> = {}
|
||||
const setDefault = (name: string, value: number): void => {
|
||||
if (env[name] === undefined || env[name] === '') additions[name] = String(value)
|
||||
}
|
||||
const shared = Math.max(1, Math.floor(available / 2))
|
||||
setDefault('DSH_OXLINT_THREADS', shared)
|
||||
setDefault('DSH_PUBLINT_CONCURRENCY', shared)
|
||||
setDefault('DSH_SNAPSHOT_MAX_WORKERS', 1)
|
||||
setDefault('DSH_SNAPSHOT_MAX_CONCURRENCY', shared)
|
||||
setDefault('DSH_WEB_SNAPSHOT_WORKERS', env.DSH_GATE_CONCURRENCY === '1' ? 1 : available)
|
||||
setDefault('DSH_COVERAGE_MAX_WORKERS', available)
|
||||
const coverageBudget = env.DSH_COVERAGE_MAX_WORKERS || String(available)
|
||||
const total = Number(coverageBudget)
|
||||
if (!Number.isSafeInteger(total) || total < 1) {
|
||||
throw new Error(`run-gates: DSH_COVERAGE_MAX_WORKERS must be a positive integer, got ${JSON.stringify(coverageBudget)}.`)
|
||||
}
|
||||
const instrumented = Math.max(1, total - Math.max(1, Math.floor(total / 3)))
|
||||
if (instrumented > 1) setDefault(COVERAGE_PARTITIONS_ENV, instrumented)
|
||||
return additions
|
||||
}
|
||||
|
||||
function concurrencyFromEnv(name: string, fallback: number): number {
|
||||
const raw = process.env[name]
|
||||
if (raw === undefined || raw === '') return fallback
|
||||
@@ -256,8 +293,15 @@ export function gatesForMode(selected: Mode): Gate[] {
|
||||
return ciWindowsBlockingGates()
|
||||
case 'ci-windows-complete':
|
||||
return ciWindowsCompleteGates()
|
||||
case 'ci-windows-observational':
|
||||
case 'ci-windows-observational-ready':
|
||||
// The caller owns the successful workspace build; all diagnostics remain.
|
||||
return ciWindowsObservationalGates()
|
||||
.filter(gate => gate.id !== 'build')
|
||||
.map(gate => ({
|
||||
...gate,
|
||||
...gate.needs === undefined ? {} : { needs: gate.needs.filter(id => id !== 'build') },
|
||||
...gate.after === undefined ? {} : { after: gate.after.filter(id => id !== 'build') },
|
||||
}))
|
||||
case 'node-compat':
|
||||
return nodeCompatGates()
|
||||
case 'check-all':
|
||||
@@ -498,8 +542,8 @@ function webSnapshotGate(needs: string[], after?: string[]): Gate {
|
||||
const workerRaw = process.env.DSH_WEB_SNAPSHOT_WORKERS
|
||||
if (workerRaw !== undefined && workerRaw !== '') {
|
||||
const workers = Number.parseInt(workerRaw, 10)
|
||||
if (!Number.isSafeInteger(workers) || workers < 2 || String(workers) !== workerRaw) {
|
||||
throw new Error(`run-gates: DSH_WEB_SNAPSHOT_WORKERS must be an integer greater than 1, got ${JSON.stringify(workerRaw)}.`)
|
||||
if (!Number.isSafeInteger(workers) || workers < 1 || String(workers) !== workerRaw) {
|
||||
throw new Error(`run-gates: DSH_WEB_SNAPSHOT_WORKERS must be a positive integer, got ${JSON.stringify(workerRaw)}.`)
|
||||
}
|
||||
return pnpmScript('web-snapshot', 'test:web:ci', {
|
||||
label: 'web browser snapshot',
|
||||
@@ -593,10 +637,9 @@ function lintGate(options: { needs?: string[] } = {}): Gate {
|
||||
// under v8 instrumentation while contributing nothing the thresholds need
|
||||
// (membership rules in scripts/coverage-exempt.ts).
|
||||
//
|
||||
// DSH_COVERAGE_MAX_WORKERS is the ordinary lane's worker budget, so the two
|
||||
// parallel gates split it instead of each claiming it whole. When
|
||||
// DSH_COVERAGE_PARTITIONS is set, its single-worker processes replace the
|
||||
// instrumented share while this budget still sizes the exempt gate. The exempt
|
||||
// DSH_COVERAGE_MAX_WORKERS is shared between the two parallel gates. CI
|
||||
// defaults its partition count to the instrumented share; an explicit
|
||||
// DSH_COVERAGE_PARTITIONS overrides that share independently. The exempt
|
||||
// gate's wall clock is dominated by its longest single file, so it takes the
|
||||
// small share. A budget of 1 gives each gate 1 worker; lanes that need a strict
|
||||
// total of one (the serial reference jobs) also set DSH_GATE_CONCURRENCY=1,
|
||||
|
||||
@@ -7,8 +7,8 @@ const serialFiles = [
|
||||
]
|
||||
const workerRaw = process.env.DSH_WEB_SNAPSHOT_WORKERS
|
||||
const workers = Number.parseInt(workerRaw ?? '', 10)
|
||||
if (!Number.isSafeInteger(workers) || workers < 2 || String(workers) !== workerRaw) {
|
||||
throw new Error(`DSH_WEB_SNAPSHOT_WORKERS must be an integer greater than 1, got ${JSON.stringify(workerRaw)}.`)
|
||||
if (!Number.isSafeInteger(workers) || workers < 1 || String(workers) !== workerRaw) {
|
||||
throw new Error(`DSH_WEB_SNAPSHOT_WORKERS must be a positive integer, got ${JSON.stringify(workerRaw)}.`)
|
||||
}
|
||||
const invocation = pnpmInvocation(['exec', 'vitest', 'run', '--config', 'vitest.web.config.ts'])
|
||||
let serialStatus = 0
|
||||
|
||||
@@ -93,7 +93,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/connection': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/file-upload': { kind: 'none', reason: 'Browser-side request-body transport; registers nothing model-facing.' },
|
||||
'packages/api/remotes': { kind: 'none', reason: 'The Remote BFF selects business methods and forwarded events; selected services own any model-visible effect.' },
|
||||
'packages/experimental/agent-team-web-profile': { kind: 'indirect', reason: 'The Web layer delegates model composition to the Host-side Agent Teams profile.' },
|
||||
'packages/experimental/client-ui-agent-team': { kind: 'none', reason: 'The browser projection and task controls register no model-facing input.' },
|
||||
'packages/client/ui-layout': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/ui-dockkit': { kind: 'none', reason: 'Browser-side docking layout engine and components; registers nothing model-facing.' },
|
||||
|
||||
Reference in new issue
Block a user