feat(atomic-a11y): add merge-shards for parallel a11y report aggregation#7137
Open
y-lakhdar wants to merge 11 commits intofeat/a11y-reporterfrom
Open
feat(atomic-a11y): add merge-shards for parallel a11y report aggregation#7137y-lakhdar wants to merge 11 commits intofeat/a11y-reporterfrom
y-lakhdar wants to merge 11 commits intofeat/a11y-reporterfrom
Conversation
5cb5fe5 to
61496ce
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds shard-report aggregation support to @coveo/atomic-a11y so parallel Storybook/Vitest shard runs can be merged into a single consolidated a11y-report.json artifact.
Changes:
- Added
mergeA11yShardReports()(plusmergeComponents/mergeCriteria) to load shard JSON files and produce a merged report + recomputed summary. - Updated
VitestA11yReportersharded behavior to write onlya11y-report.shard-N.json(skip base file to avoid partial data). - Added a package-level Vitest config + unit tests for merge behavior and a simple merge CLI script.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/atomic-a11y/vitest.config.js | Adds Vitest config for running atomic-a11y unit tests. |
| packages/atomic-a11y/src/shared/constants.ts | Changes default report output directory constant. |
| packages/atomic-a11y/src/reporter/vitest-a11y-reporter.ts | Adjusts sharded output behavior to only write shard report files. |
| packages/atomic-a11y/src/reporter/merge-shards.ts | Implements shard discovery, validation, merge logic, and merged report writing. |
| packages/atomic-a11y/src/index.ts | Exposes mergeA11yShardReports on the package public API. |
| packages/atomic-a11y/src/data/wcag-criteria.ts | Modifies a generated WCAG data file (interface export change). |
| packages/atomic-a11y/src/tests/merge-shards.test.ts | Adds unit coverage for component/criteria merge behavior and summary integration. |
| packages/atomic-a11y/scripts/merge-shards-cli.mjs | Adds a minimal CLI entrypoint invoking the merge function from dist. |
| packages/atomic-a11y/package.json | Adds a11y:merge-shards script. |
Comment on lines
+98
to
+109
| const existing = componentsByName.get(component.name); | ||
| if (!existing) { | ||
| componentsByName.set(component.name, toMutableComponent(component)); | ||
| continue; | ||
| } | ||
|
|
||
| existing.storyCount += component.storyCount; | ||
| existing.automated.violations += component.automated.violations; | ||
| existing.automated.passes += component.automated.passes; | ||
| existing.automated.incomplete += component.automated.incomplete; | ||
| existing.automated.inapplicable += component.automated.inapplicable; | ||
|
|
There was a problem hiding this comment.
mergeComponents currently sums counts and unions criteria, but it never backfills category/framework when the first shard has unknown and a later shard has a known value. This contradicts the intended merge behavior and will cause the included tests to fail. Update the merge to mirror VitestA11yReporter.getOrCreateComponent() behavior (prefer non-unknown values when merging).
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.
TL;DR
Merge shard JSON reports from parallel CI runs into a single consolidated a11y report.
Context
When Storybook tests run with
--shard=N/M, each shard writes its owna11y-report.shard-N.json. This PR adds the merge step that combines them.How the shard merge works
When Storybook tests run with --shard, each shard writes its own
a11y-report.shard-N.json. The merge step recombines them into a singlea11y-report.json.mergeA11yShardReports()— entry pointa11y-report.shard-{N}.jsonPromise.allSettled— invalid shards are skipped with a warning)mergeComponents()→mergeCriteria()→createSummary()merged a11y-report.jsonmergeComponents()— deduplicate by component namecriteriaCoveredsets andincompleteDetailsarraysexample
Shard 1 tested
atomic-search-boxwith commerce stories, shard 2 tested it with search stories:mergeCriteria()— deduplicate by criterion ID, two passesaffectedComponentsacross shards for each criterion IDexample
Pass 1 — merge from shard criteria lists:
Pass 2 — infer from merged components. Suppose
atomic-result-listcovers criterion "4.1.2" (from itscriteriaCoveredarray), but no shard had a "4.1.2" criteria entry:PR Chain (4 of 7)
KIT-5469