mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
ci: keep cold-cache lanes bounded
This commit is contained in:
@@ -14,9 +14,9 @@ The artifact boundary remains load-bearing. `publint`, `verify-node-next-types`,
|
||||
|
||||
[CI](../../../../.github/workflows/ci.yml) treats one minute for non-Windows jobs and three minutes for Windows jobs as observed performance targets, not cancellation deadlines. Hosted-runner variance should leave complete timing evidence and useful failure logs instead of cancelling an otherwise-correct gate. The [serial cross-platform CI reference](2026-07-21-serial-cross-platform-ci-reference.md) independently runs the complete unsharded primary Node aggregate on Linux, macOS, and Windows so the optimized lane inventory is not its own completeness oracle.
|
||||
|
||||
[scripts/run-gates.ts](../../../../scripts/run-gates.ts) remains the common bounded scheduler, but GitHub supplies explicit shard names for the expensive gate families. [scripts/static-shards.ts](../../../../scripts/static-shards.ts) partitions static gates into foundation, documentation-type, API-contract, catalog, prose, documentation-projection, and documentation-build lanes and rejects a missing or duplicate gate assignment. Lint uses disjoint package-source, package-test, and repository-complement lanes; the complement still starts from `.` so a new top-level lint target cannot disappear between shards, and it owns the single cross-file duplication run. [scripts/coverage-shards.ts](../../../../scripts/coverage-shards.ts) assigns every workspace package to exactly one source-coverage lane; its test expands the live package tree, so a new package makes CI red until it has an owner. Directory filters retain a trailing separator because Vitest positional filters match substrings and would otherwise admit prefix-named sibling packages. Each coverage lane includes only its owned source files, repeats the exhaustive companion topology test, and runs without a preceding build because the complete coverage suite passes from a tree with every generated `lib/` removed.
|
||||
[scripts/run-gates.ts](../../../../scripts/run-gates.ts) remains the common bounded scheduler, but GitHub supplies explicit shard names for the expensive gate families. [scripts/static-shards.ts](../../../../scripts/static-shards.ts) partitions static gates into foundation, documentation-type, API-contract, catalog, prose, documentation-projection, and documentation-build lanes and rejects a missing or duplicate gate assignment. Lint uses disjoint A-M and N-Z package-source and package-test lanes plus a repository complement; the complement still starts from `.` so a new top-level lint target cannot disappear between shards, and it owns the single cross-file duplication run. [scripts/coverage-shards.ts](../../../../scripts/coverage-shards.ts) assigns every workspace package to exactly one source-coverage lane; its test expands the live package tree, so a new package makes CI red until it has an owner. Directory filters retain a trailing separator because Vitest positional filters match substrings and would otherwise admit prefix-named sibling packages. Each coverage lane includes only its owned source files, repeats the exhaustive companion topology test, and runs without a preceding build because the complete coverage suite passes from a tree with every generated `lib/` removed.
|
||||
|
||||
Snapshot replay uses two explicit multi-file lanes and eight scenario partitions of the large ACP file. [scripts/snapshot-shards.ts](../../../../scripts/snapshot-shards.ts) owns that inventory, and its test discovers every file admitted by the snapshot config so a new file cannot land outside CI. Each snapshot job installs dependencies while its Linux runner refreshes APT indexes and installs bubblewrap, then builds the shipped runtime and runs only its assigned replay surface. CI explicitly retains the suite's bounded concurrency of five subprocesses instead of clamping it to the runner's two logical CPUs, because replay spends most of its time waiting on child protocol I/O. Fixture guards still inspect the complete ACP scenario table in every partition. Static, lint, coverage, and snapshot sharding changes only GitHub scheduling: the ordinary local package scripts still run their complete suites.
|
||||
Snapshot replay uses two explicit multi-file lanes and eight scenario partitions of the large ACP file. [scripts/snapshot-shards.ts](../../../../scripts/snapshot-shards.ts) owns that inventory, and its test discovers every file admitted by the snapshot config so a new file cannot land outside CI. Each snapshot job installs dependencies while its Linux runner installs bubblewrap, refreshing APT indexes and retrying if the hosted image's initial package install fails, then builds the shipped runtime and runs only its assigned replay surface. CI explicitly retains the suite's bounded concurrency of five subprocesses instead of clamping it to the runner's two logical CPUs, because replay spends most of its time waiting on child protocol I/O. Fixture guards still inspect the complete ACP scenario table in every partition. Static, lint, coverage, and snapshot sharding changes only GitHub scheduling: the ordinary local package scripts still run their complete suites.
|
||||
|
||||
Cold standalone documentation typechecking rebuilds the complete project-reference graph, so a dedicated documentation-type lane builds once and checks Markdown blocks against those declarations. The Linux documentation lane uses VitePress's MPA build to retain page rendering and dead-link validation within the observed non-Windows target; separate blocking Windows build and production-site lanes preserve the emitted-package and shipped-site checks without putting both critical paths in one job.
|
||||
|
||||
|
||||
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
@@ -67,16 +67,26 @@ jobs:
|
||||
static_shard: site-build
|
||||
- lane: typecheck
|
||||
command: pnpm run typecheck
|
||||
- lane: lint-package-sources
|
||||
- lane: lint-package-sources-a-m
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-sources
|
||||
- lane: lint-package-tests
|
||||
lint_shard: package-sources-a-m
|
||||
- lane: lint-package-sources-n-z
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-tests
|
||||
lint_shard: package-sources-n-z
|
||||
- lane: lint-package-tests-a-m
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-tests-a-m
|
||||
- lane: lint-package-tests-n-z
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-tests-n-z
|
||||
- lane: lint-repository
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
@@ -238,9 +248,9 @@ jobs:
|
||||
# The snapshot lanes REPLAY the sandbox example's recorded scenarios,
|
||||
# re-executing their bash calls under a real runner. ubuntu-latest has
|
||||
# no bubblewrap preinstalled and no built Landlock launcher, so without
|
||||
# this the confined executions fail closed (SANDBOX_UNAVAILABLE). Same
|
||||
# refreshed install as sandbox.yml's bwrap leg (incl. the Ubuntu 24.04
|
||||
# AppArmor userns knob). Bubblewrap preparation is independent of
|
||||
# this the confined executions fail closed (SANDBOX_UNAVAILABLE). The
|
||||
# install retries after refreshing stale indexes and applies the Ubuntu
|
||||
# 24.04 AppArmor userns knob. Bubblewrap preparation is independent of
|
||||
# dependency installation and the build, so it runs beside both.
|
||||
- name: Install and prepare built snapshot runtime and bubblewrap
|
||||
if: startsWith(matrix.lane, 'snapshot-')
|
||||
@@ -248,8 +258,11 @@ jobs:
|
||||
pnpm install --frozen-lockfile &
|
||||
install_pid=$!
|
||||
(
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -yq --no-install-recommends bubblewrap
|
||||
if ! sudo apt-get install -yq --no-install-recommends bubblewrap; then
|
||||
echo "initial bubblewrap install failed; refreshing APT indexes and retrying"
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -yq --no-install-recommends bubblewrap
|
||||
fi
|
||||
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 \
|
||||
|| echo "apparmor userns knob absent — the functional probe decides"
|
||||
) &
|
||||
@@ -409,16 +422,26 @@ jobs:
|
||||
command: pnpm run check:ci:static
|
||||
gate_concurrency: '4'
|
||||
static_shard: 'doc-types,api-contracts'
|
||||
- lane: lint-package-sources
|
||||
- lane: lint-package-sources-a-m
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-sources
|
||||
- lane: lint-package-tests
|
||||
lint_shard: package-sources-a-m
|
||||
- lane: lint-package-sources-n-z
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-tests
|
||||
lint_shard: package-sources-n-z
|
||||
- lane: lint-package-tests-a-m
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-tests-a-m
|
||||
- lane: lint-package-tests-n-z
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
eslint_cache: '1'
|
||||
lint_shard: package-tests-n-z
|
||||
- lane: lint-repository
|
||||
command: pnpm run check:ci:lint
|
||||
gate_concurrency: '1'
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
import { readdirSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { selectLintShard } from './lint-shards.ts'
|
||||
|
||||
const packagesRoot = resolve(import.meta.dirname, '..', 'packages')
|
||||
|
||||
describe('lint gate shards', () => {
|
||||
it('keeps the unsharded local command complete', () => {
|
||||
expect(selectLintShard()).toEqual({ eslintTargets: ['.'], includeDuplication: true })
|
||||
expect(selectLintShard('')).toEqual({ eslintTargets: ['.'], includeDuplication: true })
|
||||
})
|
||||
|
||||
it('partitions package sources, package tests, and their repository complement', () => {
|
||||
expect(selectLintShard('package-sources')).toEqual({
|
||||
eslintTargets: ['packages/*/*/src/**/*.ts'],
|
||||
it('partitions package sources and tests into alphabetic halves plus their repository complement', () => {
|
||||
expect(selectLintShard('package-sources-a-m')).toEqual({
|
||||
eslintTargets: ['packages/[a-m]*/*/src/**/*.ts'],
|
||||
includeDuplication: false,
|
||||
})
|
||||
expect(selectLintShard('package-tests')).toEqual({
|
||||
eslintTargets: ['packages/*/*/tests/**/*.ts'],
|
||||
expect(selectLintShard('package-sources-n-z')).toEqual({
|
||||
eslintTargets: ['packages/[n-z]*/*/src/**/*.ts'],
|
||||
includeDuplication: false,
|
||||
})
|
||||
expect(selectLintShard('package-tests-a-m')).toEqual({
|
||||
eslintTargets: ['packages/[a-m]*/*/tests/**/*.ts'],
|
||||
includeDuplication: false,
|
||||
})
|
||||
expect(selectLintShard('package-tests-n-z')).toEqual({
|
||||
eslintTargets: ['packages/[n-z]*/*/tests/**/*.ts'],
|
||||
includeDuplication: false,
|
||||
})
|
||||
expect(selectLintShard('repository')).toEqual({
|
||||
@@ -28,6 +40,17 @@ describe('lint gate shards', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('assigns every package group to one alphabetic half', () => {
|
||||
const groups = readdirSync(packagesRoot, { withFileTypes: true })
|
||||
.filter(entry => entry.isDirectory())
|
||||
.map(entry => entry.name)
|
||||
.sort()
|
||||
const firstHalf = groups.filter(group => /^[a-m]/u.test(group))
|
||||
const secondHalf = groups.filter(group => /^[n-z]/u.test(group))
|
||||
|
||||
expect([...firstHalf, ...secondHalf].sort()).toEqual(groups)
|
||||
})
|
||||
|
||||
it('rejects an unknown lane', () => {
|
||||
expect(() => selectLintShard('missing')).toThrow('unknown DSH_LINT_SHARD')
|
||||
})
|
||||
|
||||
@@ -19,10 +19,14 @@ export function selectLintShard(name?: string): LintSelection {
|
||||
case undefined:
|
||||
case '':
|
||||
return { eslintTargets: ['.'], includeDuplication: true }
|
||||
case 'package-sources':
|
||||
return { eslintTargets: ['packages/*/*/src/**/*.ts'], includeDuplication: false }
|
||||
case 'package-tests':
|
||||
return { eslintTargets: ['packages/*/*/tests/**/*.ts'], includeDuplication: false }
|
||||
case 'package-sources-a-m':
|
||||
return { eslintTargets: ['packages/[a-m]*/*/src/**/*.ts'], includeDuplication: false }
|
||||
case 'package-sources-n-z':
|
||||
return { eslintTargets: ['packages/[n-z]*/*/src/**/*.ts'], includeDuplication: false }
|
||||
case 'package-tests-a-m':
|
||||
return { eslintTargets: ['packages/[a-m]*/*/tests/**/*.ts'], includeDuplication: false }
|
||||
case 'package-tests-n-z':
|
||||
return { eslintTargets: ['packages/[n-z]*/*/tests/**/*.ts'], includeDuplication: false }
|
||||
case 'repository':
|
||||
return {
|
||||
eslintTargets: [
|
||||
|
||||
Reference in New Issue
Block a user