fix(task-board): don't cache "no preview yet" for a full window - #7024
Merged
Conversation
A PR card read while its deploy is still running has no preview URL, and both caches then serve that not-ready answer as a fresh hit — the reads cache for 55s, the assembled card for 30s, layered. So the preview link appears minutes after GitHub actually has it. Seen on ELEC-245: the VTEX FastStore preview was live on the PR while the task card still showed only "3/9 successful checks". Add a per-entry hit-window override to both `fetch` and `fetchOrPlaceholder`, computed from the stored value, and use it in the two places that can be incomplete: - the `GET_PREVIEW_DEPLOYMENT` read, when it carries no environment url yet; - the assembled card, while checks are pending and no preview has been found. Both go stale immediately, so the next poll revalidates. Revalidation is already detached, so this costs a background rebuild per poll on exactly the cards that are still missing something, and nothing on the rest — a card that has its preview, or whose CI settled without one, caches normally again.
pedrofrxncx
enabled auto-merge (squash)
September 4, 2026 20:27
decocms Bot
pushed a commit
that referenced
this pull request
Sep 4, 2026
PR: #7024 fix(task-board): don't cache "no preview yet" for a full window Bump type: patch - decocms (apps/api/package.json): 4.332.1 -> 4.332.2 - @decocms/native (apps/native/package.json): 4.332.1 -> 4.332.2 Deploy-Scope: server
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.
Problem
A PR card read while its deploy is still running has no preview URL yet — and both caches store that not-ready answer as a normal value, then serve it as a fresh hit: the reads cache for 55s, the assembled card for 30s, layered. So the preview link shows up minutes after GitHub actually has it.
Seen on
ELEC-245: the VTEX FastStore preview (sfj-a14bf72--electroluxecfaststore.preview.vtex.app) was live on PR #305 while the task card still showed only "3/9 successful checks" and no preview button.Change
A per-entry hit-window override on
fetchandfetchOrPlaceholder, computed from the stored value, used in the two places that can be incomplete:GET_PREVIEW_DEPLOYMENTread, when it carries noenvironmentUrlyet;checksStatus === "pending"and no preview has been found.Both go stale immediately, so the next poll revalidates. Revalidation is already detached from the request path, so this costs one background rebuild per poll on exactly the cards still missing something — and nothing on the rest. A card that has its preview, or whose CI settled without one, caches normally again (
isAwaitingPreview).No TTL constants changed; no behaviour change for complete cards.
Testing
pr-cache.test.ts— two new cases pinning that a not-ready value is never a hit inside the default window, and that the override stops applying once the value is complete.checks-status.test.ts—isAwaitingPreviewtruth table (preview found, CI passing, CI failing, no CI all cache normally).bun test apps/api/src/tools/task-board/→ 465 pass. The 10 failures areECONNREFUSED :5432integration tests needing a local Postgres, unrelated.bun run fmt,bun run lint(0 errors),tsc --noEmitclean.Summary by cubic
Fixes the task board caching "no preview yet" for the full window, so preview links now appear as soon as GitHub has them.
While a deploy is still running, both caches served the not-ready answer as a fresh hit — 55s for reads, 30s for the assembled card, layered — so the preview could show up minutes after GitHub had it (seen on
ELEC-245).What changed
fetchandfetchOrPlaceholder, computed from the stored value.GET_PREVIEW_DEPLOYMENTread with no environment URL yet, and the assembled card while checks are pending and no preview is found.isAwaitingPreviewlogic.Written for commit 725152a. Summary will update on new commits.