Skip to content

Redirect-only publishes don't change the decofile revision, so page caches keep serving the old page #834

Open

Description

@hugo-ccabral

Problem

Exact redirects live in their own KV keys (redirect:<id>:<path>, #553), so deco-sync-blocks-to-kv computes the decofile revision without them (buildSnapshot(split.blocks) in packages/blocks-cli/scripts/sync-blocks-to-kv.ts). A redirect-only publish therefore leaves decofile:<id> and index:revision:<id> byte-identical.

Anything that keys a cache on the decofile revision misses that edit:

  • Fresh Workers (feat(workerd): fast deploy — decofile and exact redirects from Cloudflare KV deco-cx/deco#1280): the Worker's page cache key is <build>:<decofile revision> (runtime/workerd/worker.ts). Trigger: /promo is cached as a 200 page, then a redirect /promo → /sale is published. The router would redirect, but cached hits keep serving the old 200 until s-maxage plus stale-while-revalidate runs out. Before fast deploy, a redirect edit was a new build and therefore a new key.
  • TanStack: purgePathsForChangedKeys purges / plus the path of changed page blocks. A changed redirect block has no path, so the redirect's source path is not purged either. This needs confirming against the TanStack page cache.

The per-isolate lookup cache isn't the problem: it expires after 60 s.

Options

  • Write index:redirects-revision:<id> (already named as the upgrade path in packages/tanstack/src/sdk/kvRedirects.ts). Runtimes fold it into their cache key and poll it alongside index:revision.
  • Or, in sync-blocks-to-kv, purge the source path of each added, changed or removed exact redirect (TanStack only; Fresh has no purge endpoint).

Out of scope for

#830 and deco-cx/deco#1280. Both keep the write-side revision as it is, so TanStack's byte-identical revision contract doesn't move.

🤖 Generated with Claude Code

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions