Repository navigation
fix(api): no-store on tree/readme empty-fallback branches - #54
Merged
neuromechanist merged 2 commits intoMay 23, 2026
Merged
neuromechanist merged 2 commits into
neuromechanist merged 2 commits into
Conversation
Closes #53. Transient upstream failures were producing 200-OK empty-fallback HTML cached at the CF edge with s-maxage=600 + stale-while-revalidate=86400, blanking dataset pages for hours after a single cold-start manifest timeout.
Deploying nemar-website with
|
| Latest commit: |
763008b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1f70d0c1.nemar-website.pages.dev |
| Branch Preview URL: | https://53-fixapi-dont-cache-failure.nemar-website.pages.dev |
Address minor wording finding in PR review: distinguish 'content steps came back null' from 'come back empty'. The discriminator at line 135 is source nullability, not content emptiness — non-null source from any of the four steps (manifest/github/description) means real content was found and gets PUBLISHED_CACHE.
neuromechanist
deleted the
53-fixapi-dont-cache-failure-fallback-html-on-treereadme-partials
branch
May 23, 2026 13:49
This was referenced May 26, 2026
neuromechanist
added a commit
that referenced
this pull request
May 26, 2026
Comment-analyzer found the rationale block named the wrong cached keys: poisoned entries are responses from /api/dataset/<id>/readme and /api/dataset/<id>/tree (the partial endpoints), not the SSR /dataset/<id> page. Also add "(fixes #53)" next to "PR #54" so a future GitHub search lands on the original bug report.
6 of 8 tasks
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.
Closes #53.
Problem
/api/dataset/<id>/{tree,readme}seton every 200, including the empty-fallback HTML emitted when
getManifesttimes out from a cold SSR isolate (or any other transient upstream
failure). That fallback gets pinned at the CF edge for
s-maxage=600fresh +
stale-while-revalidate=86400stale, blanking otherwise-healthydataset pages for hours.
Reproduced on
on002778: 5/10 cold calls returned the 354-byte"Manifest unavailable" partial before warming. After cache-bust, the
canonical URL returned the full 187 KB tree.
Fix
Branch the
Cache-Controlheader by outcome:steps produced a source) → keep
PUBLISHED_CACHE. Response isdeterministic for the (id, version) pair, long edge cache is fine.
source after all four readme steps) →
Cache-Control: no-store. Theone unlucky request takes the hit; subsequent requests get a fresh
origin call.
Unpublished and unknown-dataset branches keep their existing caches.
Why not just shorten s-maxage everywhere
Healthy responses are deterministic; long edge caches matter for cold
visitors on large datasets (nm000104's tree HTML is ~ 200 KB). Shortening
the success-path cache would amplify origin load with no upside. The
failure cases are the actual problem.
Test plan
bun run lint→ cleanbun run typecheck→ 0 errorsbun test→ 350/350 passww2.nemar.org/api/dataset/on002778/tree?v=v1.0.0until a cold-start failure appears, then immediately re-curl and
verify the second call hits the origin (not a cached empty).