Skip to content

Revert "fix(webapp): survive asset hash rotation across rolling deploys (#4260)"#4280

Merged
nicktrn merged 1 commit into
mainfrom
revert/asset-hash-recovery
Jul 17, 2026
Merged

Revert "fix(webapp): survive asset hash rotation across rolling deploys (#4260)"#4280
nicktrn merged 1 commit into
mainfrom
revert/asset-hash-recovery

Conversation

@nicktrn

@nicktrn nicktrn commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Standard git revert of #4260.

Its client-side stale-asset recovery is net-negative during normal deploys:

  • The fetch interception treats any ?_data= request (Remix loader and action traffic) as a navigation and, on a build-id mismatch, location.assignes the tab to the fetched URL — an open dashboard tab can be hard-navigated to a raw data URL during a rolling deploy, losing unsaved input.
  • Any transient /build asset error (a network blip, an extension, an unrelated failed dynamic import) blanks the page behind a full-screen overlay for ~60s before offering a manual reload.
  • It serialized form field values to sessionStorage to restore them across the reload.

This returns the webapp to the pre-#4260 baseline as a fast, low-risk step.

Follow-ups (separate PRs):

@nicktrn nicktrn self-assigned this Jul 17, 2026
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4758c9e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fda9f8e7-7f1e-44bb-b510-e64a5a26e7d1

📥 Commits

Reviewing files that changed from the base of the PR and between 939c007 and 4758c9e.

📒 Files selected for processing (6)
  • .claude/rules/server-apps.md
  • .server-changes/stale-deploy-asset-recovery.md
  • apps/webapp/app/components/StaleAssetRecovery.tsx
  • apps/webapp/app/entry.server.tsx
  • apps/webapp/app/root.tsx
  • apps/webapp/server.ts
💤 Files with no reviewable changes (5)
  • .server-changes/stale-deploy-asset-recovery.md
  • apps/webapp/app/components/StaleAssetRecovery.tsx
  • apps/webapp/server.ts
  • apps/webapp/app/entry.server.tsx
  • apps/webapp/app/root.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout. (18)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 12)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: typecheck / typecheck
  • GitHub Check: code-quality / code-quality
  • GitHub Check: audit
  • GitHub Check: audit
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
.claude/rules/server-apps.md (1)

17-17: LGTM!


Walkthrough

Removed the StaleAssetRecovery component and its rendering from the webapp. Removed server middleware that emitted X-Build-Id and the /build-version endpoint. Requests no longer receive an automatic Cache-Control: no-cache header when absent. Updated server-app change guidance with frontmatter values, changeset conditions, and release-note formatting requirements.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the revert but omits most required template sections like Closes, Checklist, Testing, Changelog, and Screenshots. Add the missing template sections with an issue reference, checklist items, testing steps, a changelog summary, and screenshots or a note that none are needed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states this PR reverts the stale-asset recovery change and matches the main changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert/asset-hash-recovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread .server-changes/stale-deploy-asset-recovery.md
@nicktrn
nicktrn enabled auto-merge (squash) July 17, 2026 12:42
@nicktrn
nicktrn merged commit 051d708 into main Jul 17, 2026
35 checks passed
@nicktrn
nicktrn deleted the revert/asset-hash-recovery branch July 17, 2026 12:42
nicktrn added a commit that referenced this pull request Jul 17, 2026
…4282)

## Problem

The webapp's HTML references content-hashed `/build` assets, and each
running
instance contains exactly one build and returns 404 for asset hashes it
doesn't
have. During a rolling deploy a client can hold HTML from one build
while a
request for one of its assets is served by an instance on a different
build →
missing styles or a failed chunk load.

## What this does

On a `/build` stylesheet/script/chunk load failure, the client does a
**bounded
full-document reload** (at most 2 per 5 minutes, tracked in
`sessionStorage`) so
the page reloads onto a single consistent build. That's the whole
mechanism — no
polling, no `fetch` interception, no blocking overlay, no form
snapshotting.

- `apps/webapp/app/components/StaleAssetRecovery.tsx` — authored as a
typed,
lint-checked function and serialized to an inline script via
`.toString()` (so
the logic is real, reviewable code, not an opaque string), injected
before
  `<Links />`, production only.
- Detection: capture-phase `error` listener for
`<link>`/`<script>`/modulepreload
failures under `/build/`, plus an `unhandledrejection` guard for
dynamic-import
  failures.
- Guards: once-per-page re-entrancy guard, the bounded reload budget,
and a
`navigator.onLine` check so it never reloads into an offline error page.
- Unit tests in `StaleAssetRecovery.test.ts`.

## Relationship to #4260

Replaces the recovery introduced in #4260 (reverted in #4280) with a
much
smaller, reload-only approach — the previous version intercepted `fetch`
and
could turn a data request into a navigation, and showed a full-screen
overlay on
any asset error; this drops both.

## `/build-version` compatibility shim

`apps/webapp/server.ts` adds a tiny `GET /build-version` endpoint (build
id only,
`no-store`). A previously-deployed client build polls it after an asset
failure
and reloads once it sees a newer build, so those older tabs recover in
one reload
instead of getting stuck. Temporary — safe to remove once older clients
have
cycled out. It deliberately does **not** re-add an `X-Build-Id` response
header.

## Also

Restores the `.server-changes` writing guidance in
`.claude/rules/server-apps.md`
(reverted alongside #4260).

## Self-hosting note

Recovery is most reliable when your load balancer keeps a client on one
instance
for the duration of a deploy (short session stickiness) — the reload
then lands
on a consistent build in one hop.
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.

2 participants