Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ jobs:
PREFLIGHT_PRIOR_SUCCESS: ${{ job.status == 'success' }}
ORCA_UNIT_SELECTION_MODE: ${{ vars.ORCA_UNIT_SELECTION_MODE || 'shadow' }}
ORCA_PULL_REQUEST_DRAFT: ${{ github.event.pull_request.draft }}
# Five shards use fewer runner minutes; the repository variable can request 2 to 10.
ORCA_UNIT_FULL_SHARD_COUNT: ${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '5' }}
# Twelve 4-vCPU hosted shards match the old 8-vCPU wall time; the repository variable can request 2 to 16.
ORCA_UNIT_FULL_SHARD_COUNT: '12'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

Restore the repository-variable expression before merge.

pr-preflight-gates.test.mjs expects ${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '12' }}. The literal '12' makes the current unit-test suite fail and prevents repository configuration from changing the PR shard count. The commit is temporary, so remove this override before merge. (raw.githubusercontent.com)

Proposed fix
--- "a/.github/workflows/pr.yml"
+++ "b/.github/workflows/pr.yml"
@@ -234,7 +234,7 @@
           ORCA_UNIT_SELECTION_MODE: ${{ vars.ORCA_UNIT_SELECTION_MODE || 'shadow' }}
           ORCA_PULL_REQUEST_DRAFT: ${{ github.event.pull_request.draft }}
           # Twelve 4-vCPU hosted shards match the old 8-vCPU wall time; the repository variable can request 2 to 16.
-          ORCA_UNIT_FULL_SHARD_COUNT: '12'
+          ORCA_UNIT_FULL_SHARD_COUNT: ${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '12' }}
         run: |
           if [ "$PREFLIGHT_PHASE_SELECTED" != true ] || [ "$PREFLIGHT_PRIOR_SUCCESS" != true ]; then exit 0; fi
           node config/scripts/ci-unit-plan.mjs
Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ORCA_UNIT_FULL_SHARD_COUNT: '12'
ORCA_UNIT_FULL_SHARD_COUNT: ${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '12' }}

run: |
if [ "$PREFLIGHT_PHASE_SELECTED" != true ] || [ "$PREFLIGHT_PRIOR_SUCCESS" != true ]; then exit 0; fi
node config/scripts/ci-unit-plan.mjs
Expand Down Expand Up @@ -887,7 +887,8 @@ jobs:
uses: ./.github/workflows/unit-tests.yml
with:
node_versions: '["24"]'
runner: blacksmith-8vcpu-ubuntu-2404
# Free hosted ARM: 12 shards measured 361s median cold vs ~390s for 5 warm Blacksmith 8-vCPU shards.
runner: ubuntu-24.04-arm
phase_diagnostics: true
# Restore main's transform cache; the `ci:cold-unit-cache` label or ORCA_UNIT_MODULE_CACHE=off forces cold.
module_cache: ${{ (vars.ORCA_UNIT_MODULE_CACHE == 'off' || contains(github.event.pull_request.labels.*.name, 'ci:cold-unit-cache')) && 'off' || 'warm' }}
Expand Down
24 changes: 2 additions & 22 deletions .github/workflows/unit-module-cache.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
name: Unit transform cache producer

# Cold full unit run on main that publishes per-shard Vitest transform caches for PRs.
# Cold full unit run on main that publishes per-shard Vitest transform caches.
# Dispatch only: PR shards run on hosted runners, which cannot read this Blacksmith-store cache.
on:
schedule:
- cron: '17 */6 * * *'
workflow_dispatch:
push:
branches: [main]
# Cache-key inputs (see ci-unit-module-cache.mjs) change the key; reseed right away.
paths:
- '.github/workflows/unit-module-cache.yml'
- '.github/workflows/unit-tests.yml'
- 'config/vitest.config.ts'
- 'config/scripts/vitest*'
- 'config/scripts/ci-unit-module-cache*.mjs'
- 'config/patches/**'
- 'config/scripts/workspace-source-exports.mjs'
- 'config/dark-build-switches.cjs'
- 'config/pnpmfile.cjs'
- '.npmrc'
- '**/package.json'
- '**/tsconfig*.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'config/.bun-version'

concurrency:
group: unit-module-cache-${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
ORCA_UNIT_SELECTION_MODE: ${{ inputs.selection_mode }}
ORCA_PULL_REQUEST_DRAFT: ${{ github.event.pull_request.draft }}
# Same count as PR preflight so transform cache shard keys line up.
ORCA_UNIT_FULL_SHARD_COUNT: ${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '5' }}
ORCA_UNIT_FULL_SHARD_COUNT: ${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '12' }}
run: node config/scripts/ci-unit-plan.mjs
- uses: actions/upload-artifact@v7
continue-on-error: true
Expand Down
4 changes: 2 additions & 2 deletions config/scripts/ci-dependency-download-cache.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,16 @@ describe('CI dependency download caches', () => {
expect(warm['runs-on']).toBe('${{ matrix.runner }}')
expect(warm.strategy.matrix.runner).toEqual([
'blacksmith-4vcpu-ubuntu-2404-arm',
pr.jobs.preflight['runs-on'],
pr.jobs.test.with.runner,
'ubuntu-24.04-arm',
'ubuntu-22.04'
])
expect(workflow('ci-cache-warmup').jobs.warm.strategy.matrix.runner).toEqual([
'blacksmith-4vcpu-ubuntu-2404',
'ubuntu-24.04'
])
expect(pr.jobs.preflight['runs-on']).toBe('blacksmith-8vcpu-ubuntu-2404')
expect(pr.jobs.test.with.runner).toBe('blacksmith-8vcpu-ubuntu-2404')
expect(pr.jobs.test.with.runner).toBe('ubuntu-24.04-arm')
expect(units['runs-on']).toBe('${{ inputs.runner }}')
expect(JSON.parse(pr.jobs.test.with.node_versions)).toEqual(['24'])
expect(warmInstall.if).toBeUndefined()
Expand Down
6 changes: 3 additions & 3 deletions config/scripts/ci-unit-plan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { readTimingBaseline, writeAssignment } from './ci-shard-assignment.mjs'

export function prepareUnitPlan(env = process.env) {
const requestedCount = env.ORCA_UNIT_FULL_SHARD_COUNT ?? String(FULL_SHARD_COUNT)
// Every consumer reads the count from the plan; ten bounds runner-slot use.
if (!/^([2-9]|10)$/.test(requestedCount)) {
throw new Error('ORCA_UNIT_FULL_SHARD_COUNT must be an integer from 2 to 10')
// Every consumer reads the count from the plan; sixteen bounds runner-slot use.
if (!/^([2-9]|1[0-6])$/.test(requestedCount)) {
throw new Error('ORCA_UNIT_FULL_SHARD_COUNT must be an integer from 2 to 16')
}
const fullShardCount = Number(requestedCount)
const files = discoverUnitFiles()
Expand Down
6 changes: 3 additions & 3 deletions config/scripts/ci-unit-plan.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ it.each([
}
)

it.each(['5', '6', '10', 'invalid', '11'])(
it.each(['5', '6', '16', 'invalid', '17'])(
'validates the requested full shard count and keeps fallback coverage: %s',
(requestedCount) => {
const root = mkdtempSync(join(tmpdir(), 'orca-unit-count-'))
Expand All @@ -105,10 +105,10 @@ it.each(['5', '6', '10', 'invalid', '11'])(
ORCA_SHARD_SOURCE_SHA: 'full-count-fixture'
}
})
if (['invalid', '11'].includes(requestedCount)) {
if (['invalid', '17'].includes(requestedCount)) {
expect(result.code).not.toBe(0)
expect(result.stderr).toContain(
'ORCA_UNIT_FULL_SHARD_COUNT must be an integer from 2 to 10'
'ORCA_UNIT_FULL_SHARD_COUNT must be an integer from 2 to 16'
)
return
}
Expand Down
2 changes: 1 addition & 1 deletion config/scripts/ci-unit-selection.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function selectUnitFiles(files, changed, graphInput) {

// Job slots, not cores, drive queueing: eight shards consumed 68% of daily slots. Five budget ~8.8min/shard versus 10.5min p95 queue.
// Full PR/daily callers use five; selected drafts may use fewer.
export const FULL_SHARD_COUNT = 5
export const FULL_SHARD_COUNT = 12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Drafts exceed the configured count

Raising FULL_SHARD_COUNT to 12 also raises the draft limit, but selected drafts ignore the configured fullShardCount. With ORCA_UNIT_FULL_SHARD_COUNT=5, a large selected draft can now start up to 12 jobs, while a full run starts only five. Previously, that configuration capped both at five.

Use fullShardCount in the selected branch too, so lowering the configured count still limits runner use and helps reduce queues.


export function planUnitSelection({
files,
Expand Down
4 changes: 2 additions & 2 deletions config/scripts/ci-unit-selection.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('conservative unit selection', () => {
)
})

it('uses ten complete PR shards while selected drafts retain the five-shard cap', () => {
it('uses ten complete PR shards while selected drafts stay within the full-count cap', () => {
const expandedSources = new Map(sources)
for (let index = 0; index < 5; index++) {
expandedSources.set(`src/additional-${index}.test.ts`, `import './leaf'`)
Expand Down Expand Up @@ -196,7 +196,7 @@ describe('conservative unit selection', () => {
mode: 'selected',
event: { pull_request: { draft: true } }
})
expect(selected.shards).toHaveLength(5)
expect(selected.shards).toHaveLength(Math.min(FULL_SHARD_COUNT, selected.executionFiles.length))
expect(selected.executionFiles).toEqual(
selectUnitFiles(expandedFiles, ['src/leaf.ts'], expandedGraph).files
)
Expand Down
2 changes: 1 addition & 1 deletion config/scripts/pr-preflight-gates.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ it('shares one setup and overlaps the compiler only after type-aware checks fini
'node config/scripts/ci-unit-plan.mjs'
])
expect(plan.env.ORCA_UNIT_SELECTION_MODE).toContain('vars.ORCA_UNIT_SELECTION_MODE')
expect(plan.env.ORCA_UNIT_FULL_SHARD_COUNT).toBe("${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '5' }}")
expect(plan.env.ORCA_UNIT_FULL_SHARD_COUNT).toBe("${{ vars.ORCA_UNIT_FULL_SHARD_COUNT || '12' }}")
expect(steps.indexOf(plan)).toBeLessThan(compilerJoin)
expect(steps.indexOf(compiler)).toBeGreaterThan(
steps.findIndex((step) => step.wait === 'changed-code-quality')
Expand Down
8 changes: 5 additions & 3 deletions docs/readme/ci-runners.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# CI runners

Default to free GitHub-hosted standard runners: the repository is public and the
Enterprise plan allows 500 concurrent jobs (50 macOS). Use Blacksmith only for:
Enterprise plan allows 1,000 concurrent jobs (50 macOS). Use Blacksmith only for:

- PR critical-path jobs: unit test shards, preflight and typecheck, and the layout
oracle gate (`e2e.yml` with `fast_runners: true`). Advisory e2e lanes run hosted.
- PR critical-path jobs: preflight and typecheck, and the layout oracle gate
(`e2e.yml` with `fast_runners: true`). Advisory e2e lanes run hosted.
Unit tests run as 12 shards on hosted `ubuntu-24.04-arm`, which match the old
five 8-vCPU Blacksmith shards; `ORCA_UNIT_FULL_SHARD_COUNT` tunes the count.
- `pr.yml` Git compatibility: its parallel real-Git lanes, two through Docker,
exceed test timeouts on 4-vCPU hosted runners.
- macOS packaging: adhoc, hourly, daily and `release-mac-build.yml`. Hosted
Expand Down
Loading