Repository navigation
ci: a changed story runs the interaction specs of the components it imports - #11250
Conversation
…mports The Chromium selector ran the full suite for any changed story. It now maps a story to the component folders it takes by value (storyComponentFolders, the resolver the release-spec visits use, now in a11y-pr-contracts.mjs), and runs their specs. A story whose imports do not resolve still runs the full suite.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 85.8 | 85.8 | 0 |
| Runner pool, runner-minutes a day | 41,051 | 41,051 | 0 (0%) |
| Average concurrent jobs | 28.5 | 28.5 | 0 |
| Time to green (median → this run) | 28.5 min | 22.9 min | −5.6 min |
| Runs a day | 478 | 478 | 0 |
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/a11y-pr-contracts.mjs, .github/scripts/interaction-selection-replay.mjs, .github/scripts/interaction-selection-replay.test.mjs, .github/scripts/playwright-legs.mjs, .github/scripts/playwright-legs.test.mjs, .github/scripts/release-spec-visits.mjs, .github/scripts/release-specs-plan.test.mjs.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Generated by PR Enrichment workflow | View full report
…imports A name from a package root that no component folder holds, or a whole-package import, runs the full suite; a shared subpath adds nothing; a story's imported primitives count as touched only when their own source changed. The verification row names the selector's story-mapping cases, one per branch.
|
/approve-spec a49eab5 |
There was a problem hiding this comment.
Changes requested: mapping a changed story to the folders it imports is a real CI saving, but three problems need fixing first.
- A changed story no longer runs the interaction specs in other folders that open it by id (66 story–spec pairs across 32 stories; for example a
TextInput.stories.tsxchange skipspackages/core/src/Field/__tests__/TextFieldFocusTiming.interaction.browser.spec.ts, which openscore-textinput--default), so also select every interaction spec that opens one of the changed story's ids and add a test for that case. - The new FR12 sentence in
docs/specs/AST-030/spec.mdsays an unresolved story "runs the full suite" right before "Nothing starts a full suite on its own", and because it exempts only primitives from counting as touched, FR31 would require the dependents' specs of every other story folder, whichchromiumSelectionnever adds; move a reworded rule into FR31 that says a story's folders add only their own specs, and re-approve the record at the new head. - Miss:
storyComponentFolderslooks up a package-root name in every package, soChartLegendfrom@astryxdesign/chartsinapps/storybook/stories/charts/Legend.stories.tsxresolves topackages/lab/src/Chart/and skips the full suite the FR12 rule requires; pass the import's package to the lookup and add a test for that case.
Smaller: a removed or renamed story makes the selection step throw on the missing path; the workflow still falls back to the full suite, but returning null when the tree lacks the story keeps a clean result and its selection artifact.
…to FR31 A changed story now also selects every interaction spec that opens one of its story ids (storyIdsOpened, shared with the release-spec visits in a11y-pr-contracts.mjs), so a TextInput story change still runs Field's TextFieldFocusTiming spec. A package-root name resolves only within its own package, so ChartLegend from Charts no longer answers to Lab's Chart folder. A removed story, or a spec's templated id that could name it and no quoted name fills, runs the full suite. The rule moves from FR12 to FR31: the story's folders add their own specs and are not touched, so they add no dependents.
|
/approve-spec bf3e11a |
There was a problem hiding this comment.
Changes requested: a changed story now runs the specs that open it and resolves package-root names within their own package, but two problems remain before the Chromium lane can narrow on story changes safely.
- A changed story narrows instead of running the full suite when the opener scan cannot read its id, because nine stories with an inline meta title get no id, four take a data row's
title:(.github/scripts/a11y-pr-contracts.mjs:1524), and an unfilled template such aslab-chat-${c}--is compared only by its last segment (.github/scripts/playwright-legs.mjs:360-361); returnnullfor a story with no id, read the title from the default-export meta, match templates by their whole prefix, and add tests that the FR31 verification row lists. - Miss:
STORY_FILE(.github/scripts/playwright-legs.mjs:374) copiesSTORY_FILE_PATH(.github/scripts/a11y-pr-contracts.mjs:1523), so export oneisStoryFilefroma11y-pr-contracts.mjsand use it in both places.
No spec in the repository hits the first case yet, so today's selections are correct. Any new commit needs a fresh engineering-owner /approve-spec for the FR31 change at that head.
…id runs the full suite
storyMeta reads the title and id at the default-export meta's own depth, so
an inline meta gets its id and a data row's title never counts. A changed story
whose meta names no id runs the full suite. A templated id's whole literal
prefix (lab-chat-${name}--) decides whether it could name the story. One
isStoryFile, exported from a11y-pr-contracts.mjs, picks story files for both
the selector and the story index.
|
/approve-spec 055217a |
There was a problem hiding this comment.
Changes requested: mapping a changed story to the specs it reaches is a clear CI saving, and every earlier blocker is fixed, but two selection gaps and one description error remain.
- Miss: a story title (or meta
id) change drops the specs in other folders that still open the old id, though the change breaks them; renamingTextInput.stories.tsx's title dropsField/TextFieldFocusTiming(playwright-legs.mjs:353-360), so havestoryScopeForrun the full suite when a spec opens a story id no story file makes, and add that case to the tests. - Miss:
interaction-selection-replay.mjscallschromiumSelectionwithoutstoryScopeand archives noapps/storybook, so the replay FR31 relies on still runs every story change as the full suite and cannot show that the new story rule catches what full runs catch; passstoryScopeForthere and add a replay test for a story-only change. - The description's rubric line says 62 of 313 stories fall back to the full suite, but the selector gives 63 (as "What changes" says); correct the R2 line.
Smaller points: the doc comment over export {storyFiles, storyIdOf} in release-spec-visits.mjs repeats isReleaseFile's, and nothing imports storyIdOf from there; the step summary counts only touched and dependent folders, so a story-only selection reports zero of both.
Claims and files checked
- Verified: a
TextInputstory change selectsField'sTextFieldFocusTiming(playwright-legs.test.mjs:286-294, and the selector run on this tree). - Verified:
ChatVirtualizerfrom@astryxdesign/labmaps tolab/Chatand selects Chat's specs (:254-284). - Verified:
ChartLegendfrom@astryxdesign/chartsfails closed (:296-304). - Verified: a relative import into a component folder, through a local helper, names that folder (
a11y-pr-contracts.mjs:1473-1491,:1635-1636; scratch run). - Verified: story ids come from the default-export meta; inline metas get ids and data-row titles never count (
:190-219; the six stories with data-row titles resolve to their meta). - Verified: unresolved root names, whole-package imports, removed stories, stories with no id and unfilled whole-prefix templates run the full suite (
:149-177,:221-252,:296-304). - Verified: 63 of 313 stories fall back to the full suite today (the head's selector over every story).
- False: the rubric's "62 of 313 fall back to the full suite".
- Verified: no primitive escalation (
playwright-legs.mjs:451-463;Button.stories.tsxstays narrow). - Verified: the eight helpers live in
a11y-pr-contracts.mjs, which the leg planner copies (ci.yml"Keep the leg planner"), and the release-spec visit reader from #11171 uses them with unchanged visits for all 68 release specs. - Verified: the selection reports story folders as
stories(playwright-legs.mjs:486); FR31's paragraph and verification row say what the description says (docs/specs/AST-030/spec.md:640-647,:767). - Verified: the listed tests exist, and the
ChatVirtualizerselection test cannot pass on main, which lacksstoryScopeFor. - Verified in CI: the planner, replay, release-spec and contract test files pass at this head (
playwright-legs.test.mjs79 tests,a11y-pr-contracts.test.mjs81,interaction-selection-replay.test.mjs8,release-specs-plan.test.mjs22); the 10-file tally was not recounted. - Not confirmed: #11095 and #11180 change no story file in their current file lists; #10879 changes
ChatVirtualizer.stories.tsx. - Verified: R1 and R3 to R7.
.github/scripts/a11y-pr-contracts.mjs: clear..github/scripts/playwright-legs.mjs: title-change gap; step-summary count (non-blocking)..github/scripts/playwright-legs.test.mjs: clear apart from the missing title-change case..github/scripts/release-spec-visits.mjs: repeated doc comment and unused re-export (non-blocking)..github/scripts/release-specs-plan.test.mjs: clear.docs/specs/AST-030/spec.md: clear.
…ite; the replay uses the story rule After a story's title changes, the specs that still open its old id are stranded, so any dangling story id in an interaction spec makes a story change run the full suite (none today). The selection replay passes storyScopeFor and archives the stories, so it replays what the lane selects. The step summary counts changed-story folders. FR31 and its verification row name the case.
|
/approve-spec 6604f97 |
There was a problem hiding this comment.
Changes requested: mapping a changed story to the specs it reaches is a clear CI saving, every earlier blocker is fixed, and CI is green on this head; one description error remains.
- Miss: the description says the guardian saw a changed story run the full suite on #11095 and #11180, but #11095 changes only spec records and #11180 only CLI files, so neither changes a story; cite #10879 alone, or pull requests that change a story.
Smaller points: the doc comment over the storyFiles re-export in release-spec-visits.mjs says it is for the plan's tests, though release-specs-plan.mjs uses it directly; the replay test matches source text rather than replaying a story change.
Claims and files checked
- Verified: on the base a changed story ran the whole suite because it maps to no component (kept when no resolver is given,
playwright-legs.test.mjs:1719). - False: "The guardian saw it on #11095, #11180": neither changes a story. Verified for #10879, which changes
ChatVirtualizer.stories.tsx. - Verified: a
TextInputstory change selectsField'sTextFieldFocusTiming(playwright-legs.test.mjs:297-305, and the selector run on this tree). - Verified:
@astryxdesign/<package>/<Folder>names its folder (a11y-pr-contracts.mjs:1641-1644; test:149-188). - Verified: a package-root name maps to the folder holding its source in that package;
ChatVirtualizermaps tolab/Chat(:265-295) andChartLegendfrom Charts fails closed (:307-316). - Verified: a relative import into a component folder, including through local story helpers, names that folder (
a11y-pr-contracts.mjs:1473-1497,:1634-1636;DisabledTriggerFocusA11y.stories.tsxresolvescore/Selector). - Verified: story ids come from the default-export meta, inline metas included and data-row titles ignored (
playwright-legs.test.mjs:190-219); every story's ids match this head's Storybook build. - Verified: the fail-closed cases (
playwright-legs.mjs:347-370; tests:221-263,:307-316), and no spec opens a dangling id today. - Verified: 63 of 313 stories fall back to the full suite (the head's selector over every story).
- Verified: no primitive escalation (
playwright-legs.mjs:454-466;Button.stories.tsxstays narrow), and every other rule is unchanged. - Verified: the eight helpers live in
a11y-pr-contracts.mjs, which the interaction job copies (ci.yml:2702); the release-spec visit reader uses them with identical visits for all 68 release specs. - Verified: the selection reports story folders as
storiesand the step summary counts them (playwright-legs.mjs:489,:824). - Verified: the replay passes
storyScopeForand archives the stories (interaction-selection-replay.mjs:195,:251). - Verified: FR31's paragraph and verification row say what the description says (
docs/specs/AST-030/spec.md:640-648,:768). - Verified: the listed tests exist, and the
ChatVirtualizerselection test cannot pass on main, which lacksstoryScopeFor. - Verified in CI:
playwright-legs.test.mjs(80 tests),a11y-pr-contracts.test.mjs(81),interaction-selection-replay.test.mjs(9) andrelease-specs-plan.test.mjs(22) pass at this head; the 10-file tally was not recounted. - Verified: CI impact (250 of 313 stories now run a subset) and rubric R1 to R7.
.github/scripts/a11y-pr-contracts.mjs: clear..github/scripts/interaction-selection-replay.mjs: clear..github/scripts/interaction-selection-replay.test.mjs: source-text test (non-blocking)..github/scripts/playwright-legs.mjs: clear..github/scripts/playwright-legs.test.mjs: clear..github/scripts/release-spec-visits.mjs: re-export comment (non-blocking)..github/scripts/release-specs-plan.test.mjs: clear.docs/specs/AST-030/spec.md: clear.
| valueImports, | ||
| } from './a11y-pr-contracts.mjs'; | ||
|
|
||
| /** The story index, for the release-spec plan's tests. */ |
There was a problem hiding this comment.
Non-blocking: release-specs-plan.mjs:32 and :112 use this re-export in the plan itself, not only in its tests. Say "for the release-spec plan", or import storyFiles from a11y-pr-contracts.mjs there and drop the re-export.
| 'utf8', | ||
| ); | ||
|
|
||
| it("passes the lane's story rule, so a story-only change replays its narrow selection", () => { |
There was a problem hiding this comment.
Non-blocking: the name promises that a story-only change replays its narrow selection, but the test only matches the replay's source text. Either name it for what it checks, or exercise chromiumSelection with storyScopeFor over a small fixture tree the way replay() builds its inputs.
There was a problem hiding this comment.
Approved: a changed story now runs the interaction specs it reaches instead of the whole Chromium suite, the rule is recorded in FR31 with an owner's approval for this head, CI is green, and the description now cites only #10879, which changes a story.
Non-blocking points:
- Miss: the opener scan cannot see a story id whose whole prefix is a variable, as in TabBar's spec (
${title}--${story}), and such a template never falls back to the full suite; nothing escapes today because both stories it opens already run the full suite, but treating${…}--with no literal prefix as a template would close the gap. - The doc comment over the
storyFilesre-export inrelease-spec-visits.mjssays it is for the plan's tests, thoughrelease-specs-plan.mjsuses it directly. - The replay test matches source text rather than replaying a story change.
Claims and files checked
- Verified: on the base a changed story ran the whole suite because it maps to no component (base
playwright-legs.mjs:396; kept when no resolver is given,playwright-legs.test.mjs:1719). - Verified: #10879 changes
ChatVirtualizer.stories.tsx. - Verified: a story change runs every interaction spec that opens one of its ids; a
TextInputstory selectsField'sTextFieldFocusTiming(playwright-legs.test.mjs:297-305, and the selector run on this tree), within the variable-prefix limit above. - Verified:
@astryxdesign/<package>/<Folder>names its folder, a package-root name maps to the folder holding its source in that package, and a name the package does not hold is unresolved (a11y-pr-contracts.mjs:1630-1657; testplaywright-legs.test.mjs:149-188). - Verified:
ChatVirtualizerfrom Lab maps tolab/Chat(:265-295), andChartLegendfrom Charts fails closed (:307-316). - Verified: a relative import into a component folder, including through local story helpers, names that folder (
a11y-pr-contracts.mjs:1473-1497,:1634-1636). - Verified: story ids come from the default-export meta, inline metas included and data-row titles ignored (
a11y-pr-contracts.mjs:1533-1568; testplaywright-legs.test.mjs:190-219); every story's ids match this head's Storybook build. - Verified: the fail-closed cases (
playwright-legs.mjs:347-370; testsplaywright-legs.test.mjs:221-263,:307-316), and no spec opens a dangling id today. - Verified: 63 of 313 stories fall back to the full suite (the head's selector over every story).
- Verified: no primitive escalation and no dependents for story folders (
playwright-legs.mjs:454-476;Button.stories.tsxstays narrow), and every other rule is unchanged. - Verified: the eight helpers live in
a11y-pr-contracts.mjs, which each interaction lane copies (ci.yml:2702) and the release-spec plan checks out; #11171's visit reader uses them, with identical visits for all 68 release specs. - Verified: the selection reports story folders as
stories, and the step summary counts them (playwright-legs.mjs:489,:824). - Verified: the replay passes
storyScopeForand archives the stories (interaction-selection-replay.mjs:195,:251); the committed replay record is unchanged. - Verified: FR31's paragraph and verification row say what the description says (
docs/specs/AST-030/spec.md:640-648,:768). - Verified: the listed tests exist, and the
ChatVirtualizerselection test cannot pass on the base, which lacksstoryScopeFor. - Verified in CI: the planner, interaction-lane, replay, release-spec and contract test files pass at this head (
playwright-legs.test.mjs80 tests,a11y-pr-contracts.test.mjs81,interaction-selection-replay.test.mjs9,release-specs-plan.test.mjs22). - Verified: CI impact (250 of 313 stories now run a subset) and rubric R1 to R7.
.github/scripts/a11y-pr-contracts.mjs: variable-prefix story ids (non-blocking)..github/scripts/interaction-selection-replay.mjs: clear..github/scripts/interaction-selection-replay.test.mjs: source-text test (non-blocking)..github/scripts/playwright-legs.mjs: clear..github/scripts/playwright-legs.test.mjs: clear..github/scripts/release-spec-visits.mjs: re-export comment (non-blocking)..github/scripts/release-specs-plan.test.mjs: clear.docs/specs/AST-030/spec.md: clear.
| /** A story id prefix in a spec or its helpers: `core-bottomsheet--…`. */ | ||
| const STORY_ID = /(?:id=|['"`])([a-z0-9][a-z0-9-]*?)--(?:[a-z0-9$]|['"`])/g; | ||
| /** A story id whose component part a template fills: `core-${name}--`. */ | ||
| const TEMPLATED_ID = /([a-z0-9][a-z0-9-]*)-\$\{[^}]+\}--/g; |
There was a problem hiding this comment.
Non-blocking (miss): this needs a literal prefix before -${, and STORY_ID needs -- inside one quoted literal, so ${title}--${story} in packages/lab/src/TabBar/__tests__/TabBar.interaction.browser.spec.ts:180 (and ${MORE_LIST}--more-tab at :3307) is neither filled nor counted as unfilled. Both stories it opens run the full suite today, but a spec in another folder written this way would not run when its story changes.
Treat ${…}-- with no literal prefix as a template: fill it from the file's quoted names that are story ids, and fail closed when none does.
… retries a server error (#11317) * ci: the selection replay record covers the story rule; a log download retries a server error The record is regenerated with the Chromium lane's story rule (#11250). Every verdict matches the earlier record: 144 no failure, 4 caught, 4 reviewed, 1 out of scope. Three pull requests that change only stories now replay a narrow selection with no failure (#9672, #10271, #10944). GitHub's job-log endpoint answers 502 now and then, so failingSpecs tries a server error again, up to four times, before it calls a log unreadable. * Merge remote-tracking branch 'origin/main' into ci/replay-story-rule * ci: a log download waits only between tries, not after the last failingSpecs no longer waits after its fourth and last try, so a log that keeps answering 5xx gives up after 30 s of waits, and a test pins four server errors in a row. This also corrects the earlier commit's wording: the three pull requests that now replay a narrow selection (#9672, #10271, #10944) are ones whose story was their only full-suite trigger, not ones that change only stories. Their stories are Drawer, TableSelection and Avatar; Button's specs run because those stories import Button.
Who this helps
Authors whose pull request changes a Storybook story. The Chromium interaction selector (C3, AST-030 FR31) ran the whole Chromium suite for any changed story, because a story file maps to no component folder. The guardian saw it on #10879, which changes
apps/storybook/stories/ChatVirtualizer.stories.tsx.What changes
TextInputstory change runsField'sTextFieldFocusTiming), and the interaction specs of the component folders it takes by value:@astryxdesign/<package>/<Folder>;ChatVirtualizerfrom@astryxdesign/labislab/Chat;ChartLegendfrom@astryxdesign/charts, which no Charts folder holds, fails closed);title, and an ownid), read at the meta's depth, so an inline meta gets its id and a data row'stitlenever counts.lab-chat-${name}--) could name this story and no quoted name fills it, or when a spec opens a story id no story file makes (a renamed title strands its openers; none today). Today 63 of 313 stories fall back to the full suite.isStoryFile,storyMeta,storyComponentFolders,storyFiles,storyIdOf,storyIdsOpened,localModulesandcomponentFolderNamedlive ina11y-pr-contracts.mjs, which every lane already copies. ci: release-specs (changed) adds tagged specs, visited components and Lab-only pull requests, in shards #11171's release-spec visit reader uses the same helpers from there.stories, and the step summary counts them.interaction-selection-replay.mjspassesstoryScopeForand archives the stories, so it replays the lane's own story rule. Regenerating the committed record under it is a separate run.Tests
playwright-legs.test.mjs:TextInputstory change selectsField'sTextFieldFocusTiming, and a removed story and the chartsLegendstory run the full suite;ChatVirtualizer.stories.tsxmaps topackages/lab/src/Chat/, and a change to it selects Chat's interaction specs instead of the full suite. On main this test fails: the resolver doesn't exist and the change runs the full suite.All planner, interaction-lane, replay, release-spec and contract tests pass (10 files, 264 tests).
CI impact
Fewer full Chromium suites: a story-only change now runs its components' specs instead of every spec.
Writing rubric results