Skip to content

fix(ci): bust Cloudflare.Vite memo so prod tracks main#27

Merged
cooper (czxtm) merged 1 commit intomainfrom
fix/deploy-web-memo-invalidation
May 1, 2026
Merged

fix(ci): bust Cloudflare.Vite memo so prod tracks main#27
cooper (czxtm) merged 1 commit intomainfrom
fix/deploy-web-memo-invalidation

Conversation

@czxtm
Copy link
Copy Markdown
Contributor

Summary

Fixes stackpanel.com silently lagging main when a merge touches only packages/** (e.g. @stackpanel/api, @stackpanel/auth, @stackpanel/db).

apps/web uses alchemy's Cloudflare.Vite, which content-hashes the Worker's working directory (apps/web/) to decide whether a rebuild + upload is needed. Workspace dependencies under packages/** live outside that scope, so a push-to-main that only touches those packages hashes identically to the last deploy and alchemy short-circuits with "no change" — silently skipping the Vite build and the Worker upload. The apex stays frozen on whichever commit last happened to touch apps/web/.

Evidence

As of now, stackpanel.com serves the bundle from the PR #23 merge — PR #25's runtime-migration changes never reached prod.

Fix

Stamp a .build-info file inside apps/web/ (containing the commit SHA + refs) before alchemy deploy. The file sits inside the default memo scope and is not gitignored — so every CI run produces a fresh hash and alchemy is forced to rebuild + upload. Ephemeral on the runner; no secrets.

Leaves Cloudflare.Vite and the memo scope alone — minimum blast radius, matches the existing CI pattern of "stage resolution → install → deploy".

docs/ and api/ are untouched:

  • docs/ already pre-builds with bun run build:worker + Cloudflare.Worker (hash = main bundle bytes, naturally covers upstream changes) — verified live-deployed on the PR feat(db): apply file-based Drizzle migrations programmatically at startup #25 merge (31.07 MB upload).
  • api/ deploys have been failing since 2026-04-29 with Cannot find module '@stackpanel/infra/lib/deploy' from apps/api/alchemy.run.ts — unrelated to this fix; filed separately.

Test plan

  • Merge → watch Deploy Web run on main → confirm the step shows Vite build output and ✓ TanstackStart (Cloudflare.Worker) updated with Uploading worker (XX MB).
  • curl -sI https://stackpanel.com/ → confirm new cf-ray and a response served by the fresh Worker.
  • After PR feat(env): build-time secret injection + effect/Config consumer reads #26 lands, re-verify that curl -sS -X POST 'https://stackpanel.com/api/trpc/waitlist.join?batch=1' -H 'content-type: application/json' -d '{"0":{"json":{"email":"test@example.invalid"}}}' no longer returns the default-secret 500.

apps/web uses alchemy's Cloudflare.Vite, which content-hashes the Worker's
working directory (apps/web/) to decide whether a rebuild + upload is
needed. Workspace dependencies under packages/** (@stackpanel/api,
@stackpanel/auth, @stackpanel/db, …) live outside that scope, so a
push-to-main that only touches those packages hashes identically to the
last deploy and alchemy short-circuits with "no change" — silently
skipping the Vite build and the Worker upload.

Evidence: the PR #25 merge (run 25216266546, sha 86bd256) completed the
"Deploy" step in ~10s with no Vite output and printed "✓ TanstackStart
(Cloudflare.Worker) no change", whereas the PR #23 merge (run
25207387008) — which did touch apps/web/ — ran the full Vite build and
uploaded a 28.20 MB worker. As a result, stackpanel.com is still running
whatever bundle the last apps/web/-touching commit deployed, not
`main`.

Fix: write a SHA-stamped .build-info file inside apps/web/ before
alchemy deploy. The file sits inside the default memo scope (and is
*not* gitignored — doing so would make the default exclude rules filter
it out), so every CI run produces a fresh hash and alchemy is forced to
rebuild + upload. The file is ephemeral on the CI runner.

docs/ and api/ are unaffected — docs already pre-builds with
`bun run build:worker` and uses Cloudflare.Worker (hash = main bundle
bytes, naturally covers upstream changes), and api has a separate
open failure unrelated to the memo.
@cursor
Copy link
Copy Markdown

cursor Bot commented May 1, 2026

PR Summary

Medium Risk
Changes the production deploy workflow behavior by forcing a rebuild/upload on every run, which could increase deploy time/costs or mask real memo behavior, but is limited to CI and contains no secrets.

Overview
Ensures Deploy Web no longer skips Cloudflare Worker rebuilds when only workspace packages change by writing a non-gitignored apps/web/.build-info file (commit/run metadata) before alchemy deploy, forcing Cloudflare.Vite's content-hash memo to change on every CI run.

Reviewed by Cursor Bugbot for commit 1ccea00. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Preview pr-27 has been destroyed.

@czxtm cooper (czxtm) merged commit 06ea3ff into main May 1, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant