Skip to content

Edge-cache invalidation strategy for poisoned partials #65

Closed

Description

@neuromechanist

Symptom

After PR #54 fixed #53 (failure-fallback HTML no longer cached with SWR=86400), datasets that were poisoned before the fix shipped continue to render the empty-fallback HTML for up to 24 h per Cloudflare PoP. User report 2026-05-26: on005505 still shows "No description available" / "Manifest unavailable" even though the underlying data.nemar.org artifacts are healthy and a cache-bust (?_cb=...) returns full content.

Root cause

src/middleware.ts:69-101 writes 200 responses to caches.default under namespace nemar-edge-v1, honoring the upstream Cache-Control. Pre-#54 fallback responses got s-maxage=600, stale-while-revalidate=86400 and are still served as HIT from any PoP that cached them in that window. There's no mechanism to invalidate them on deploy or on demand.

Proposal

Pick one (or layer):

  1. Versioned cache namespace — bump caches.default.open(\"nemar-edge-v1\") to \"nemar-edge-v2\" on every meaningful change to the cache-policy or partial logic. Old namespace just goes cold. Cheapest, automatic on next deploy.
  2. Cache-bust script — operational utility (scripts/bust-edge-cache.ts) that walks api.nemar.org/datasets, fires cache-busting GETs against each /dataset/<id> page + both partials. Run manually after large coverage changes.
  3. CF Purge API — wire the Cloudflare zone purge into the deploy step. Heaviest, but exact.

Recommend (1) as the default for code/policy changes, (2) for ops follow-up after a fleet-wide content event (like today's on* re-import where summary.json coverage went from incomplete to nearly-complete).

Companion: bust the current poisoned set

Independent of the long-term fix, the user-visible bug today needs the existing poisoned entries flushed. A one-shot run of option (2) against the 123 on*+nm* ids would resolve the immediate symptom; no code change required.

Acceptance

  • After deploy, no dataset can serve cached fallback HTML older than the SWR window of the policy that was active when it was stored
  • Documented runbook step for option (2) lives in README.md or docs/
  • Verified: cache-busting a known-poisoned dataset evicts the entry from the PoP the request hits

Related

Activity

  1. added
    bug
    on May 26, 2026
  2. added 2 commits that reference this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions