Say whether a failed /api/ build is drift or an outage; always build live - #257
Merged
Merged
Conversation
Deploying dynamical-org with
|
| Latest commit: |
f1f0495
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bd61d2c1.dynamical-org.pages.dev |
| Branch Preview URL: | https://api-examples-snapshot.dynamical-org.pages.dev |
…live The loader rendered every failure the same way. It now classifies what it saw: a refused request (4xx) fails at once with the API's own detail, as a likely sign the documented request has drifted; a failing API (5xx, 408, 429, no connection) is retried once and reported as not drift; anything else says only that the example could not be fetched. The canonical follow-up gets the same treatment. Builds no longer cache API responses. eleventy-fetch answers a failed request with an expired cache entry whenever the duration is positive, and Pages keeps .cache between builds, so a deploy could render an old response over a request the API now refuses. --serve keeps its 6h cache. The live endpoint spec also checks each documented method is published.
mrshll
force-pushed
the
api-examples-snapshot
branch
from
September 29, 2026 02:42
e6e212c to
9b0531b
Compare
Review: each run builds the analysis request from its own clock, and its body is part of the cache key, so runs straddling a UTC hour missed the cache for reasons unrelated to the test. Also assert the stale run really reached the API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/api/ still renders live from api.dynamical.org on every build, and a documented request the API refuses still fails the build. This PR changes two things. When a build fails, it now says which kind of failure it saw. And "every build" now really means every build, with no cached response hiding a refusal.
What changes
classifyFailureandfailureDetailinlib/api-examples.js). eleventy-fetch puts theResponseincausewhen the API answered, and the network error there when it didn't.detail, compacted to JSON when it's a FastAPI validation array, and capped at 500 characters. It says this usually means the documented request has drifted from the API. A refusal can also come from the edge, such as a WAF 403, so the detail is printed rather than assumed.canonical.--serve/--watch, where it was 6h everywhere. It now readsELEVENTY_RUN_MODEto tell them apart, andAPI_EXAMPLES_CACHE_DURATIONstill overrides it..cacheis one of the directories it keeps between builds. So a deploy could render an old response over a request the API now refuses, and pass. That is the drift this build check exists to catch.--servekeeps 6h so editing stays off the API.npx @11ty/eleventyruns each made all 7 requests to api.dynamical.org, even with.cachewarm. The quickstart and canonical still share one forecast POST: eleventy-fetch reuses an in-flight or settled request with the same key.test/e2e/api-docs.spec.mjsnow fails when a documented method isn't published at that path, not only when the path is missing.Tests
test/api-docs.test.mjs(unit):detail, keeps validation arrays, and falls back to the start of a non-JSON page or the bare statustest/api-examples-loader.test.mjs(new; still offline, using a stand-in API on localhost with each run in its own process and cache dir, about 2 s):canonical--serve, an expired cache papers over a 422 (asserted, so the test would notice if eleventy-fetch stopped doing that), and a build with the same.cachefails on that 422Checks
npm test: 337 passtest/e2e/api-docs.spec.mjsagainst the live API: 2 passNot in this PR
test/e2e/api-docs.spec.mjsonly run with the whole e2e suite (daily and on scorecard/e2e PRs viascorecard-charts.yml), not on every PR.2026-09-28: first version (snapshots)
The first version of this PR rendered /api/ from a committed, dated capture (
lib/api-snapshot/). It checked that capture against the live API only on PRs touching the API docs, and there were two Codex review passes on that design. Marsh chose instead to keep every build live, accepting build and CI dependence on the API for drift detection, and to show no capture date.2026-09-29: reworked for live builds
mainand rebuilt as a fresh commit plus review fixes; the snapshot design survives only in this log.