Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions changelog/2026-12-02-base-next-promotion-scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CI: a machine's cumulative base pull request (base/<machine>-next into main) is no longer refused for changing the base and a module together. Each change on that branch already passed the rule in its own pull request into it. A check that judges modules is still refused there.
5 changes: 3 additions & 2 deletions scripts/check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { checkDocs } from './docs.mjs'
import { appStagesFit, takeSlot, vitestWorkerBytes, workersFor } from './machine-slots.mjs'
import { m68kToolchainProblem } from './m68k-preflight.mjs'
import { checkModuleChangelogs } from './module-changelogs.mjs'
import { localPythonProblem, moduleScopeProblems } from './pr-ready.mjs'
import { BASE_NEXT, localPythonProblem, moduleScopeProblems } from './pr-ready.mjs'

const root = fileURLToPath(new URL('../', import.meta.url))
const npmCli = process.env.npm_execpath
Expand Down Expand Up @@ -193,7 +193,8 @@ if (passed && !suiteOnly) passed = await changelogs()
if (passed && !suiteOnly && base && process.env.GITHUB_EVENT_PATH) {
const pull = (() => { try { return JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')).pull_request ?? null } catch { return null } })()
const files = execFileSync('git', ['diff', '--name-only', '--no-renames', base + '...HEAD'], { cwd: root, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 }).split('\n').filter(Boolean)
const problems = pull ? moduleScopeProblems(files, { author: pull.user?.login, owner: process.env.GITHUB_REPOSITORY_OWNER, openedAt: pull.created_at }) : []
const problems = pull ? moduleScopeProblems(files, { author: pull.user?.login, owner: process.env.GITHUB_REPOSITORY_OWNER, openedAt: pull.created_at,
promotion: pull.base?.ref === 'main' && BASE_NEXT.test(pull.head?.ref ?? '') && pull.head?.repo?.full_name === pull.base?.repo?.full_name }) : []
for (const line of problems) problem('Module scope', 'Module scope: ' + line)
if (problems.length) passed = false
}
Expand Down
10 changes: 7 additions & 3 deletions scripts/pr-ready.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ export function baseEdits(files) {

// CI refuses both in contributors' module pull requests opened from this day; earlier ones and the owner's are judged in review.
export const MODULE_SCOPE_REQUIRED_FROM = '2026-11-09'
/** CI's refusals for one pull request: [] for the owner's, for one opened before MODULE_SCOPE_REQUIRED_FROM, or for one in scope. */
export function moduleScopeProblems(files, { author = null, owner = null, openedAt = null } = {}) {
/** A machine's cumulative base branch, base/<machine>-next. */
export const BASE_NEXT = /^base\/[^/]+-next$/
/** CI's refusals for one pull request: [] for the owner's, for one opened before MODULE_SCOPE_REQUIRED_FROM, or for one in scope.
* `promotion` marks the cumulative pull request from base/<machine>-next in the same repository into main: every base and module
* change on that branch passed this rule in its own pull request into it, so together they are not refused for touching both. */
export function moduleScopeProblems(files, { author = null, owner = null, openedAt = null, promotion = false } = {}) {
if (!author || author.toLowerCase() === owner?.toLowerCase() || (openedAt ?? '').slice(0, 10) < MODULE_SCOPE_REQUIRED_FROM) return []
const problems = [], gates = gateEdits(files), base = baseEdits(files)
const problems = [], gates = gateEdits(files), base = promotion ? [] : baseEdits(files)
if (gates.length) problems.push(gateProblem(gates))
if (base.length) problems.push(baseProblem(base))
return problems
Expand Down
8 changes: 7 additions & 1 deletion scripts/pr-ready.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { execFileSync, spawnSync } from 'node:child_process'
import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { MODULE_SCOPE_REQUIRED_FROM, baseEdits, checkAndCommit, forkVisibilityNote, gateEdits, mergeMain, moduleScopeProblems, pythonProblem, readiness, releaseBranchNotes, targetBranch, PACKAGE_ONLY } from './pr-ready.mjs'
import { BASE_NEXT, MODULE_SCOPE_REQUIRED_FROM, baseEdits, checkAndCommit, forkVisibilityNote, gateEdits, mergeMain, moduleScopeProblems, pythonProblem, readiness, releaseBranchNotes, targetBranch, PACKAGE_ONLY } from './pr-ready.mjs'

describe('pr:ready verdict', () => {
it('merges a clean main itself and leaves a conflicting one untouched, naming its files', () => {
Expand Down Expand Up @@ -222,6 +222,12 @@ describe('pr:ready verdict', () => {
expect(moduleScopeProblems(files, { ...contributor, openedAt: '2026-11-07T10:00:00Z' })).toEqual([])
expect(moduleScopeProblems(files, { ...contributor, author: null })).toEqual([])
expect(moduleScopeProblems(['sdk/drafts/threshold-slices/README.md'], contributor)).toEqual([])
// A base/<machine>-next promotion into main carries modules and the base together; a check that judges modules is still refused.
expect(moduleScopeProblems(files, { ...contributor, promotion: true })).toEqual([moduleScopeProblems(files.filter(file => file !== 'sdk/machines/octatrack/events.json'), contributor)[0]])
expect(moduleScopeProblems(files.slice(0, 2), { ...contributor, promotion: true })).toEqual([])
expect(BASE_NEXT.test('base/analog-rytm-mkii-next')).toBe(true)
expect(BASE_NEXT.test('base/analog-rytm-mkii-next/topic')).toBe(false)
expect(BASE_NEXT.test('claude/base-next')).toBe(false)
})
it('says which packages CI rebuilds and how to reproduce them before the push', () => {
expect(readiness({ compiled: { octatrack: true, elemod: false } }).notes.some(note => note.includes('build-modules-isolated.sh'))).toBe(true)
Expand Down
Loading