Skip to content

Commit 0caf4dc

Browse files
authored
ci: the PR status table marks a changed shot Δ and a stale RTL reason whose checks pass ↻, so ✗ means only that something needs a fix (#14160)
* ci: a changed visual shot shows Δ in the PR status table, so ✗ means only that something needs a fix The Visual · A11y · RTL cell marked a changed shot ✗, the same as a failure. A changed shot is for review: it now shows Δ, and a legend line under the table names the four marks when the checks column shows. * ci: a stale RTL verified-N/A reason shows ↻ (needs re-verify), not ✗ touched-components reported an RTL stale-verified-na as fail, the same as a detector failure, and the PR status table marked it ✗. It is now its own result, reverify, shown as ↻ and named in the legend; a coverage gap stays fail (✗). The touched job's exit code is unchanged: RTL is not a blocking suite. * docs(AST-030): the touched report's results include reverify, for a stale RTL verified-N/A entry * ci: a stale RTL verified-N/A entry is reverify only when every applicable check passes; a failing check still fails CodeBunny: stale-verified-na fires when an applicable RTL check appears for a declared component, so the early return showed ↻ for a declared component whose check now fails. A failing check now stays fail, and FR12, the code comments and the description say what stale means.
1 parent 85ebe31 commit 0caf4dc

6 files changed

Lines changed: 81 additions & 18 deletions

File tree

‎.github/scripts/lib/pr-status.js‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,17 @@ function locCell(head, base, baseMeasured = true) {
146146

147147
/**
148148
* One mark per browser suite, always in the order Visual · A11y · RTL: ✓
149-
* passed, ✗ failed or changed (its shots are in the visual section), — did
150-
* not run for this component. A passing accessibility result whose only
151-
* violations are in the baseline says how many: `✓ (2 baselined)`.
149+
* passed, ✗ failed (something needs a fix), Δ changed (its shots are in the
150+
* visual section, for review), ↻ needs re-verify (an applicable RTL check
151+
* contradicts a verified-N/A reason, and every applicable check passes), — did
152+
* not run for this component. A passing
153+
* accessibility result whose only violations are in the baseline says how
154+
* many: `✓ (2 baselined)`.
152155
*/
153156
const CHECK_SUITES = ['visual', 'a11y', 'rtl'];
154-
const MARK = {pass: '✓', fail: '✗', changed: '✗'};
157+
const MARK = {pass: '✓', fail: '✗', changed: 'Δ', reverify: '↻'};
158+
const CHECKS_LEGEND =
159+
'✓ passed · ✗ needs a fix · Δ changed, for review in the shots below · ↻ needs re-verify · — did not run';
155160

156161
function checksCell(results, {a11yBaselined = 0} = {}) {
157162
return CHECK_SUITES.map(id => {
@@ -269,10 +274,10 @@ function componentRows({
269274
});
270275
}
271276

272-
/** Failed or changed results first, then budget overruns, then the biggest growth. */
277+
/** Failed, changed or re-verify results first, then budget overruns, then the biggest growth. */
273278
function importance(row) {
274279
const attention = Object.values(row.results).some(
275-
value => value === 'fail' || value === 'changed',
280+
value => value === 'fail' || value === 'changed' || value === 'reverify',
276281
);
277282
return [
278283
attention ? 0 : 1,
@@ -335,6 +340,7 @@ function buildComponentTable({
335340
const visible = rows.slice(0, VISIBLE_ROWS);
336341
const rest = rows.slice(VISIBLE_ROWS);
337342
let out = `### Modified components\n\n${header}${visible.map(line).join('\n')}\n\n`;
343+
if (checks) out += `${CHECKS_LEGEND}\n\n`;
338344
if (rest.length > 0)
339345
out += `<details>\n<summary>${rest.length} more component${rest.length === 1 ? '' : 's'}</summary>\n\n${header}${rest.map(line).join('\n')}\n\n</details>\n\n`;
340346
return out;

‎.github/scripts/lib/pr-status.test.mjs‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ describe('checksCell', () => {
9595
expect(checksCell({visual: 'pass', a11y: null, rtl: 'fail'})).toBe(
9696
'✓ · — · ✗',
9797
);
98-
expect(checksCell({visual: 'changed'})).toBe('✗ · — · —');
98+
// A changed shot is for review, not a failure: ✗ means only that something needs a fix.
99+
expect(checksCell({visual: 'changed'})).toBe('Δ · — · —');
100+
// A stale RTL verified-N/A reason needs a new look, not a fix.
101+
expect(checksCell({rtl: 'reverify'})).toBe('— · — · ↻');
99102
});
100103
});
101104

@@ -230,7 +233,10 @@ describe('buildComponentTable', () => {
230233
},
231234
]),
232235
});
233-
expect(table).toMatch(/^\| \[Chat\][^\n]* \| ✗ · ✓ · ✗ \|$/m);
236+
expect(table).toMatch(/^\| \[Chat\][^\n]* \| Δ · ✓ · ✗ \|$/m);
237+
expect(table).toContain(
238+
'✓ passed · ✗ needs a fix · Δ changed, for review in the shots below · ↻ needs re-verify · — did not run',
239+
);
234240
expect(table).toMatch(/^\| \[lab\/Chat\][^\n]* \| ✓ · ✓ · ✓ \|$/m);
235241
});
236242

@@ -335,6 +341,25 @@ describe('buildComponentTable', () => {
335341
expect(table).toContain('| ✗ · — · — |');
336342
});
337343

344+
it('shows the marks legend only when the table has the checks column', () => {
345+
const sizes = {'core/Card': {importGzipBytes: 2048, cssGzipBytes: null}};
346+
const input = {
347+
analysis: {
348+
baseSha: 'a'.repeat(40),
349+
componentSizes: sizes,
350+
baseComponentSizes: sizes,
351+
},
352+
origin: '',
353+
};
354+
expect(buildComponentTable(input)).not.toContain('needs a fix');
355+
expect(
356+
buildComponentTable({
357+
...input,
358+
visualVerdict: {status: 'passed', changes: []},
359+
}),
360+
).toContain('✓ passed · ✗ needs a fix · Δ changed');
361+
});
362+
338363
it('renders nothing when no component changed', () => {
339364
expect(buildComponentTable({analysis: {}, origin: ORIGIN})).toBe('');
340365
});

‎.github/scripts/touched-components.mjs‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
* report and RTL reports a touched-components run wrote
77
* @output `scope`: GitHub step outputs naming what each suite audits.
88
* `report`: touched-components.json, one row per touched component with a
9-
* pass/fail/changed/not-run result for each suite, for the pull-request
9+
* pass/fail/changed/reverify/not-run result for each suite (reverify: an
10+
* applicable RTL check contradicts a verified-N/A reason, and every
11+
* applicable check passes), for the pull-request
1012
* comment; a step summary; exit 1 when visual or accessibility failed
1113
* (RTL findings are soft, as in pr-rtl).
1214
* @position Default pull-request check (spec:AST-030 FR12). It audits only the
@@ -359,11 +361,18 @@ export function rtlResult(identity, reports, stepOutcome = null) {
359361
const coverage = reports
360362
.flatMap(report => report?.coverage?.results ?? [])
361363
.find(entry => namesOwner(entry.component, identity));
362-
if (
363-
coverage?.status === 'coverage-gap' ||
364-
coverage?.status === 'stale-verified-na'
365-
) {
366-
return {result: 'fail', detail: `RTL ${coverage.status}`};
364+
if (coverage?.status === 'coverage-gap') {
365+
return {result: 'fail', detail: 'RTL coverage-gap'};
366+
}
367+
// A verified-N/A reason that an applicable check now contradicts needs a new
368+
// look when every applicable check passes; a failing check still fails.
369+
if (coverage?.status === 'stale-verified-na') {
370+
const failing = mine.filter(
371+
result => result.verdict !== 'pass' && result.verdict !== 'N-A',
372+
);
373+
return failing.length > 0
374+
? {result: 'fail', detail: `${failing.length} RTL check(s) failed`}
375+
: {result: 'reverify', detail: 'RTL stale-verified-na'};
367376
}
368377
if (mine.length === 0) {
369378
return stepOutcome === 'failure'

‎.github/scripts/touched-components.test.mjs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,26 @@ describe('per-component results', () => {
431431
},
432432
]),
433433
).toEqual({result: 'fail', detail: 'RTL coverage-gap'});
434+
// A verified-N/A reason that an applicable check now contradicts needs a
435+
// new look when that check passes, and still fails when it fails.
436+
const stale = verdict => [
437+
{
438+
autoDiscovery: {
439+
results: [{component: 'core/Button', verdict}],
440+
},
441+
coverage: {
442+
results: [{component: 'core/Button', status: 'stale-verified-na'}],
443+
},
444+
},
445+
];
446+
expect(rtlResult(button, stale('pass'))).toEqual({
447+
result: 'reverify',
448+
detail: 'RTL stale-verified-na',
449+
});
450+
expect(rtlResult(button, stale('fail'))).toEqual({
451+
result: 'fail',
452+
detail: '1 RTL check(s) failed',
453+
});
434454
expect(rtlResult(button, [], 'failure').result).toBe('fail');
435455
expect(rtlResult(button, [], 'success').result).toBe('not-run');
436456
// A partial curated card (some dimensions hold, others do not) fails.

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6840,7 +6840,7 @@ jobs:
68406840
# FR12). It never widens to reverse dependents or a full suite: those run
68416841
# behind the ci:run-<suite> labels and in the release check. It writes
68426842
# touched-components.json, one row per component with each suite's
6843-
# pass/fail/changed/not-run result, or the wide flag and count, for the
6843+
# pass/fail/changed/reverify/not-run result, or the wide flag and count, for the
68446844
# pull-request comment. No required context depends on it.
68456845
pr-touched-components:
68466846
name: Touched components (visual, accessibility, RTL)

‎docs/specs/AST-030/spec.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,12 @@ they are separately named.
248248
accessibility audit, new violations only, of each story file it adds or
249249
changes that no other audit in the pull request covers. Nothing starts a full suite on its own; a wide change's check
250250
is the full suites behind the labels. No required context depends on the
251-
touched check, and it records each touched component's pass, fail, changed
252-
or not-run result per suite, or that the change was wide and how many
253-
components it touched, for the pull-request comment. Beside the default check, one contract job runs, in Chromium, the
251+
touched check, and it records each touched component's pass, fail, changed,
252+
reverify or not-run result per suite, or that the change was wide and how many
253+
components it touched, for the pull-request comment. `reverify` marks an RTL
254+
verified-not-applicable entry that an applicable RTL check now contradicts,
255+
when every applicable check passes; a failing check and a coverage gap stay
256+
`fail`. Beside the default check, one contract job runs, in Chromium, the
254257
browser accessibility contracts of the components the change touches. It
255258
needs only the pull request's Storybook build. First it runs the browser
256259
accessibility spec files the change adds or modifies, at most four, in path

0 commit comments

Comments
 (0)