mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
create-pull-request/patch
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cf63aa5459 |
ci(docs): trace docs workflow failures to the commits that introduced them (#54444)
## Problem Since #54339, the docs alert in `docs-master-alert.yml` names only the workflow, the run type, and the run link. That stopped it from blaming whoever merged last, but nothing says which change broke things. A failure needs to trace back to the commit that introduced it, for push, scheduled, and manual runs alike. Nobody needs to be pinged. ## Solution Each docs workflow that runs on `master` keeps a list of open failures. The alert posts to Slack only when a failure is added or fixed. Each new failure names the commit that introduced it, or lists the possible commits as unconfirmed. It never names the latest commit by default. - **What counts as a failure.** - Accessibility scan: a page and axe rule pair, from a new Playwright reporter (`e2e/docs/utils/a11y-failures-reporter.ts`). A guide that returns a status of 400 or higher fails as `<page>: http-<status>`. - Production smoke tests: one Vitest test, keyed as `<file> › <test>`, from Vitest's JSON reporter. A run where no test passed and some timed out counts as one failure, `every test timed out`. - Every other workflow: a failed job or step, from the Actions API. - Both test workflows upload their results as a `docs-failures-<attempt>` artifact for the alert to read, so a re-run never picks up an earlier attempt's results. - A Vitest file that fails to load, such as an import error, counts as one failure for that file, and its tests keep their earlier results. - **Which commit.** - Accessibility scan: the commits deployed to production since the last run, narrowed to the ones that touched the failing page's MDX file or a partial it includes. - Smoke tests: the deployed commits, not narrowed further. - Push runs: the run's own commit, plus the commits of every earlier run since the baseline whose alert didn't run, such as one that was cancelled or dropped. A run among them that passed still counts, since it may have skipped the failing step. - Other scheduled or manual runs: the commits since the last run without that failure. - One commit left is named. Several, or none on the failing page, are listed as unconfirmed. - **Deployed commits.** One GraphQL query reads the `Vercel – docs` status on recent `master` commits. A commit counts as deployed once its build finished before the run ended, so the range includes a commit that deploys partway through a scan. Builds Vercel skipped as not affected count too, because they leave the docs unchanged. The `Production – docs` GitHub deployments stopped updating, so they can't be used. No new secrets. - **Flaky results.** A page or smoke test that times out keeps its earlier result, so it doesn't count as a new failure or a fix. The same goes for a page whose scan is missing, empty, or skipped, for a skipped smoke test, and for a job or step that neither passed nor failed, such as one skipped after a failed step, cancelled, or with no conclusion. A job that timed out counts as failed. A step keeps its result when its whole job was skipped or failed without listing its steps, or when a passing run's condition skipped it. A guide that returns an error status keeps its earlier axe failures until a scan runs, and a new status replaces the earlier one. A step skipped in one run and then under a skipped job in the next keeps the baseline from the run that last ran it. When one of these later fails, its range starts at the last run that actually checked it. If no run has checked it since tracking started, the alert names no commit. - **Saving the list.** The list is saved as a run artifact for each workflow, kept for 90 days. The next alert downloads it. A failure that's still open keeps the commit from when it first failed. The alert only accepts a saved list from a `master` run in this repo, and ignores one without the expected shape and version. - **Pure logic and orchestration.** `e2e/docs/utils/open-failures.ts` holds the logic and the Slack message, with unit tests. `e2e/docs/scripts/docs-alert.ts` handles the API calls and posting. `pageSourceFiles` in `resolve-docs-scope.ts` lists a guide's MDX file and every partial it includes. `failure-sequences.test.ts` runs every sequence of four runs, for a job's steps, a smoke test file's tests, and a guide's status and scan, plus sequences that start with no saved list. It checks the open list and each new failure's baseline against a model of what each run observed. The axe rules and result checks the reporter needs moved to `utils/axe-rules.ts`, so the unit tests still run before CI installs packages. ### Behavior changes to review 1. **The alert also runs on passing runs.** It needs them to clear fixed failures, and it posts only when the list changes. A workflow that keeps failing no longer posts on every run. 2. **Smoke tests aren't narrowed to a page.** They test API routes, not guides, so the alert lists every deployed commit since the last passing run. 3. **First run.** With no saved list, the alert compares against the previous run if that run passed. The jobs and steps that run skipped count as never checked. Otherwise, current failures show as "already failing when tracking started", with no commit. 4. **Fewer workflows trigger the alert.** Docs Navigation Checks, Docs removed anchors, and Docs Tests run only on `pull_request`, so they never matched `branches: [master]`. They're removed from the trigger list. 5. **Runs from forks are ignored.** The `branches: [master]` filter also matches a fork branch named `master`, and the alert now reads artifacts from the run that triggered it. For the same reason, a saved list that a fork or another branch uploaded is never used. 6. **Missing results.** If the scan or smoke tests have no readable results, the list stays as it was. A scan whose spec fails to load and a smoke run with no test files count as no results too. When the run failed, the alert posts a plain "failed before it reported any results" message. ## Limitations - With no saved list, the scan and smoke tests count everything the previous passing run skipped as checked, because the alert doesn't read that run's results. - Failures are matched by name, so a renamed job, step, or test, or a moved smoke test file, looks like one fixed failure and one new failure. - An incoming webhook can't edit an earlier message, so each change to the list is a new post. - The compare API returns at most 250 commits per page, oldest first. A longer range fetches its last two pages, so the alert lists the newest commits and the full count. - GitHub keeps only one pending run per concurrency group. If three runs of the same workflow finish at once, the middle alert is dropped, and the next one covers its commits. ## Review instructions 1. Run `pnpm -C e2e/docs test` and confirm all 55 tests pass. 2. Run the scan with the new reporter on a real guide and one that doesn't exist: ```bash cd e2e/docs && CI=1 DOCS_A11Y_FAILURES_FILE=/tmp/a11y.json PLAYWRIGHT_BASE_URL=https://supabase.com \ DOCS_E2E_PAGE_PATHS=/docs/guides/resources,/docs/guides/not-a-real-guide pnpm exec playwright test --grep @a11y cat /tmp/a11y.json ``` Expect one failure, `/docs/guides/not-a-real-guide: http-404`, with that guide also listed as unchecked, so its axe rules keep their earlier results. 3. Dry-run the alert against a real smoke test run, with a fake failure. `DRY_RUN` prints the Slack payload instead of posting it: ```bash mkdir -p /tmp/alert/results gh api repos/supabase/supabase/actions/runs/46574787371 \ | jq '{workflow_run: (. + {conclusion: "failure", path: ".github/workflows/docs-a11y-scan.yml", name: "Docs Accessibility Scan"})}' > /tmp/alert/event.json echo '{"failures":[{"key":"/docs/guides/database/custom-postgres-config: heading-order","page":"/docs/guides/database/custom-postgres-config"}],"unchecked":[]}' > /tmp/alert/results/a11y-failures.json GITHUB_TOKEN=$(gh auth token) GITHUB_REPOSITORY=supabase/supabase DRY_RUN=1 \ GITHUB_EVENT_PATH=/tmp/alert/event.json STATE_OUT=/tmp/alert/state.json RESULTS_DIR=/tmp/alert/results \ node e2e/docs/scripts/docs-alert.ts ``` Expect the failure to be `introduced by 450939c`, the only deployed commit in that range that touched the page. 4. Run step 3 again with `STATE_IN=/tmp/alert/state.json` and no other change. Expect no output, because the list didn't change. Verified locally: - Unit tests, typecheck, oxfmt, and actionlint on the changed workflows. The unit tests also pass in a copy of the repo with no installed packages, as CI runs them. - Mutation probes on the rules for unchecked pages, the push range, the unchecked baseline, Vitest files that fail to load, the saved-list check, deploy narrowing, skipped steps, smoke runs where every test timed out, the compare total, guides that return an error status, a guide whose error status changes, steps under a skipped job, and step baselines across skipped jobs. The sequence test alone catches all 14 unchecked-state bugs found in review when each is put back. - The reporter against production, including a guide that returns 404. - Dry runs against real runs: both workflows that test production, a failed push run, and a failed scheduled run. These covered a step whose range starts at the last run that ran it, a compare range of 400 commits, a new failure, a second failure added while the first stayed open, an unchanged list, every failure fixed, a crash before results, missing results, an older run, a saved list in the wrong shape, a passing run whose condition skipped a step with a saved failure, a push range that spans three pages of runs, and a first run with no saved list after a run that skipped a step. - The saved-list filter on real artifact data. Not run live: - The push and scheduled paths for the other workflows, because none had a recent failed run to test against. - The alert workflow itself. A `workflow_run` workflow only runs from `master`, so the first real alert comes after merge. Resolves [DOCS-1831](https://linear.app/supabase/issue/DOCS-1831/trace-docs-workflow-failures-to-the-commits-that-introduced-them) ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) |
||
|
|
c1330ca99f |
ci(docs): scan every docs guide for accessibility issues daily (#54339)
## 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) |
||
|
|
bd138001cc |
chore: Add slack alert workflows for docs team (#53366)
## Problem We have accumulated several additions to workflows in GitHub Actions, but we are not notified when they failed. ## Solution This PR adds two files to notify Docs-related and KB-related failures in our Slack team alerts channel. <!-- ## Preview links If relevant, include links to changed pages for easy review access. Copy the preview base URL from the Vercel bot comment on this PR. Use the following table as an example template. | Site | Live | Preview | Search for | | -------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | | WWW | [/blog/your-post](https://supabase.com/blog/your-post) | [/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post) | unique phrase from the change | | Docs | [/docs/guides/your-page](https://supabase.com/docs/guides/your-page) | [/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page) | unique phrase from the change | | Studio | [/dashboard](https://supabase.com/dashboard) | [/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard) | unique phrase from the change | | Design system | [/design-system](https://supabase.com/design-system) | [/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system) | unique phrase from the change | | UI library | [/library](https://supabase.com/library) | [/library](https://ui-library-git-branch-name-supabase.vercel.app/library) | unique phrase from the change | | Knowledge base | [/kb/guides/your-page](https://supabase.com/kb/guides/your-page) | [/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page) | unique phrase from the change | --> <!-- ## Additional context Optionally add any other context or screenshots. --> ## Review instructions ///// ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --------- Co-authored-by: Ali Waseem <waseema393@gmail.com> |