Skip to content

ci(api-spec): handle endpoints that leave the spec, alert when the sync fails - #893

Merged
hlenke merged 1 commit into
mainfrom
hlenke/api-spec-prune-removed-endpoints
Nov 28, 2026
Merged

hlenke merged 1 commit into
mainfrom
hlenke/api-spec-prune-removed-endpoints

Conversation

@hlenke

@hlenke hlenke commented Nov 28, 2026

Copy link
Copy Markdown
Member

What was wrong

The nightly job that copies the latest API spec into the docs failed every run from Nov 25 until #891, and nobody was alerted. There were two problems:

  1. The job only handled added endpoints. When the API dropped GET /v2/usage/terms/{id}/projections, the docs menu (docs.json) still listed it. The job's endpoint check stopped on that entry before it could open a PR. fix(api): drop the removed term projections endpoint from the menu #891 removed the entry by hand. Without a job change, the next removed endpoint breaks it again.
  2. The failure alert could never fire. The step that pings the Checkly heartbeat ran with if: always(), so it reported success even when the job failed.

What changed

  • New step: remove pages of endpoints that left the spec (.github/scripts/prune-removed-endpoints.mjs). It runs before the endpoint check. For each menu entry whose endpoint is no longer in the spec, it:

    • removes the entry from docs.json, and deletes the page file if the page was an .mdx file,
    • redirects the old page URL to the next page in the same menu group (or the API reference overview), so old links keep working. Existing redirects that pointed at the old URL are updated too,
    • lists the removed endpoints in the sync PR's description.

    Schema-generated pages get their URL from the spec, so the old URL is read from the previous spec in git.

  • No auto-merge when endpoints were removed. Additions still merge on their own. If a run removes something, auto-merge stays off, so a person checks the redirect targets and any pages that still link to the old URL.

  • Heartbeat only on success. A failed run now shows up in Checkly as a missed heartbeat.

Verified

What the reader has to do

Check the settings of the Checkly heartbeat check that this job pings. The job runs on weekdays only, so the heartbeat's period and grace time must cover the weekend, or it will alert every Monday.

🤖 Generated with Claude Code

…nc fails

The nightly spec sync only handled added endpoints. When the API dropped
GET /v2/usage/terms/{id}/projections, its menu entry stopped the job before
it opened a PR, from Nov 25 until it was removed by hand (#891). The
heartbeat ping ran on failure too, so Checkly never alerted.

- Add prune-removed-endpoints.mjs, which runs before the endpoint check.
  It removes menu entries and MDX stubs for endpoints that are no longer
  in the spec, redirects their old URLs to the next page of the same
  group, and lists them in the PR description.
- Keep auto-merge off for a sync PR that removed endpoints, so a person
  checks the redirects.
- Ping the heartbeat only when the job succeeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
checkly-422f444a 🟢 Ready View Preview Nov 28, 2026, 7:23 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@hlenke
hlenke merged commit ad04630 into main Nov 28, 2026
7 checks passed
@hlenke
hlenke deleted the hlenke/api-spec-prune-removed-endpoints branch November 28, 2026 19:25

This branch was successfully deployed

1 active deployment
staging — 32e1d4f5 Deployed Nov 28, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant