Skip to content

Commit 33b9f44

Browse files
committed
ci(ui): keep the Test UI change to ci.yml alone
The select-affected-tests pin reconciled the ui_consumers list against the package graph, a second check the ruling did not take; the Test UI aggregate, which now explains a skip only when ui and ui_consumers both said false, already reds on the first diff an if: regression would skip. Claude-Session: https://claude.ai/code/session_01QUs3BsPpUdAGmm7wLdoKaK Co-authored-by: Claude <noreply@anthropic.com>
1 parent b5a16ae commit 33b9f44

3 files changed

Lines changed: 14 additions & 77 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ jobs:
182182
# `merge_group.base_sha` touches no ui path and none of the seven
183183
# packages skips the five ui jobs, exactly as the same diff does on its
184184
# PR head; an entry that touches one runs them (Lint UI reads `ui`
185-
# alone, so one of the seven by itself does not start it). If the step fails (the
186-
# base cannot be fetched, the diff errors), it is `continue-on-error`
187-
# there, its outputs are empty and `|| 'true'` runs every ui job.
185+
# alone, so one of the seven by itself does not start it). If the step
186+
# fails (the base cannot be fetched, the diff errors), it is
187+
# `continue-on-error` there, its outputs are empty and `|| 'true'` runs
188+
# every ui job.
188189
#
189190
# `ui_tree` is what keeps the ui jobs SKIPPED, not failed, on a tree that
190191
# does not carry ui/ yet: `ui` and `ui_consumers` fall back to 'true' on
@@ -562,9 +563,8 @@ jobs:
562563
# `.objectstack-pin` used to pack). A change here compiles, builds
563564
# and tests the Console in the same PR — the check the retired Spec
564565
# Shape Gate ran hourly against a clone of objectui main. Test UI
565-
# reads this list since objectstack#28220; its selector turns full
566-
# for any of these packages, and its test pins this list against
567-
# the package graph the selector reads.
566+
# reads this list since objectstack#28220: its selector already
567+
# turns full for any of these packages.
568568
ui_consumers:
569569
- 'packages/spec/**'
570570
- 'packages/client/**'
@@ -3744,9 +3744,9 @@ jobs:
37443744
# skipped all sixteen shards; the next queue build that started them
37453745
# (objectstack#28197) failed a ui test that imports @objectstack/lint, and a
37463746
# bystander was ejected for it. Which files run stays the selector's answer.
3747-
# `ui/scripts/__tests__/select-affected-tests.test.ts` holds the join: every
3748-
# package outside ui/ the selector turns full for is covered by a list this
3749-
# `if:` reads. Lint UI keeps `ui` alone (its eslint reads none of the seven).
3747+
# The Test UI aggregate below explains a skip only when both outputs said
3748+
# false, so an `if:` that drops `ui_consumers` again reds there on the first
3749+
# such diff. Lint UI keeps `ui` alone: its eslint reads none of the seven.
37503750
test-ui:
37513751
name: Test UI (${{ matrix.shard }}/16)
37523752
needs: [filter, ui-deps]

