Files
supabase/e2e/docs/utils/open-failures.test.ts
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

471 lines
16 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict'
import test from 'node:test'
import {
EVERY_TEST_TIMED_OUT,
attribute,
baselineFor,
compareFailures,
deployedCommitsBetween,
failuresFromJobs,
failuresFromVitest,
formatAlert,
formatCrashAlert,
nextLastChecked,
parseFailureState,
parseRunFailures,
pickDeployedHead,
pushCandidates,
type FailureState,
type HistoryCommit,
type OpenFailure,
type RunRef,
} from './open-failures.ts'
const commit = (sha: string) => ({ sha, title: `commit ${sha}` })
const open = (key: string, page?: string): OpenFailure => ({
key,
page,
firstSeen: '2026-12-01T05:17:00Z',
attribution: { kind: 'introduced', commit: commit('aaaaaaa') },
})
test('adds a second failure to a workflow that is already failing, and keeps the first', () => {
const first = open('/docs/guides/a: heading-order', '/docs/guides/a')
const result = compareFailures([first], {
failures: [
{ key: '/docs/guides/a: heading-order', page: '/docs/guides/a' },
{ key: '/docs/guides/b: duplicate-id', page: '/docs/guides/b' },
],
unchecked: [],
})
assert.deepEqual(
result.added.map((failure) => failure.key),
['/docs/guides/b: duplicate-id']
)
assert.deepEqual(result.stillOpen, [first])
assert.deepEqual(result.fixed, [])
})
test('drops a failure that no longer fails', () => {
const first = open('docs › Sync')
const result = compareFailures([first], { failures: [], unchecked: [] })
assert.deepEqual(result.fixed, [first])
assert.deepEqual(result.stillOpen, [])
})
test('keeps a failure open when its page timed out instead of passing', () => {
const first = open('/docs/guides/a: heading-order', '/docs/guides/a')
const result = compareFailures([first], { failures: [], unchecked: ['/docs/guides/a'] })
assert.deepEqual(result.stillOpen, [first])
assert.deepEqual(result.fixed, [])
assert.deepEqual(result.added, [])
})
test('names the one commit when the range has one', () => {
assert.deepEqual(attribute([commit('1111111')], null), {
kind: 'introduced',
commit: commit('1111111'),
})
})
test('lists every commit as unconfirmed when the range has several and nothing narrows it', () => {
const result = attribute([commit('1'), commit('2')], null)
assert.equal(result.kind, 'unconfirmed')
assert.equal(result.kind === 'unconfirmed' && result.total, 2)
})
test('counts the whole range when only its newest commits were fetched', () => {
const result = attribute([commit('3'), commit('4')], null, 300)
assert.equal(result.kind === 'unconfirmed' && result.total, 300)
})
test('names the one commit that touched the failing page', () => {
const range = [commit('1'), commit('2'), commit('3')]
assert.deepEqual(attribute(range, [commit('2')]), { kind: 'introduced', commit: commit('2') })
})
test('falls back to the whole range when no commit touched the failing page', () => {
const range = [commit('1'), commit('2')]
const result = attribute(range, [])
assert.equal(result.kind, 'unconfirmed')
assert.deepEqual(result.kind === 'unconfirmed' && result.commits, range)
assert.equal(result.kind === 'unconfirmed' && result.reason, 'no commit touched this page')
})
test('says there is no commit when the range is empty', () => {
assert.equal(attribute([], null).kind, 'none')
})
const built = (sha: string, createdAt: string): HistoryCommit => ({
...commit(sha),
status: { state: 'SUCCESS', description: 'Deployment has completed', createdAt },
})
const skipped = (sha: string, createdAt: string): HistoryCommit => ({
...commit(sha),
status: { state: 'SUCCESS', description: 'Skipped - Not affected', createdAt },
})
const pending = (sha: string): HistoryCommit => ({
...commit(sha),
status: { state: 'PENDING', description: 'Vercel is deploying your app', createdAt: 'z' },
})
test('picks the newest build that finished before the run', () => {
const history = [
built('c', '2026-12-02T06:00:00Z'),
built('b', '2026-12-02T04:00:00Z'),
built('a', '2026-12-01T00:00:00Z'),
]
assert.equal(pickDeployedHead(history, '2026-12-02T05:17:00Z'), 'b')
})
test('counts skipped builds after a finished build as deployed', () => {
const history = [skipped('c', '2026-12-02T03:00:00Z'), built('b', '2026-12-02T02:00:00Z')]
assert.equal(pickDeployedHead(history, '2026-12-02T05:17:00Z'), 'c')
})
test('stops at a build that had not finished, even if a later build was skipped', () => {
const history = [
skipped('c', '2026-12-02T03:00:00Z'),
pending('b'),
built('a', '2026-12-02T01:00:00Z'),
]
assert.equal(pickDeployedHead(history, '2026-12-02T05:17:00Z'), 'a')
})
test('lists the built commits that reached production between two runs', () => {
const history = [
built('e', '2026-12-02T06:00:00Z'),
built('d', '2026-12-02T04:00:00Z'),
skipped('c', '2026-12-02T03:00:00Z'),
built('b', '2026-12-02T02:00:00Z'),
built('a', '2026-12-01T04:00:00Z'),
]
const range = deployedCommitsBetween(history, '2026-12-01T05:17:00Z', '2026-12-02T05:17:00Z')
assert.deepEqual(
range?.map((item) => item.sha),
['b', 'd']
)
})
test('returns null when the earlier deploy is outside the history', () => {
const history = [built('b', '2026-12-02T02:00:00Z')]
assert.equal(
deployedCommitsBetween(history, '2026-12-01T05:17:00Z', '2026-12-02T05:17:00Z'),
null
)
})
test('reads failed jobs and steps from the Actions API', () => {
const result = failuresFromJobs([
{ name: 'build', conclusion: 'success', steps: [] },
{
name: 'sync',
conclusion: 'failure',
steps: [
{ name: 'Checkout', conclusion: 'success' },
{ name: 'Sync docs', conclusion: 'failure' },
],
},
{ name: 'setup', conclusion: 'failure', steps: [] },
])
assert.deepEqual(
result.failures.map((failure) => failure.key),
['sync › Sync docs', 'setup']
)
})
test('lists steps and jobs that never ran as unchecked', () => {
const result = failuresFromJobs([
{
name: 'update',
conclusion: 'failure',
steps: [
{ name: 'Install deps', conclusion: 'failure' },
{ name: 'Refresh Management API docs', conclusion: 'skipped' },
],
},
{ name: 'publish', conclusion: 'skipped', steps: [] },
])
assert.deepEqual(
result.failures.map((failure) => failure.key),
['update › Install deps']
)
assert.deepEqual(result.unchecked, ['update › Refresh Management API docs', 'publish'])
})
test('retires an old error status when the page returns a new one, and keeps its axe failures', () => {
const page = '/docs/guides/a'
const notFound = open(`${page}: http-404`, page)
const headingOrder = open(`${page}: heading-order`, page)
const result = compareFailures([notFound, headingOrder], {
failures: [{ key: `${page}: http-503`, page }],
unchecked: [page],
})
assert.deepEqual(result.fixed, [notFound])
assert.deepEqual(result.stillOpen, [headingOrder])
})
test('keeps an error status open when the page timed out', () => {
const page = '/docs/guides/a'
const notFound = open(`${page}: http-404`, page)
const result = compareFailures([notFound], {
failures: [],
unchecked: [`${page}: http`, page],
})
assert.deepEqual(result.stillOpen, [notFound])
})
test('keeps a step failure open when its whole job was skipped', () => {
const step = open('publish › Upload')
const result = compareFailures([step], { failures: [], unchecked: ['publish'] })
assert.deepEqual(result.stillOpen, [step])
assert.deepEqual(result.fixed, [])
})
test('measures a step failure from the last run that ran its job', () => {
const ran = runRef(1)
const skippedJob = runRef(2)
const state: FailureState = {
version: 1,
lastRun: skippedJob,
open: [],
lastChecked: nextLastChecked({}, ['publish'], ran),
}
assert.equal(baselineFor({ key: 'publish › Upload' }, state), ran)
assert.equal(baselineFor({ key: 'build › Upload' }, state), skippedJob)
})
test('keeps a step baseline when its job is skipped after the step was', () => {
const [r1, r2, r3] = [runRef(1), runRef(2), runRef(3)]
const afterStepSkipped = nextLastChecked({}, ['publish › Upload'], r1)
const afterJobSkipped = nextLastChecked(afterStepSkipped, ['publish'], r2)
const state: FailureState = { version: 1, lastRun: r3, open: [], lastChecked: afterJobSkipped }
assert.equal(baselineFor({ key: 'publish › Upload' }, state), r1)
})
test('takes the job baseline when a step is skipped after its job was', () => {
const [r1, r2, r3] = [runRef(1), runRef(2), runRef(3)]
const afterJobSkipped = nextLastChecked({}, ['publish'], r1)
const afterStepSkipped = nextLastChecked(afterJobSkipped, ['publish › Upload'], r2)
const state: FailureState = { version: 1, lastRun: r3, open: [], lastChecked: afterStepSkipped }
assert.equal(baselineFor({ key: 'publish › Upload' }, state), r1)
})
test('counts a smoke run where no test passed and some timed out as one failure', () => {
const result = failuresFromVitest({
testResults: [
{
assertionResults: [
{
fullName: 'prod smoke test crawlers',
status: 'failed',
failureMessages: ['Test timed out in 5000ms.'],
},
{
fullName: 'prod smoke test search',
status: 'failed',
failureMessages: ['Test timed out in 5000ms.'],
},
],
},
],
})
assert.deepEqual(result?.failures, [{ key: EVERY_TEST_TIMED_OUT }])
assert.deepEqual(result?.unchecked, [
'test file › prod smoke test crawlers',
'test file › prod smoke test search',
])
})
test('treats a timed-out smoke test as unchecked, not failed', () => {
const result = failuresFromVitest({
testResults: [
{
assertionResults: [
{
fullName: 'prod smoke test graphql',
status: 'failed',
failureMessages: ['expected 200'],
},
{
fullName: 'prod smoke test crawlers',
status: 'failed',
failureMessages: ['Test timed out in 5000ms.'],
},
{
fullName: 'prod smoke test skills',
status: 'failed',
failureMessages: ['TimeoutError: The operation was aborted due to timeout'],
},
{ fullName: 'prod smoke test search', status: 'passed' },
],
},
],
})
assert.deepEqual(result?.failures, [{ key: 'test file › prod smoke test graphql' }])
assert.deepEqual(result?.unchecked, [
'test file › prod smoke test crawlers',
'test file › prod smoke test skills',
])
})
test('counts a smoke test file that failed to run as a failure', () => {
const result = failuresFromVitest({
testResults: [
{
name: '/home/runner/work/supabase/supabase/apps/docs/app/api/crawlers/route.smoke.test.ts',
status: 'failed',
message: 'Failed to load url',
assertionResults: [],
},
],
})
assert.deepEqual(result?.failures, [
{ key: 'apps/docs/app/api/crawlers/route.smoke.test.ts: failed to run' },
])
assert.deepEqual(result?.unchecked, ['apps/docs/app/api/crawlers/route.smoke.test.ts'])
})
test('rejects a results file that is not a Vitest report', () => {
assert.equal(failuresFromVitest({ failures: [] }), null)
// What Vitest writes when global setup crashes or no test file matches
assert.equal(failuresFromVitest({ success: false, testResults: [] }), null)
assert.equal(parseRunFailures({ failures: [{ page: 'no key' }], unchecked: [] }), null)
})
test('lists new failures first and marks fixed ones', () => {
const kept = open('/docs/guides/a: heading-order')
const added = { ...open('/docs/guides/b: duplicate-id'), firstSeen: '2026-12-02T05:17:00Z' }
const fixed = open('/docs/guides/c: button-name')
const message = formatAlert(
{
workflowName: 'Docs Accessibility Scan',
runUrl: 'https://example.com/run',
runLabel: 'scheduled run',
repoUrl: 'https://github.com/supabase/supabase',
},
[kept, added],
new Set([added.key]),
[fixed]
)
const body = message.blocks
.filter((block) => block.type === 'section')
.map((block) => (block as { text: { text: string } }).text.text)
.join('\n')
.split('\n')
assert.equal(message.text, ':rotating_light: Docs Accessibility Scan: 2 open failures')
assert.match(body[0], /^:new: `\/docs\/guides\/b: duplicate-id`: introduced by/)
assert.match(body[1], /^• `\/docs\/guides\/a: heading-order`: .*first seen Dec 1$/)
assert.equal(body[2], ':white_check_mark: fixed: `/docs/guides/c: button-name`')
})
const runRef = (runNumber: number, startedAt = '2026-12-01T05:17:00Z'): RunRef => ({
id: runNumber,
attempt: 1,
runNumber,
headSha: `sha${runNumber}`,
startedAt,
})
test('loads a saved list only when it has the current shape', () => {
const state: FailureState = {
version: 1,
lastRun: runRef(1),
open: [open('docs › Sync')],
lastChecked: {},
}
const saved = JSON.parse(JSON.stringify(state))
assert.deepEqual(parseFailureState(saved), saved)
assert.equal(parseFailureState({ ...state, version: 2 }), null)
assert.equal(parseFailureState({ ...state, lastRun: { runNumber: 'high' } }), null)
assert.equal(
parseFailureState({
...state,
open: [{ key: 'x', firstSeen: 'y', attribution: { kind: 'blame' } }],
}),
null
)
})
test('measures a new failure from the last run that checked its page', () => {
const checked = runRef(1)
const timedOut = runRef(2)
const lastChecked = nextLastChecked({}, ['/docs/guides/a'], checked)
const afterSecondTimeout = nextLastChecked(lastChecked, ['/docs/guides/a'], timedOut)
const state: FailureState = {
version: 1,
lastRun: timedOut,
open: [],
lastChecked: afterSecondTimeout,
}
assert.equal(
baselineFor({ key: '/docs/guides/a: heading-order', page: '/docs/guides/a' }, state),
checked
)
assert.equal(
baselineFor({ key: '/docs/guides/b: heading-order', page: '/docs/guides/b' }, state),
timedOut
)
assert.deepEqual(nextLastChecked(afterSecondTimeout, [], timedOut), {})
})
const push = (run_number: number, conclusion: string | null) => ({
run_number,
conclusion,
head_sha: `sha${run_number}`,
head_commit: { message: `commit ${run_number}\n\nbody` },
})
test('names only the failing push when no run since the baseline went unprocessed', () => {
const result = pushCandidates([push(12, 'failure')], 11, push(12, 'failure'))
assert.deepEqual(result, [{ sha: 'sha12', title: 'commit 12' }])
})
test('includes every push run since the baseline whose alert never ran, even one that passed', () => {
const runs = [
push(14, 'failure'),
push(13, 'cancelled'),
push(12, 'success'),
push(11, 'failure'),
]
const result = pushCandidates(runs, 10, push(15, 'failure'))
assert.deepEqual(
result.map((commit) => commit.sha),
['sha11', 'sha12', 'sha13', 'sha14', 'sha15']
)
})
test('escapes the workflow name in the crash alert', () => {
const message = formatCrashAlert({
workflowName: 'Docs <scan>',
runUrl: 'https://example.com/run',
runLabel: 'scheduled run',
repoUrl: 'https://github.com/supabase/supabase',
})
const section = message.blocks.find((block) => block.type === 'section') as {
text: { text: string }
}
assert.match(section.text.text, /^\*Docs &lt;scan&gt;\* failed before it reported any results/)
})
test('keeps a page that no run has checked without a baseline', () => {
const firstRun = runRef(1)
const afterFirst = nextLastChecked({}, ['/docs/guides/a'], null)
const afterSecond = nextLastChecked(afterFirst, ['/docs/guides/a'], firstRun)
const state: FailureState = { version: 1, lastRun: runRef(2), open: [], lastChecked: afterSecond }
assert.deepEqual(afterSecond, { '/docs/guides/a': null })
assert.equal(
baselineFor({ key: '/docs/guides/a: heading-order', page: '/docs/guides/a' }, state),
null
)
assert.ok(parseFailureState(state))
})