16 Commits
Author SHA1 Message Date
Alexis Aguilar b66682ee07 ci(docs): scan only the guides production serves in the daily accessibility scan (#54499)
## Problem

The daily Docs Accessibility Scan builds its page list from
`apps/docs/content/guides` on `master`, then loads each page from
production. When production runs behind `master`, every guide merged
since the last production deploy returns 404 and fails the scan, even
though the guide is fine.

On 2026-12-02, the scan failed on 8 guides this way. A deployment freeze
had moved docs production to a temporary `release` branch, so guides
merged to `master` that day weren't deployed. The same thing can happen
outside a freeze, when a guide merges minutes before the scan runs.

## Solution

The scan now tests only the guides production serves. It keeps the
guides from the repo list that also appear in the production sitemap,
`https://supabase.com/docs/sitemap.xml`.

- **Why the sitemap.** The docs build generates `sitemap.xml` from
`content/guides` on every production deploy, leaving out guides the nav
turns off. It isn't cached between builds, so it always lists what
production serves. It needs no new credentials. Today it lists every one
of the 609 guides the scan tests, plus the federated sections the scan
already skips.
- **How it's wired.** `run-e2e-docs.ts --all` filters the list when
`DOCS_E2E_DEPLOYED_ONLY` is set, using the `/docs/sitemap.xml` of the
site in `PLAYWRIGHT_BASE_URL`, so the page list and the scanned site
can't come from different sites. `docs-a11y-scan.yml` sets it. Runs
without the variable behave as before. The filter lives in
`e2e/docs/utils/production-pages.ts`, with unit tests.
- **Skipped guides are listed.** Each guide missing from the sitemap
prints "Skipping `<page>`: not in `<sitemap URL>`." in the run log, and
shows as a warning on the run page even when the scan passes. It's
scanned on the first run after its deploy.
- **Skipped guides keep their earlier results in the alert.** The runner
passes the skipped guides to the a11y failures reporter from #54444,
which lists each one as unchecked. A guide with an open failure that
drops out of the sitemap keeps that failure open, instead of posting as
fixed and then as new when it returns.
- **A real 404 still fails.** A live guide that starts returning 404 is
still in the sitemap, so it's still scanned and still fails.
- **A broken sitemap fails the run.** The run fails when the sitemap
can't be read, lists no guides, or is missing more than a tenth of the
repo's guides. A partial sitemap can't silently shrink the scan.
- **Wrapped tags.** The sitemap's formatter wraps long `<loc>` tags
across lines, as `<loc\n >url</loc\n>`. The parser handles that. A
line-based parse misses about 10 guides.

The workflow header comment and `e2e/docs/README.md` say where the page
list comes from.

### Behavior changes to review

1. **A guide whose nav entry is turned off is skipped, not failed.** The
docs build leaves it out of the sitemap, and production returns 404 for
it. That matches production. It also means turning off a live guide's
nav entry by mistake doesn't fail the scan. The guide shows as a warning
on the run page instead.
2. **Interaction with the failure alert from #54444.** The alert reports
a guide that returns 404 as an `http-404` failure. With this change,
only a guide production should serve can produce that failure. A skipped
guide keeps whatever failures it already had open, so a guide whose nav
entry is turned off stays in the list until it's back or deleted.

## Limitations

- A guide skipped for about two weeks or more loses its commit
attribution if it fails when it returns. The alert reads only the last
500 deployed commits, so it can't tell which commit production was
running when the guide was last checked, and says so.
- `getting-started/features` is in the sitemap even though a static
redirect sends it elsewhere. The scan already skips redirected guides,
so it doesn't affect the scan.

## Review instructions

1. Run `pnpm -C e2e/docs test` and confirm all 63 tests pass.
2. List the scan's tests against the live sitemap:
   ```bash
cd e2e/docs && CI=1 PLAYWRIGHT_BASE_URL=https://supabase.com
DOCS_E2E_DEPLOYED_ONLY=1 \
pnpm run e2e:docs:all --grep @a11y --list | grep -E
'Resolved|Skipping|Total'
   ```
Expect every guide resolved and nothing skipped while production matches
`master`.
3. Run step 2 with `PLAYWRIGHT_BASE_URL=https://example.com`, a site
with no docs sitemap. Expect the run to fail with the sitemap URL and
its status.
4. Add a temporary guide that isn't on production, such as
`apps/docs/content/guides/zz-temp-probe.mdx`, and run step 2 with
`DOCS_A11Y_FAILURES_FILE=/tmp/a11y.json`. Expect "Skipping
/docs/guides/zz-temp-probe", and both `/docs/guides/zz-temp-probe` and
`/docs/guides/zz-temp-probe: http` under `unchecked` in
`/tmp/a11y.json`. Delete the guide afterward.

Verified locally:

- Unit tests, typecheck, oxfmt, and actionlint on the changed workflow.
The unit tests also pass in a copy of the repo with no installed
packages, as CI runs them. The only actionlint warning is the existing
blacksmith runner label.
- Mutation probes on the wrapped-tag parsing, the trailing-slash trim,
the guides-only filter, the missing-share guard, and each of the three
ways a sitemap fails the run: an error status, no guides, and a site
that can't be reached. Unit tests cover all three with a local
`node:http` server.
- A copy of the production sitemap with the 8 guides from the 2026-12-02
run removed. The run skipped exactly those 8 and resolved the rest.
- A temporary guide that's in the sitemap but returns 404 on production.
The scan failed it with "Expected a successful response … got 404".
- Review step 4, after rebasing onto #54444. The skipped guide reached
the reporter as unchecked under its page and status keys. A mutation
probe that drops the skipped guides from the reporter fails the new
test.
- A sitemap with no guides, and one that can't be reached. Both failed
the run before Playwright started.

Resolves
[DOCS-1839](https://linear.app/supabase/issue/DOCS-1839/scan-only-the-pages-production-serves-in-the-daily-docs-accessibility)

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
2026-12-03 17:03:53 -07:00
Alexis Aguilar 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)
2026-12-03 02:38:39 +00:00
Alexis Aguilar 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)
2026-12-01 14:24:35 -07:00
Alexis AguilarandClaude Opus 5.5 a5638ed9e2 fix(docs): check every changed page for broken links in Docs E2E (#53899)
## Problem

The Docs E2E suite tests the guide pages a PR changes, but only the
first 20 in sorted order. It drops the rest without a warning, so the
check passes green with pages untested.

That let a broken link through in #53561. The PR changed 62 guides,
`delete-project` ranked 23rd, and the suite never loaded it. The link
was missing its leading slash and resolved to a nested URL that returns
404 (fixed in #53871).

A check that skips pages arbitrarily can't be relied on to catch the
mistake it exists to catch.

## Solution

The link check now runs on every changed page, with no cap. The
accessibility scan no longer runs on pull requests, because it's slow
and only checks the pages a diff names. A scheduled whole-site run fits
it better, and that's tracked in
[DOCS-1816](https://linear.app/supabase/issue/DOCS-1816/run-the-docs-e2e-accessibility-scan-on-a-schedule-across-the-whole).
The `@a11y` tests stay in the suite, and `pnpm e2e:docs:a11y` still runs
them.

- The resolver returns every in-scope page. The 20-page cap is gone.
- The workflow runs the suite with `--grep-invert @a11y`, so CI runs
skip the accessibility scans. That includes manual `workflow_dispatch`
runs, which ran them before. DOCS-1816 covers when CI runs them again.
- Past 20 pages the suite runs on 3 workers instead of 1, the same as
the Studio suite.
- The suite no longer stops after 3 failed tests, so a run reports every
page with a broken link. A broken link in a shared partial can fail many
pages, and stopping at 3 left the rest unchecked.
- The Docs E2E job now runs the harness unit tests (`pnpm -C e2e/docs
test`) when `e2e/docs` or `e2e/shared` changes. No workflow ran them
before, and harness-only changes skip Playwright.

## Run time

Most PRs change few pages, so the added time is small. I looked at 51
recent merged PRs that touched guides: 67% changed 1 page, 20% changed
2-5, 8% changed 7-11, and 6% (3 PRs) changed 62-82. On the Vercel
preview the link test takes about 6.5s per page.

Estimated run time on the preview, excluding setup and retries. Skipping
the accessibility scan (about 6.4s per page) offsets the extra link
checks:

| Pages changed | Before (capped at 20, link check and accessibility
scan, 1 worker) | This PR (every page, link check only, 3 workers past
20) |
| ------------- |
------------------------------------------------------------------ |
-------------------------------------------------------- |
| 1 | ~13s | ~7s |
| 5 | ~1.1 min | ~0.5 min |
| 11 | ~2.4 min | ~1.2 min |
| 82 | ~4.3 min (62 pages unchecked) | ~3 min |

On production, 40 link tests took 50s on one worker and 13s on four, so
workers scale close to linearly. I haven't run a large page list in the
CI workflow, and the Vercel preview might throttle 3 workers at once. If
it does, lower the worker count in `playwright.config.ts`. CI retries a
failing test up to 2 times, so a failing page can cost 3 runs. Since the
suite no longer stops after 3 failures, a change that breaks many pages
pays that cost for each of them. The job times out at 30 minutes, which
the link check alone would reach at roughly 800 pages on 3 workers.

## Review instructions

1. Run `pnpm -C e2e/docs test` and confirm the scope tests pass,
including the 82-page case.
2. Pipe 82 changed guide paths into the scope CLI and confirm `paths`
lists all 82:
   ```bash
printf 'apps/docs/content/guides/ai/%s.mdx\n' {1..82} | pnpm -C e2e/docs
resolve-docs-scope
   ```
3. List the tests the workflow runs for 3 pages and confirm there are 4
(1 guard, 3 link) and none for accessibility:
   ```bash
cd e2e/docs && PLAYWRIGHT_BASE_URL=https://supabase.com
DOCS_E2E_PAGE_PATHS=/docs/guides/auth,/docs/guides/database/overview,/docs/guides/storage
pnpm exec playwright test --grep-invert @a11y --list
   ```
4. Run the link test on 4 pages that don't exist and confirm all 4 fail,
rather than the run stopping after 3:
   ```bash
cd e2e/docs && PLAYWRIGHT_BASE_URL=https://supabase.com
DOCS_E2E_PAGE_PATHS=/docs/guides/zz-nope-1,/docs/guides/zz-nope-2,/docs/guides/zz-nope-3,/docs/guides/zz-nope-4
pnpm exec playwright test --grep "loads and"
   ```
5. Check that this PR's Docs E2E job runs the "Run docs E2E harness unit
tests" step and that it passes.

Verified locally: unit tests, the scope CLI with 82 paths, the test list
above through the same `pnpm run e2e:docs --grep-invert @a11y` command
the workflow uses, and the 4-failure run.

Resolves
[DOCS-1749](https://linear.app/supabase/issue/DOCS-1749/warn-instead-of-silently-skipping-pages-in-docs-e2e-when-a-pr-exceeds)

## Checklist
- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 17:28:12 -07:00
Anthony Lio 0daddc4551 feat(docs): agent feedback capabilities (#53115)
## Problem

- an agent that finds a wrong docs page leading to use a different
method gets no report
- mcp server and the cli can send feedback, but no page tells agents to
report docs problems

## Solution

- adds a note for ai agents at the top of each guide's markdown version,
so agents report wrong pages
- adds an agent-only instructions page with a disabled nav entry, so
agents learn how to write and send a report
- adds a "report documentation problems" section to the ai tools guide,
so users can approve, turn off or delete reports
- changes the mcp guide to say that `submit_feedback` takes
documentation feedback, so the tool list matches the new use
- adds the instructions page to `llms.txt`, so agents that start from
supabase.com find it

Linear: DEPR-698

<!--
## 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

1. open the preview
[/docs/guides/auth.md](https://docs-git-anthonylio-depr-698-explore-agent-feed-2bdb50-supabase.vercel.app/docs/guides/auth.md),
and make sure that the page starts with the "Note for AI agents"
blockquote
2. make sure that the note links to `agent-feedback.md`, tells the agent
to read it before the final reply, and asks "Send this report to
Supabase?"
3. open the preview
[/docs/guides/ai-tools/agent-feedback.md](https://docs-git-anthonylio-depr-698-explore-agent-feed-2bdb50-supabase.vercel.app/docs/guides/ai-tools/agent-feedback.md),
and make sure that the page has the five-line report template and no
agent note
4. open the preview
[/llms.txt](https://zone-www-dot-com-git-anthonylio-depr-698-explor-a825b7-supabase.vercel.app/llms.txt),
and make sure that it lists "Report documentation problems" with the
`.md` link

## 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)
2026-11-11 14:38:47 +02:00
Miranda Limonczenko 1d50816f47 docs: enforce duplicate ID a11y rules and fix duplicates (#52720)
Closes DOCS-1573

## Problem

Recently, @antlio surfaced that our side nav was visually breaking. This
is caused by a duplicate-id issue.

The docs E2E axe scan reports duplicate `id` attributes as a warning
only, so pages with duplicate IDs ship. A full scan of production guides
found duplicate IDs on 25 of 586 pages.

**Causes:**

- **Repeated headings:** a page uses the same heading text twice, for
example `#### Example` under two sections. Each heading slugs to the
same ID.
- **Pricing partials:** three usage pages put `## Pricing` directly
above a shared partial that starts with its own Pricing heading.
- **Components:** Mermaid diagrams hardcode SVG marker and node IDs. The
Apple secret generator renders `id="undefined-optional"` on each field
label. Each "Build it" listing on the Supabase way page renders
`#build-it`.

## Solution

- **Enforce the rules:** add `duplicate-id`, `duplicate-id-active`, and
`duplicate-id-aria` to `ENFORCED_RULES`.
- **Repeated headings:** give each later duplicate a
`[#parent-section-heading]` anchor. The first occurrence keeps its ID.
- **Pricing headings:** remove the page heading above the three partials
that start with `## Pricing`. The PITR partial starts with `###
Pricing`, so it gets `[#pitr-pricing]` and the page keeps its H2.
- **Mermaid:** prefix the SVG IDs of each diagram with `useId()`.
- **Apple secret generator:** give each field an ID. The label now also
points at its input.
- **Content listings:** add an optional `headingAnchor` to listing
groups, and set it on the repeated "Build it" groups.
- **pg_net:** the `http_delete` signature had `[#post-signature]`,
copied from `http_post`. It is now `[#delete-signature]`.

**Cross-references:** no link in the repo targets a changed ID. Each
first occurrence keeps its ID, so existing links resolve to the same
heading as before.

**Not changed:** the www suite and `packages/ui-patterns`. All fixes
stay in `apps/docs`.

**Verification:**

- Against production,
`/docs/guides/platform/manage-your-usage/log-drains` fails the @a11y
test with `duplicate-id`.
- Against a local docs server, the @a11y test passes on all 28 changed
or affected pages.

**Unverified:** a full-site run with `A11Y_ENFORCE_ALL=1`. Run it
against the preview before merge.

## Review instructions

1. From `e2e/docs`, run the a11y test against production. See it fail
with `duplicate-id`:

   ```bash
DOCS_E2E_PAGE_PATHS=/docs/guides/platform/manage-your-usage/log-drains
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm exec playwright test
--grep @a11y
   ```

2. Run the same command with `PLAYWRIGHT_BASE_URL` set to the docs
preview URL from the Vercel bot comment. See it pass.
3. On the preview, open
`/docs/guides/platform/manage-your-usage/log-drains`. In the table of
contents, select **Pricing** under **Log Drain Events**. See the page
scroll to the second Pricing section.
4. On the preview, open
`/docs/guides/integrations/partner-integration-guide`. See both sequence
diagrams render with arrowheads.

## 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)
2026-11-03 11:56:33 -08:00
Kody Jackson 051d5f79da chore(docs) - remove troubleshooting guides and rendering logic (#52339)
## Problem

Dupe content and workflows when this content now all lives in the KB.

## Solution

Removes various artifacts from the docs repo (content files, github
workflows, etc.) from the docs app.

These paths have already been redirected to /kb in #52095 and we haven't
seen any meaningful 404 traffic indicating the redirects were done
incorrectly.

## Preview links

TBD
2026-10-27 12:32:33 -05:00
Miranda Limonczenko 3879060a79 test(docs): check anchors in docs E2E link checks (#52174)
Closes DOCS-1254

## Problem

The docs E2E link check only confirms that a docs-owned link resolves to
a page. It strips the `#anchor` first, so a link to a renamed or removed
heading still passes.

For example, on production today:

- `guides/auth/redirect-urls` links to
`reference/javascript/auth-signinwithoauth#sign-in-using-a-third-party-provider-with-redirect`,
which is a tab value, not an element id.
- `guides/database/import-data` links to
`guides/platform/database-size#disk-management`, a heading that no
longer exists.

A full run found 58 broken anchor links on 53 guide pages. See the
[snapshot](https://app.notion.com/p/4015004b775f81538b15c28286177d31).
DOCS-1516 tracks the fixes.

## Solution

For each docs-owned link on a changed page:

- **Link to another page with an anchor:** the target page must have an
element with that `id`, or an `a[name]` with that value. The ids come
from the HTML that the existing status fetch already returns, so there
are no extra requests. Each target page is fetched once per run and
cached.
- **Same-page `#anchor`:** checked against the loaded page.
- **Failures:** each one is a soft assertion that names the page, the
link, and the missing anchor. A link that doesn't resolve reports only
its status, not a second anchor failure.

Pages with a lot of links still finish in time. For example, the
Personal access tokens guide links to over 200 API reference pages, and
checking every one for anchors made its test time out. The check now
downloads a linked page only when one of its links points to a section.

The link filtering moved into a pure `docsOwnedLinkTargets` function
with `node:test` coverage. `e2e/docs` gains a `test` script that runs it
along with the existing scope tests.

This complements #52100, which catches the opposite direction: unchanged
pages that link to a heading the PR removes.

## Manual testing

1. Run the unit tests:

   ```bash
   pnpm -C e2e/docs test
   ```

2. Run the suite against production for a page with a broken anchor and
a page without one:

   ```bash
   cd e2e/docs

DOCS_E2E_PAGE_PATHS=/docs/guides/auth/redirect-urls,/docs/guides/platform/ipv4-address
\
     PLAYWRIGHT_BASE_URL=https://supabase.com \
     pnpm exec playwright test --grep-invert @a11y
   ```
**Note:** A separate PR is cleaning up our anchor links. You can also
break a link locally and test.

3. Confirm `redirect-urls` fails, naming
`#sign-in-using-a-third-party-provider-with-redirect`, and
`ipv4-address` passes.
2026-10-23 12:17:30 -07:00
Katerina Skroumpelou 028e05205b docs: warn that default signOut scope revokes all sessions (#50119)
Warn that default signOut scope revokes all sessions. Motivation:
https://github.com/supabase/ssr/issues/68

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Clarified that signing out without a specified scope ends all sessions
by default.
* Added guidance for using a local sign-out scope to preserve sessions
on other devices and browsers.
* Documented the invalid refresh token errors that may occur when other
sessions are revoked.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-10 12:37:06 +00:00
Anthony Lio bdd4b8d369 fix(docs): guides sidebar a11y elements (#49942)
## What kind of change does this PR introduce?

bug fix (accessibility) + test coverage

## What is the current behavior?

the guides sidebar renders invalid list markup: group headers and
dividers sit directly under the root `ul`, and accordion links render as
`li` elements without an owning list

fixes
[DOCS-1279](https://linear.app/supabase/issue/DOCS-1279/guides-sidebar-put-li-elements-directly-in-the-ul)

## What is the new behavior?

- sidebar renders a semantic hierarchy: every `ul` has only `li`
children, every `li` has an immediate list parent, and the menu header
sits outside the item list. pure markup change,
- docs e2e scans the guide navigation separately from the article and
blocks the `list` and `listitem` axe rules there against sample pages
that include different usages (flat links, grouped links, nested
accordion)

## How to test?

run the docs dev server, then the scoped a11y suite:

```bash
pnpm dev:docs
pnpm e2e:docs:a11y
```

## Follow up
visuals and behavior are unchanged here but better parity between
guide/reference is handled in the stacked pr

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved documentation navigation rendering for nested guide items,
active states, and disabled entries.
* Ensured navigation groups and child links use valid, testable list
structures.

* **Tests**
* Added coverage verifying that guide navigation changes run the
appropriate documentation pages.
* Confirmed unrelated documentation changes can be skipped by the
end-to-end workflow.

* **Chores**
* Updated documentation test scope detection to include guide navigation
changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-10 15:03:55 +03:00
Anthony Lio 085d218bff fix(docs): button a11y enhancements (#49952)
## What kind of change does this PR introduce?

bug fix for accessibility, fixes
[docs-1265](https://linear.app/supabase/issue/DOCS-1365/add-aria-label-to-icon-only-buttons-button-name)

## What is the current behavior?

some controles in the docs app have no accessible name, so screen
readers announce them as an unlabelled "button"

## What is the new behavior?

- adds each control a name the way its neighbours already do
- adds menu toggle a state-dependent `aria-label` and `aria-expanded`
- adds `button-name` to `enforced_rules`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Accessibility**
- Added descriptive labels to configuration selectors and mobile menu
controls.
- Mobile menu controls now announce whether the menu is open or closed.
- Expanded accessibility validation to check button names across
documentation pages.

- **UI Improvements**
- Updated the raw throughput table control with a clearer button
appearance and expandable chevron indicator.
  - Replaced a schema-migration tooltip with a direct in-page link.

- **Documentation**
- Removed the Info Tooltip component guidance from the contributing
documentation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-04 10:32:57 +03:00
Miranda LimonczenkoandClaude Opus 5 6d3a4bcc48 feat(www) Add scaffolding for WWW E2E tests and CI check (#48861)
Closes DOCS-1278

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature. Adds E2E test scaffolding and a CI check for the marketing
site.

## What is the current behavior?

Closes [FE-4047](https://linear.app/supabase/issue/FE-4047).

The marketing site has no E2E coverage. Docs has a suite in `e2e/docs`,
but its
runner, git helpers and axe reporting are private to that package, so a
second
site cannot reuse them.

## What is the new behavior?

* **A www suite scoped to changed content.** Changed `.mdx` files in
`_blog`,
`_events`, `_customers` and `_alternatives` map to the URLs they render.
Pages
with `disable_page_build: true` are skipped because they 404 by design.
Capped
at 20 pages. Enforces `heading-order` and `page-has-heading-one`,
matching docs.
* **`e2e/shared` The docs site is also static with similar needs. This
folder shares the docs logic with www.
* **A CI check that is safe to mark required.** Path scoping lives in a
`Detect changed paths` step rather than a `paths:` trigger, so the check
  reports on every pull request instead of being skipped.
`waitForVercelDocsPreview.js` becomes `waitForVercelPreview.js`, shared
by both
  workflows.

## How the check behaves

The job always reports a check run, so it is safe to mark required. Path
scoping
happens in a step rather than a `paths:` trigger, which would leave
non-www pull
requests waiting on a check that never reports.

| Case | Behavior |
| --- | --- |
| Fork pull request adds new pages | Passes without testing. The Vercel
wait is gated on `head.repo.full_name == github.repository`, so forks
resolve no preview URL. The job emits a `::warning` and a job summary
containing a ready-to-run `gh workflow run www-e2e.yml` command with the
resolved page paths, so a maintainer can run it against the preview. |
| Vercel preview times out or fails | Passes without testing. The wait
step is `continue-on-error: true`, so a 900s timeout or a failed
deployment leaves the URL unset and the suite skips. Vercel's own
`Vercel – zone-www-dot-com` check already reports the failure. |
| Draft pull request | Job does not run at all, gated at the job level
on `pull_request.draft == false`. `ready_for_review` is in the trigger's
`types`, so marking it ready runs the check. |
| Another app changed, www untouched | Job runs and every step skips.
The `www` filter matches only the four content directories, `e2e/www`,
`e2e/shared`, the lockfile, and this workflow. |
| Only the harness changed | Passes without testing. Scope resolves to
zero pages, and the Vercel wait is additionally gated on `www_app`, so
it does not wait for a preview Vercel skipped. |
| No preview resolves, any reason | Skips rather than falling back to
production. Production does not serve pages the pull request adds, so
testing it would fail a valid change. |

### Not covered

Changes to `apps/www` components and routes do not trigger this check —
only the
four content directories do. A follow-up can check global components
such as the navigation and the footer.

## Manual testing

1. Start the site: `pnpm dev:www`
2. Run `pnpm e2e:www` with no www content changed. It should resolve
zero pages
   and skip Playwright, not fail.
3. Touch a post, then run `pnpm e2e:www` again:
`echo "" >> apps/www/_blog/2024-01-01-some-post.mdx`. The resolved
`/blog/...`
   path should be listed before Playwright starts.
4. Run against production with no local server:
`PLAYWRIGHT_BASE_URL=https://supabase.com
WWW_E2E_PAGE_PATHS=/blog/postgres-language-server pnpm e2e:www`
5. Point step 4 at a page with a known heading problem. The failure
should name
   the rule, the CSS selector and the markup.
6. Confirm docs still passes on the shared runner: `pnpm dev:docs`, then
   `pnpm e2e:docs`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added WWW end-to-end testing for affected content pages, including
accessibility checks.
* Added standard and full-site test commands, configurable preview
testing, and failure reports.
* Added shared utilities for page discovery, accessibility scanning, and
test execution.

* **Documentation**
* Documented WWW test setup, coverage, debugging, CI behavior, and
running checks against production or preview environments.

* **Improvements**
* Updated documentation test workflows to better identify affected
changes and handle preview environments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 22:06:51 +00:00
Miranda LimonczenkoandClaude Opus 5 777c02c205 test(docs): scan changed pages for WCAG 2.1 A/AA in warn mode (#48727)
Closes DOCS-1233

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Test coverage. The docs accessibility check now covers the full WCAG 2.1
A/AA rule set instead of two rules.

**Note:** This PR tests _only_ the main article of changed pages
(meaning, the content itself). A follow-up Linear issue is to address
scanning the pieces outside of that: header, navigation, and interactive
elements.

## What is the current behavior?

The `@a11y` test in `e2e/docs` runs two axe rules against each in-scope
page, `heading-order` and `page-has-heading-one`. Both already pass
everywhere, so the check only guards a result we have. Nothing else in
WCAG A/AA is checked.

## What is the new behavior?

The same test runs the full WCAG 2.1 A/AA rule set.

- **Existing debt does not block PRs.** Only the two heading rules fail.
Everything else reports.
- **The check stays fast.** It scans the article only and skips nine
rules that cannot fire there. Scan time drops from 2405ms to 981ms.
- **Findings belong to us.** Legacy mode excludes cross-origin frames.
YouTube embeds were counting against us, 11 of 15 violations on one
page.
- **A pass carries meaning.** A 404 reports as a load failure, not an
a11y bug. A page scanned before it hydrates warns instead of quietly
reporting clean.

## How the findings appear

The test is named `has no blocking accessibility violations`, so a
failure listed by CI is always something to fix. It is not named for the
full rule set, because a green check would then claim more than the
check verifies.

| | Rules | Where you see it |
| --- | --- | --- |
| Blocking | `heading-order`, `page-has-heading-one` | Test failure, so
the runner reports it on the PR |
| Reported | Everything else in WCAG A/AA | `::warning` annotation on
the run |

An annotation looks like this, on a run that still passes:

```
::warning title=Accessibility::/docs/guides/database/functions has 1 non-blocking accessibility finding(s): frame-title (4)
```

The full axe result for each page is attached to the report as
`axe-results.json`.

## Matching the Studio ratchet

This follows the ESLint ratchet in `apps/studio`. That pattern warns on
pre-existing debt rather than blocking on it, surfaces findings as
annotations rather than PR comments, and promotes a rule to an error
once its violations reach zero.

The mechanism here is `ENFORCED_RULES` in `utils/axe-helpers.ts`. The
two heading rules are on it because the heading-hierarchy work drove
them to zero site-wide.

The intent is to migrate rules into that list one at a time. Pick a
rule, fix its violations, then move it into `ENFORCED_RULES` so it
cannot come back. An exhaustive scan of the site groups the current
backlog by root cause to sequence that work, and two fixes cover 99.1%
of it.

Studio keeps per-file baseline counts, which this does not. A whole-rule
list is coarser, and it works here because docs violations reach zero
across the site rather than per file.

## Manual testing

Install the browser once, then run each step from the repo root. Every
command scans production, so you do not need a local docs server.

```bash
pnpm -C e2e/docs exec playwright install chromium
```

1. Confirm a reported finding does not fail the check.

   ```bash
DOCS_E2E_PAGE_PATHS=/docs/guides/database/functions
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:a11y
   ```

Expect `1 passed`, and the `::warning` annotation above in the output.

2. Confirm the scan finds that violation. Same page, now failing on
every rule.

   ```bash
A11Y_ENFORCE_ALL=1 DOCS_E2E_PAGE_PATHS=/docs/guides/database/functions
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:a11y
   ```

Expect `1 failed`, reporting `frame-title (serious, 4 node(s))`. Steps 1
and 2 together are the point of this PR.

3. Confirm the skipped rules stay skipped.

   ```bash
A11Y_ENFORCE_ALL=1
DOCS_E2E_PAGE_PATHS=/docs/guides/getting-started/quickstarts/nextjs
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:a11y
   ```

Expect `button-name (critical, 2 node(s))` and `label (critical, 2
node(s))`, and no `color-contrast`.

4. Confirm a page that does not load reports a load failure.

   ```bash
DOCS_E2E_PAGE_PATHS=/docs/guides/does-not-exist-xyz
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:a11y
   ```

Expect `Expected a successful response for
/docs/guides/does-not-exist-xyz, got 404`, and no axe assertion.

5. Confirm the link checker still passes alongside the a11y test.

   ```bash
DOCS_E2E_PAGE_PATHS=/docs/guides/auth/passwords
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs
   ```

   Expect `3 passed`.

## Known gaps

- `/docs/reference/*` is not scanned. Those routes render client-side
into tens of thousands of elements, where axe exceeds its timeout and
results depend on whether the scan caught the page mid-render.
- Shared chrome is outside the article scope, so nav, sidebar, footer,
menus, and drawers are not covered.
- axe catches roughly 30-40% of WCAG issues. Keyboard navigation, focus
management, and screen reader behavior still need manual testing.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 10:41:23 -07:00
Miranda LimonczenkoandClaude Opus 5 d45e0cd3d5 fix(docs ci): stop Docs E2E blocking pull requests it shouldn't (#48726)
Supersedes #48725, which GitHub closed when its head branch was renamed.
Same commits, same diff.

Fixes
[DOCS-1270](https://linear.app/supabase/issue/DOCS-1270/fail-the-e2e-pipeline-if-the-docs-preview-never-loads).

`Docs E2E` is a required check on `master`, so anything that turns it
red blocks a merge. It had three ways of going red that had nothing to
do with whether the author's docs were correct.

## Problem

**1. Every troubleshooting page could fail, with nothing actionable.**
Troubleshooting entries were selected by `article.prose`. That class is
not unique — `apps/docs/app/not-found.tsx` renders `<article
className="prose …">` too — and nothing guaranteed it matched the
entry's article at all. When it missed, the link test failed with `Page
article should be present` and the a11y test failed inside axe with `No
elements found for include in page Context` plus a stack trace. Neither
tells the author what to do.

This is what DOCS-1270 actually was. The ticket describes tests running
"against a preview build that was never created", but the [failing
run](https://github.com/supabase/supabase/actions/runs/30949924515/job/92132543658)
for #48719 shows the preview resolved fine and `response.ok()` passed —
it broke at the article assertion. **Blocked:** anyone adding or editing
a troubleshooting entry.

**2. Fork pull requests failed for being forks.** Fork runs get no
`VERCEL_TOKEN`, so no preview URL resolves, and the base-URL step fell
back to `https://supabase.com`. The page paths under test can include
pages the pull request *adds*, which do not exist on production, so they
404. **Blocked:** every external contributor adding a docs page,
unconditionally, with no action available to them.

**3. A Vercel problem failed the docs check.**
`waitForVercelDocsPreview.js` throws when Vercel reports a failed
deployment, omits a `target_url`, or does not post a status within 900s.
The step had no `continue-on-error`, so any of those turned `Docs E2E`
red. **Blocked:** any author whose pull request coincided with a Vercel
incident. This is live right now — two Vercel checks on this very pull
request are failing with "unable to fetch required git information", a
git-integration auth error that happens before any build runs.

## Solution

**1. Select on a stable, purpose-named attribute.** Add
`id="sb-docs-troubleshooting-main-article"` on the troubleshooting
article, mirroring `#sb-docs-guide-main-article` on guides, and select
on that instead of the class. Per review feedback, a plain id doesn't
say it's a test hook, so both articles also get `data-testid` with the
same value — matching the convention `apps/studio` already uses with
Playwright's `getByTestId` — and the e2e selectors target that attribute
instead. Guides keep their `id` — `GuidesMdx.client.tsx` and
`GuidesSidebar.tsx` both query it directly for the table of contents and
the "copy article" fallback — and gain `data-testid` alongside it.

**2 and 3. Resolve a preview or skip — never substitute production,
never fail on Vercel.** The production fallback is gone.
`continue-on-error: true` on the preview wait means a Vercel failure
resolves no URL instead of failing the job, which lands in the same path
as a fork: `should_test=false`, so Playwright is skipped and the check
passes. Both cases emit a `::warning::` and a job summary with the exact
`gh workflow run` command to test the preview by hand, and manual runs
against a non-production base URL now send the protection bypass so that
command actually works.

Skipping does not let a broken preview through: `Vercel – docs` is
itself a required check on `master`, so a genuine preview failure still
blocks the merge — via the check that describes the real problem.


## Manual test

**1. The selector matches the markup, and it needs this pull request's
preview.** `data-testid` isn't deployed anywhere yet — not on
production, not on any other branch — so this is the one claim in this
PR that production cannot confirm. Verified directly against this
branch's own Vercel preview:

```bash
curl -s https://docs-git-docs-e2e-stop-false-blocks-supabase.vercel.app/docs/guides/database/overview \
  | grep -o 'data-testid="[^"]*"'
curl -s https://docs-git-docs-e2e-stop-false-blocks-supabase.vercel.app/docs/guides/troubleshooting/42501--permission-denied-for-table-httprequestqueue-KnozmQ \
  | grep -o 'data-testid="[^"]*"'
```

Expect `data-testid="sb-docs-guide-main-article"` and
`data-testid="sb-docs-troubleshooting-main-article"` respectively. Then
run the suite against that same preview — expect all page/link/a11y
checks to pass:

```bash
PLAYWRIGHT_BASE_URL=https://docs-git-docs-e2e-stop-false-blocks-supabase.vercel.app \
DOCS_E2E_PAGE_PATHS=/docs/guides/database/overview,/docs/guides/troubleshooting/42501--permission-denied-for-table-httprequestqueue-KnozmQ \
pnpm -C e2e/docs exec playwright test --reporter=list
```

Running the same command with `PLAYWRIGHT_BASE_URL=https://supabase.com`
fails both pages right now — expected until this merges, not a
regression. Once merged, exercise it through the real pipeline:

```bash
gh workflow run docs-e2e.yml --ref docs-e2e/stop-false-blocks \
  -f base_url=<preview-url> \
  -f page_paths=/docs/guides/troubleshooting/42501--permission-denied-for-table-httprequestqueue-KnozmQ
```

**2. No preview means skip, not a run against production.** Exercise the
base-URL step's three paths from the repository root:

```bash
export GITHUB_OUTPUT=$(mktemp) GITHUB_STEP_SUMMARY=$(mktemp) PAGE_PATHS=/docs/guides/a
script=$(python3 -c "import yaml;print([s for s in yaml.safe_load(open('.github/workflows/docs-e2e.yml'))['jobs']['e2e']['steps'] if s.get('name')=='Resolve base URL'][0]['run'])")
for c in "workflow_dispatch|https://supabase.com|" "pull_request||https://docs-abc.vercel.app" "pull_request||"; do
  IFS='|' read -r ev url dep <<< "$c"
  : > "$GITHUB_OUTPUT"
  EVENT_NAME="$ev" BASE_URL_INPUT="${url:-https://supabase.com}" DEPLOYMENT_URL="$dep" bash -c "$script" >/dev/null 2>&1
  echo "$ev deployment=[${dep:-none}] -> $(tr '\n' ' ' < "$GITHUB_OUTPUT")"
done
tail -4 "$GITHUB_STEP_SUMMARY"
```

Expected:

```
workflow_dispatch deployment=[none] -> url=https://supabase.com use_bypass=false should_test=true
pull_request deployment=[https://docs-abc.vercel.app] -> url=https://docs-abc.vercel.app use_bypass=true should_test=true
pull_request deployment=[none] -> url= use_bypass=false should_test=false
```

followed by a runnable `gh workflow run docs-e2e.yml` command in the job
summary. The third line covers both the fork case and the Vercel-failure
case: no base URL, no test, no block.

**3. A Vercel failure no longer fails the job.** `continue-on-error:
true` on the wait step is what routes a throw into that third line:

```bash
python3 -c "
import yaml
s=[x for x in yaml.safe_load(open('.github/workflows/docs-e2e.yml'))['jobs']['e2e']['steps'] if x.get('name')=='Wait for Vercel docs preview'][0]
print('continue-on-error:', s.get('continue-on-error'))
for n in ('Install dependencies','Install Playwright Chromium','Run docs E2E'):
    print(n, '->', [x for x in yaml.safe_load(open('.github/workflows/docs-e2e.yml'))['jobs']['e2e']['steps'] if x.get('name')==n][0]['if'])
"
```

Expect `continue-on-error: True` and all three run steps gated on
`steps.base-url.outputs.should_test == 'true'`.

**Note on this pull request's own check.** The scope resolver only maps
`apps/docs/content/**` to pages, and this pull request changes none, so
`Docs E2E` resolves zero pages and skips — which is correct, and why the
dispatch above is the real test.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved documentation preview checks so unavailable or delayed
previews no longer cause unnecessary workflow failures.
* Added clearer handling for manual documentation checks and missing
preview deployments.

* **Tests**
* Improved end-to-end documentation testing reliability across preview
and production environments.
* Added stable targeting for the troubleshooting article to reduce test
failures caused by page structure changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 15:23:26 +00:00
Miranda LimonczenkoandClaude Sonnet 5 52cb1c2600 feat(docs) Dynamically E2E test all docs-owned content (#48320)
Closes DOCS-1203

## Problem

The docs E2E workflow only ever tested one hardcoded page: the Next.js
quickstart. All other docs content had no E2E coverage.

## Solution

This PR expands the initial scaffolding to generalize the Next.js
quickstart tests, page runs and checks local links, to all pages
affecting Docs content:


- Add `resolveDocsScope` (`e2e/docs/utils/resolve-docs-scope.ts`) to map
changed guide and troubleshooting `.mdx` files to their `/docs/...` page
paths, and to expand changed `_partials` to every page that includes
them (including transitively, through partials nested inside other
partials). Federated guide sections (`graphql`,
`database/extensions/wrappers`, `ai/python`, `deployment/terraform`,
`deployment/ci`) and reference docs stay out of scope, and resolution is
capped at 20 pages to keep runtime bounded.
- Replace the single `quickstarts.spec.ts` test with a generic
`docs-pages.spec.ts` that loads whatever pages are resolved, asserting
each renders with an `<h1>` and that its docs-owned links resolve.
- Add `run-e2e-docs.ts` so `pnpm e2e:docs` resolves scope locally (from
commits since `origin/master`, plus staged/unstaged changes) and skips
Playwright entirely when nothing in scope changed.
- Update `.github/workflows/docs-e2e.yml` to widen the trigger paths to
all guides/troubleshooting/partials, resolve scope in a dedicated step,
skip the rest of the job when scope is empty, and accept a `page_paths`
input for manual `workflow_dispatch` runs.
- Rewrite `e2e/docs/README.md` to document the new scoping behavior, the
override envs (`DOCS_E2E_PAGE_PATHS`, `DOCS_E2E_BASE_REF`), and how CI
uses the suite.
- `pnpm e2e:docs:all` is also added to run tests on every page locally.
Good for scoping issues but should not be included in CI.

## Manual testing

Walk through the following steps to verify this works:

- [x] `pnpm e2e:docs` from repo root resolves the expected pages for a
local guide edit and can run against local dev
**Note:** Challenges with testing on local in part because of the long
lag for first page load. Recommendation to use a hosted URL is added to
docs.
- [x] Editing a shared `_partials` file resolves to every page that
includes it (including through nested partials)
- [x] `pnpm e2e:docs` exits cleanly with no Playwright run when no
in-scope files changed
- [x] `git diff --name-only ... | pnpm -C e2e/docs resolve-docs-scope`
prints the expected page list for a sample diff
- [x] Workflow run on a PR that only touches `e2e/docs`/workflow files
skips the Playwright steps
- [x] Manual `workflow_dispatch` run with `page_paths` set tests only
those pages
- [x] Run `pnpm e2e:docs:all` to run the suite on all docs content,
which takes awhile

## Next steps

After this PR merges, we have the scaffolding to add more fun tests like
a11y 😁

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added scoped Docs E2E runs that target eligible doc pages based on
changes, plus manual page-targeted runs and an “all eligible pages”
mode.
* Introduced `DOCS_E2E_PAGE_PATHS` (and updated base ref/base URL
behavior) to control which pages are tested.
* **Bug Fixes**
* Automatically skips Playwright setup when no relevant pages are in
scope; Playwright reporting now uploads only on failure.
* **Documentation**
* Updated the Docs E2E README with new run/CI behavior, troubleshooting
notes, and commands to inspect the resolved page list.
* **Tests**
* Added a Docs-owned pages E2E suite; removed the Next.js quickstart E2E
spec.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-28 00:04:58 +00:00
Miranda LimonczenkoandCopilot Autofix powered by AI 9199aad57e feat(docs) Add scaffolding and CI/CD step for Docs Playwright (#48120)
Closes DOCS-1197



## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## Problem

We do not have any E2E testing established. 

## Solution

This PR creates an ultra-lean starting place for Docs Playwright:

- A CI/CD step that skips on draft and relies on Preview for testing
- One simple broken link check for one page

The goal: 
- Playwright is implemented where we want it, with an architecture we
want, with set-up steps we can build from

The anti-goal of this PR:
- We have meaningful tests running

## CI/CD steps

<img width="1191" height="72" alt="Screenshot 2026-07-21 at 10 17 06 AM"
src="https://github.com/user-attachments/assets/eeb2454c-d864-4574-a050-ce39bb3f083f"
/>

1. Checkout a thin slice of the repo (`apps/docs`, `packages`,
`patches`).
2. Wait for the Vercel **docs** preview for that commit SHA.
3. Use that preview URL as `PLAYWRIGHT_BASE_URL`.
4. Install Node deps and Chromium.
5. Run `pnpm run e2e:docs` (`--grep @quickstart`).
6. If anything fails, upload the HTML report + traces.

Manual runs skip the Vercel wait and default to `https://supabase.com`
(or whatever URL you enter), then run the full suite (`pnpm run e2e`).

## What the test checks

Because this PR is scaffolding, it is doing something very basic:

1. Opens `/docs/guides/getting-started/quickstarts/nextjs` only if a
connected file was edited in CI/CD step
2. Asserts the page loaded and the H1 is visible.
3. Collects docs-owned `/docs/**` links from
`#sb-docs-guide-main-article`.
4. HTTP-checks each link (no full navigation) and soft-fails so every
broken link is reported.

Config keeps it cheap: Chromium only, 1 worker, 2 CI retries, failure
screenshots/traces.


## Docs vs Studio/Dashboard

The setup of Docs Playwright differs from Studio.

| | Docs E2E | Studio E2E |
|---|---|---|
| Location |`e2e/docs/` | `e2e/studio/` |
| What it tests | One published docs page + its links | Many Studio UI
flows (tables, auth, storage, …) |
| Where the app runs | Already-deployed **Vercel preview** | Built and
started **on the runner** |
| Backend needed | None | Local Supabase via Docker |
| Path filtering | Native `on.pull_request.paths` (skip whole workflow)
| `dorny/paths-filter` after checkout (workflow starts, heavy steps
gated) |
| Parallelism | 1 worker, no shards | Matrix of frameworks × 2 shards |
| Retries | 2 in CI | 5 in CI |
| Reports | HTML report on failure | Blob reports per shard → merge → PR
comment |
| Draft handling | Explicit draft skip | No draft skip today |
| Manual broader run | Yes (`workflow_dispatch`) | No |

The big conceptual difference: **Studio owns the environment** (build
Studio, start Supabase, hit `localhost`). **Docs borrows Vercel’s
preview** and only asks “does this page and its docs links work on the
deployed site?”

## Docs architecture justification

The docs architecture is deliberately lightweight because docs are
**static, published content served by Vercel**, not an interactive app
with a backend. That single fact justifies every difference:

- **Borrow the Vercel preview instead of building on the runner.** The
preview is already the exact artifact users will see, and Vercel builds
it for free on every PR. Rebuilding docs on the runner would duplicate
that work and risk testing something different from what ships. Studio,
by contrast, needs a running app plus a local Supabase, so it *has* to
own its environment.

- **No backend.** Docs pages don't need a database or auth to render, so
there's nothing to spin up. This is what keeps the job cheap enough to
run per-PR.

- **Native `paths` filtering.** Since the job is cheap and
self-contained, an all-or-nothing skip at the workflow level is
sufficient—no need for `dorny/paths-filter` to gate expensive setup
steps mid-run like Studio does.

- **Low parallelism and modest retries.** One page and its links is a
tiny surface, so 1 worker is plenty and there's no sharding to
coordinate. Retries exist only to absorb transient network flakiness
against a live URL, hence 2 rather than Studio's 5 (which also cushions
a heavier, stateful environment).

- **Non-blocking + draft skip + manual dispatch.** As initial
scaffolding checking link health on a deployed site, it should inform
rather than gate merges, avoid burning minutes on drafts, and still be
runnable on demand against production.

In short: **Studio owns its environment because it must; docs borrows
Vercel's preview because it can.** The scope is intentionally minimal
today.

## Testing

1. Break a docs-owned link in the Next.js quickstart.
1. Follow README instructions to set up and run e2e docs test.
1. Confirm the suite fails.
1. Restore the broken link and re-run.
1. Confirm the suite **passes** (`1 passed`).



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary

- **New Features**
- Added a GitHub Actions workflow to run Playwright docs end-to-end
tests on PRs and via manual dispatch (with optional base URL), including
docs-preview waiting and concurrency cancellation.
- **Documentation**
- Added `e2e/docs` README with setup, how to run the suite (including
UI/debug and single-spec), and how base URL selection works.
- **Tests**
- Added a quickstarts E2E spec that validates the page and soft-checks
docs-owned links resolve.
- **Chores**
- Added shared Playwright configuration/package scripts and an
`e2e/docs` `.gitignore` for test outputs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-21 14:59:10 -07:00