‎ui/scripts/__tests__/helpers/root-ci.ts‎

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,45 +125,23 @@ export function triggerBlock(ci: string): string {
125125
* list, the reading that would make every "is not hidden" pin vacuous.
126126
*/
127127
export function uiFilterGlobs(ci: string): string[] {
128-
return filterGlobs(ci, 'ui');
129-
}
130-
131-
/**
132-
* The globs of one named list of the `filter` job's paths filter (`ui`,
133-
* `ui_consumers`, `core`, ...), read the way `uiFilterGlobs` reads `ui:`.
134-
* Throws when the filter declares no such list or it lists no globs.
135-
*/
136-
export function filterGlobs(ci: string, name: string): string[] {
137128
const filter = jobBlock(ci, 'filter');
138129
const lines = filter.split('\n');
139-
const at = lines.findIndex((line) => new RegExp(`^ +${name}:[ \\t]*$`).test(line));
140-
if (at === -1) throw new Error(`${rootCiPath}: the \`filter\` job declares no \`${name}:\` paths filter`);
130+
const at = lines.findIndex((line) => /^ +ui:[ \t]*$/.test(line));
131+
if (at === -1) throw new Error(`${rootCiPath}: the \`filter\` job declares no \`ui:\` paths filter`);
141132
const indent = lines[at].search(/\S/);
142133
const globs: string[] = [];
143134
for (const line of lines.slice(at + 1)) {
144135
if (/^\s*(#.*)?$/.test(line)) continue;
145136
if (line.search(/\S/) <= indent) break;
146137
const m = line.match(/^\s+-\s+'([^']+)'\s*$/);
147-
if (!m) throw new Error(`${rootCiPath}: cannot read the \`${name}:\` filter entry ${JSON.stringify(line)}`);
138+
if (!m) throw new Error(`${rootCiPath}: cannot read the \`ui:\` filter entry ${JSON.stringify(line)}`);
148139
globs.push(m[1]);
149140
}
150-
if (globs.length === 0) throw new Error(`${rootCiPath}: the \`${name}:\` paths filter lists no globs`);
141+
if (globs.length === 0) throw new Error(`${rootCiPath}: the \`ui:\` paths filter lists no globs`);
151142
return globs;
152143
}
153144

154-
/**
155-
* The `filter` outputs a job's `if:` starts it on: every
156-
* `needs.filter.outputs.<o> != 'false'` it spells, in order. Throws when the
157-
* job carries no `if:` line or the line reads no filter output.
158-
*/
159-
export function jobFilterOutputs(ci: string, key: string): string[] {
160-
const line = jobBlock(ci, key).match(/^ {4}if: (.+)$/m);
161-
if (!line) throw new Error(`${rootCiPath}: the \`${key}\` job carries no one-line \`if:\``);
162-
const outputs = [...line[1].matchAll(/needs\.filter\.outputs\.([A-Za-z_][\w-]*) != 'false'/g)].map((m) => m[1]);
163-
if (outputs.length === 0) throw new Error(`${rootCiPath}: the \`${key}\` job's \`if:\` reads no filter output`);
164-
return outputs;
165-
}
166-
167145
/** A path relative to this tree, as the root workflow's filters see it (`ui/<path>`). */
168146
export function repoPath(uiRelative: string): string {
169147
return `${nestedPrefix()}${uiRelative}`;

‎ui/scripts/__tests__/select-affected-tests.test.ts‎

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,7 @@ import {
2020
trackedFiles,
2121
} from '../select-affected-tests.mjs';
2222
import { shardTotal } from '../../../scripts/ci-shard-matrix.mjs';
23-
import { workspaceRoot } from '../workspace-root.mjs';
24-
import {
25-
filterGlobs,
26-
globMatches,
27-
jobBlock,
28-
jobFilterOutputs,
29-
rootCi,
30-
triggerBlock,
31-
UI_JOBS,
32-
uiRun,
33-
withoutComments,
34-
} from './helpers/root-ci';
23+
import { jobBlock, rootCi, triggerBlock, UI_JOBS, uiRun, withoutComments } from './helpers/root-ci';
3524

3625
/**
3726
* objectui#12214 — the affected-test selector behind the two-speed `Test` lane.
@@ -458,36 +447,6 @@ describe("the root ci.yml's Test UI job wires the selector fail-open (objectui#1
458447
expect(job).toMatch(/uses: actions\/checkout@\S+\n\s+with:\n\s+fetch-depth: 0\n/);
459448
});
460449

461-
// objectstack#28220: the selector answered `mode=full` for a diff confined
462-
// to packages/lint/**, but the shards read only the `ui` output, so the job
463-
// that answer lives in never started and a ui test pinning a lint value went
464-
// unrun until a bystander's queue build. The selector and the job's `if:`
465-
// answer one question from two ends, so this holds them together: every
466-
// workspace package outside this tree that the selector turns full for (read
467-
// from the package graph, never listed here) must match a glob of a filter
468-
// list the shards' `if:` reads.
469-
it('starts the shards on every package outside the tree the selector turns full for (objectstack#28220)', () => {
470-
const ci = rootCi();
471-
const wsRoot = workspaceRoot(repoRoot);
472-
const manifests = trackedFiles(wsRoot).filter(
473-
(rel) => rel.includes('/') && rel.endsWith('/package.json') && !rel.startsWith('ui/') && !rel.startsWith('patches/'),
474-
);
475-
const full = outsideTreeReasons({ root: repoRoot, outside: manifests }).map((reason) => reason.slice(0, reason.indexOf(': ')));
476-
// The live graph reaches the seven packages the root `ui_consumers` list names.
477-
expect(full.length, 'the selector turned full for no outer package: the graph read nothing').toBeGreaterThanOrEqual(7);
478-
expect(full).toContain('packages/lint/package.json');
479-
480-
const outputs = jobFilterOutputs(ci, UI_JOBS.test).filter((o) => o !== 'ui_tree');
481-
const covered = (globs: string[]) => full.filter((rel) => globs.some((glob) => globMatches(glob, rel)));
482-
const globs = outputs.flatMap((o) => filterGlobs(ci, o));
483-
expect(
484-
full.filter((rel) => !covered(globs).includes(rel)),
485-
`a package the selector runs every ui test for matches none of the lists \`${UI_JOBS.test}\` starts on (${outputs.join(', ')})`,
486-
).toEqual([]);
487-
// Able to say no: the shards' old condition, \`ui\` alone, misses packages/lint.
488-
expect(covered(filterGlobs(ci, 'ui'))).not.toContain('packages/lint/package.json');
489-
});
490-
491450
it('keeps the matrix width and the full-suite command for the full battery', () => {
492451
// The width is the job's own `shard:` list, read by the monorepo's one reader of
493452
// shard sizes (it refuses any other spelling); every `/N` the job's run step

0 commit comments

Comments
 (0)