Repository navigation
MR-14: ci-scope in shadow mode - #784
Merged
Merged
Conversation
scripts/ci-scope.mjs maps a change to affected packages, the tier each runs and the jobs verify must run (plan section 4), with a swappable workspace graph and a test that cross-checks it against pnpm --filter on the six S5 scenarios. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
michaeljgrimm
added this pull request to the merge queue
Oct 21, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 21, 2026
michaeljgrimm
added this pull request to the merge queue
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MR-14 of the monorepo program (
docs/programs/monorepo/README.md, section 4 "verify contents", step 1scope, and Phase 1). Additive: one new script, one test, onecheck:ci-scopescript. No package behavior, workflow or ruleset changes.What it does
node scripts/ci-scope.mjs --base <base> --head <head>(or--files a b c) answers three questions for a change:pnpm --filter "...[base]").fullfor a changed package,contractfor a dependent,skipotherwise. A forced run (anyscripts/,.github/,pnpm-lock.yaml, root configuration, unclassified path, thefull-cilabel, an empty or unreadable diff, any event other thanpull_request) runs every package atfull. Overall class:docs,leaf,engine,core,all(the rows of the plan's target table).verifymust run:lint(always), the package jobs (gallery,core,render,pptx,editor,cli,integration) with their tier,goldens(render src/fonts/golden, examples, core src, gallery,spec/reference),gallery-gates(check:previews and check:stability, which run inpackages/integration; runs when gallery, core or render changed: the one edge the manifests cannot express, S7) andpack-shape. Output is JSON,--format text|markdown,--github-output(tier,changed,affected,jobs,matrix,required, ...) and--summary(step summary).Path map (first match; fails closed):
packages/<x>/to its package (packages/javascriptis core; evidence logs underpackages/<x>/docs/evidenceare docs, decks*.opf.jsonare not);spec/,examples/,skills/,README.md, top-leveldocs/*.md(core embeds them),docs/fixtures/,docs/quickstart/,docs/first-deck/and every deck underdocs/outsidedocs/programs/to core;docs/programs/,docs/evidence/(no decks), otherdocs/, root documents,changes/,.claude/to docs (no package;lintgates it);scripts/,.github/,test/,pnpm-lock.yaml,pnpm-workspace.yaml,package.json,biome.json,.nvmrc,.gitattributes,.npmrc,.gitignore,ecosystem.lock.json,release-plan.jsonand anything unknown to all.The graph source is swappable (
--graph manifests|target|union|<file.json>):manifestsreads the package manifests as pnpm does (dependencies, devDependencies, optionalDependencies usingworkspace:,link:orfile:; peers and registry ranges are not edges);targetis the plan's graph (TARGET_GRAPH: gallery has no edge, core depends on gallery, render on core and gallery, pptx on core, gallery and render, editor and cli on those, integration on all);union(default) is both, so before MR-10/MR-23 wire the manifests, and for packages not imported yet, the dependents are still right. It does not importcheck:workspace-graph(MR-10), so it works before that merges.Tests (
pnpm check:ci-scope, 23 tests, also part ofpnpm test)pnpm --filter "...[origin/main]"(and"[origin/main]"for the cross-cutting case); skipped only ifpnpmis not installed. The plan's S5 table is also spelled out, so a graph change has to be deliberate.spec/,docs/programs,scripts/, lockfile, workflows): pnpm selects only the root project for every one of them; ci-scope decides by the path map (the reason the script exists).docs/*.mdand evidence decks as core inputs, spec and examples, unclassified paths and unknown package directories (fail closed, reported), package evidence logs, a manifest-only change, non-PR events,full-ci, an empty diff, an unreadable diff, a file moved out of a package (both sides listed), file names with spaces, the three-dot merge-base semantics, the graph sources (a registry range of gallery is not an edge; the union keeps the target edge), the command line and its GitHub outputs.Shadow validation on the last 30 merged PRs
Method: one GraphQL query (cost 1 point:
pullRequests(states: MERGED, first: 50, orderBy: UPDATED_AT)withmergeCommit,baseRefOid,headRefOid,changedFiles,files(first: 100)), sorted bymergedAt, the first 30 (#777 down to #746; equal to the 30 newest first-parent commits ofmain). For each, the changed paths come from the localgit diff --name-only -z --no-renames <merge commit>^1 <merge commit>(exactly what landed), cross-checked against the API file list (*= the API list is truncated at 100 files, so the local diff is the reference).scope()runs on that list with theuniongraph of this checkout; "packages/ dirs touched" is computed independently from the path prefix and must equal the directory-derived part ofchanged.changedcan additionally containcorefor core inputs outsidepackages/javascript(docs/*.md, spec, examples, README).packages/dirs touchedResults (2026-10-21):
changedset; none was missed, none invented. 27 local diffs equal the API file list; 3 PRs have more than 100 files (FA-33: layouts as one list of regions #756, RR-97: every example converts: embedded supporting photos #752, RR-96: adopt gallery 4.0.0 and theme variants #749).scripts/,.github/workflows/,pnpm-lock.yaml,release-plan.jsonorecosystem.lock.json(the release and roller PRs, which the plan retires or turns into the one release commit), so they run everything at full, as section 4 says. Engine is 0 because render and PPTX are not in this repository yet.ecosystem-scope.mjsskipped 0 of the 30 (it only skipsdocs/programsanddocs/evidence), so the current CI ran everything on all 30. ci-scope would have run lint only on 3, and the 12 non-forced PRs would have run 71 of 120 possible non-lint jobs.CHANGELOG.md,changes/*,AGENTS.md,llms.txtanddocs/programs/*;lint(Biome,check:text,check:changes, the rest of the rootcheck:*suite) is what gates them. No PR in the sample was narrowed past a path a gating test reads (llms.txtis read only bytest:agent-site, which no workflow runs).opfyet); the fixture tests above cover them.Shadow mode in CI: workflow patch (not applied;
.github/workflowsis not edited by this PR)A non-required job next to the current CI in
.github/workflows/opf-ci.yml. It is not in theneedsofVerify OPF packages, hascontinue-on-error: true, needs no install, and prints the ci-scope decision (log plus step summary) followed by the currentecosystem-scope.mjsdecision. It applies cleanly withgit applyon currentmain(checked) and is skipped formerge_groupand manual runs.Notes and what is not verified
changes/fragment: tooling only, no package or user-facing change.GITHUB_OUTPUTandGITHUB_STEP_SUMMARYset onHEAD^1/HEAD, and the patch was checked withgit apply --checkand parsed as YAML); the pnpm cross-check on Windows (the nightly will show it; the test spawnspnpmthrough a shell there); theverifyp50 targets (MR-32).integrationruns atfullonly when its own directory changes (the plan says contract for dependents; MR-23 and MR-30 define what its contract tier contains); the golden "core geometry sources" are all ofpackages/javascript/src/plusspec/reference/(core's source is flat and cannot be separated by directory); every event other thanpull_request, including the push run onmain, runs everything.scripts/ci-scope.mjsstays decoupled fromcheck:workspace-graph(MR-10); once that lands and the manifests are wired,--graph manifestsis the pure pnpm view and theuniondefault can be retired.Part of MR-14 (Phase 1). The shadow-validation script and raw data were scratch files and are not committed.
🤖 Generated with Claude Code