mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem Since #53899, Docs E2E skips the accessibility scan on every CI run, because the scan is slow and only covers the pages a diff names. Nothing checks docs accessibility automatically, and a change to a shared component can break pages that no pull request lists. ## Solution A new **Docs Accessibility Scan** workflow scans every MDX guide on production once a day. - `.github/workflows/docs-a11y-scan.yml` runs `pnpm e2e:docs:all --grep @a11y` against `https://supabase.com` at 05:17 UTC, off the top of the hour when GitHub can delay or drop scheduled runs, and on demand through `workflow_dispatch`. Its concurrency group includes the ref, so a manual run on a branch can't cancel the scheduled run on `master`. It uploads the Playwright report when the scan fails. - `docs-master-alert.yml` now watches the new workflow, so a failed run posts to the docs alerts Slack channel the same way the Production Smoke Tests do. - The shared alert no longer names the latest `master` commit and its author. That commit often didn't cause the failure: a scheduled or manual run tests whatever is deployed, and a workflow that was already failing keeps failing on later commits. The alert now names the workflow, says whether a push, schedule, or manual run failed, and links the run. This applies to every workflow the alert watches. - The scope resolver skips guides that `static-redirects.json` sends elsewhere, in both the pull request scope and the full run. A redirected guide has no docs article to scan, so it could never pass. Today that's only `getting-started/features`. Docs E2E's sparse checkout now includes `apps/docs/lib/redirects` so the resolver can read the file. One helper lists every guide with no docs article to test (nav-disabled and redirected), and both resolvers use it. - The README says where and when the scans run, which checks fail the scan, and how to start one by hand. It also lists guides with no MDX file, such as the CLI and self-hosting config pages, as a known limitation: the full run only resolves MDX guides, so the scan skips them. The full run doesn't need sharding. A list over 20 pages already runs on 3 workers, and the whole site took 15.3 minutes against production, inside the job's 45-minute timeout. ## Known failures A full run against production on 2026-11-30 failed on 5 guides with real accessibility issues: 4 `duplicate-id` and 1 `heading-order`. Until [DOCS-1817](https://linear.app/supabase/issue/DOCS-1817/fix-the-accessibility-issues-the-daily-docs-scan-finds-on-5-guides) fixes them, each daily run fails and posts an alert. ## Follow-ups - [DOCS-1831](https://linear.app/supabase/issue/DOCS-1831/trace-each-docs-accessibility-scan-failure-to-the-commit-that): keep a list of open failures in every docs alert, each with the commit that introduced it, or its possible commits marked unconfirmed. ## Review instructions 1. Run `pnpm -C e2e/docs test` and confirm all 15 tests pass, including the two redirect tests. 2. Confirm a change to a redirected guide resolves to no pages: ```bash printf 'apps/docs/content/guides/getting-started/features.mdx\n' | pnpm -C e2e/docs resolve-docs-scope ``` Expect `skip=true`. 3. Run the scan the way the workflow does, on one passing guide and one guide from DOCS-1817: ```bash cd e2e/docs && PLAYWRIGHT_BASE_URL=https://supabase.com DOCS_E2E_PAGE_PATHS=/docs/guides/auth,/docs/guides/resources pnpm exec playwright test --grep @a11y ``` Expect `/docs/guides/auth` to pass and `/docs/guides/resources` to fail on `heading-order`. 4. Check the alert payload. Copy the `run` script from `docs-master-alert.yml`, replace the `curl` call with `echo "$PAYLOAD"`, and run it with `TRIGGER` set to `push`, then `schedule`. Expect no commit or author in either, and the run type in the workflow line. 5. After merge, start the workflow with `gh workflow run docs-a11y-scan.yml` and confirm it finishes in about 15 to 20 minutes. Verified locally: unit tests, mutation probes on both redirect tests, typecheck, actionlint on the changed workflows, the alert payload for push, scheduled, and manual runs, the resolver on a sparse checkout like the workflow's, and a full-site scan against production. A scheduled workflow only runs from `master`, so the workflow itself hasn't run on GitHub yet. Resolves [DOCS-1816](https://linear.app/supabase/issue/DOCS-1816/run-the-docs-e2e-accessibility-scan-on-a-schedule-across-the-whole) Resolves [DOCS-1826](https://linear.app/supabase/issue/DOCS-1826/word-docs-slack-alerts-for-scheduled-workflow-failures-without-blaming) ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
95 lines
2.8 KiB
TypeScript
95 lines
2.8 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import {
|
|
GUIDE_LIST_COMPONENT,
|
|
GUIDE_LIST_COMPONENT_PAGES,
|
|
resolveAllDocsPages,
|
|
resolveDocsScope,
|
|
} from './resolve-docs-scope.ts'
|
|
|
|
const repoRoot = fileURLToPath(new URL('../../..', import.meta.url))
|
|
|
|
test('maps a guide list component change to its sample pages', async () => {
|
|
const result = await resolveDocsScope({
|
|
changedFiles: [GUIDE_LIST_COMPONENT],
|
|
repoRoot,
|
|
})
|
|
|
|
assert.deepEqual(result.pages, [...GUIDE_LIST_COMPONENT_PAGES].sort())
|
|
assert.equal(result.skip, false)
|
|
})
|
|
|
|
test('ignores unrelated docs component changes', async () => {
|
|
const result = await resolveDocsScope({
|
|
changedFiles: ['apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts'],
|
|
repoRoot,
|
|
})
|
|
|
|
assert.deepEqual(result.pages, [])
|
|
assert.equal(result.skip, true)
|
|
})
|
|
|
|
test('skips a guide that the navigation disables', async () => {
|
|
const result = await resolveDocsScope({
|
|
changedFiles: [
|
|
'apps/docs/content/guides/ai-tools/agent-feedback.mdx',
|
|
'apps/docs/content/guides/ai-tools/mcp.mdx',
|
|
],
|
|
repoRoot,
|
|
})
|
|
|
|
assert.deepEqual(result.pages, ['/docs/guides/ai-tools/mcp'])
|
|
})
|
|
|
|
test('excludes a guide that the navigation disables from the full run', async () => {
|
|
const pages = await resolveAllDocsPages(repoRoot)
|
|
|
|
assert.ok(pages.includes('/docs/guides/ai-tools/mcp'))
|
|
assert.ok(!pages.includes('/docs/guides/ai-tools/agent-feedback'))
|
|
})
|
|
|
|
test('skips a guide that redirects out of the docs', async () => {
|
|
const result = await resolveDocsScope({
|
|
changedFiles: [
|
|
'apps/docs/content/guides/getting-started/features.mdx',
|
|
'apps/docs/content/guides/ai-tools/mcp.mdx',
|
|
],
|
|
repoRoot,
|
|
})
|
|
|
|
assert.deepEqual(result.pages, ['/docs/guides/ai-tools/mcp'])
|
|
})
|
|
|
|
test('excludes a guide that redirects out of the docs from the full run', async () => {
|
|
const pages = await resolveAllDocsPages(repoRoot)
|
|
|
|
assert.ok(pages.includes('/docs/guides/ai-tools/mcp'))
|
|
assert.ok(!pages.includes('/docs/guides/getting-started/features'))
|
|
})
|
|
|
|
test('keeps every page in a large change', async () => {
|
|
const changedFiles = Array.from(
|
|
{ length: 82 },
|
|
(_, i) => `apps/docs/content/guides/ai-tools/page-${String(i).padStart(2, '0')}.mdx`
|
|
)
|
|
|
|
const result = await resolveDocsScope({ changedFiles, repoRoot })
|
|
|
|
assert.equal(result.pages.length, 82)
|
|
assert.deepEqual(result.pages, [...result.pages].sort())
|
|
})
|
|
|
|
test('keeps the pages a guide list component change requires alongside the changed pages', async () => {
|
|
const result = await resolveDocsScope({
|
|
changedFiles: [GUIDE_LIST_COMPONENT, 'apps/docs/content/guides/ai-tools/mcp.mdx'],
|
|
repoRoot,
|
|
})
|
|
|
|
assert.deepEqual(
|
|
result.pages,
|
|
[...GUIDE_LIST_COMPONENT_PAGES, '/docs/guides/ai-tools/mcp'].sort()
|
|
)
|
|
})
|