Skip to content

feat(server): hot-swap-safe web serving + web-only deploy classification - #293

Merged
patroza merged 3 commits into
fork/changesfrom
feat/web-hot-swap
Aug 3, 2026
Merged

feat(server): hot-swap-safe web serving + web-only deploy classification#293
patroza merged 3 commits into
fork/changesfrom
feat/web-hot-swap

Conversation

@patroza

@patroza patroza commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Groundwork for redeploying the web bundle without restarting the server (independent web deploys).

What

  1. Hot-swap-safe static serving. The server already serves dist/client live from disk per request, so replacing the bundle in place is picked up immediately. Closed the one correctness gap: the in-memory compression cache keyed stable-name files (favicon, manifest, …) by path+mtime+size, so an atomic asset swap that preserved metadata could serve stale compressed bytes. New isContentHashedAsset() keeps content-hashed assets cheaply metadata-keyed (name encodes content) and keys every stable-name file by content, like index.html already was.
  2. Web-only deploy classification. classify-deployment-diff.sh lumped apps/web into a full server restart. Added a server_code flag and a new web_hot_swap=true output for when the server target is affected purely through its served bundle (no server process code changed) — so ops can hot-swap dist/client on the running server instead of restarting it. Desktop bundles its own copy and still rebuilds.

Why

Enables an additive-union hot swap (copy new hashed assets, atomically swap index.html, GC old) with no t3code-server restart. Clients already pick up new bundles via the no-cache index.html + vitePreloadRecovery reload path.

Tests

  • isContentHashedAsset unit cases (hashed vs stable-name).
  • Classifier web_hot_swap cases: web-only, server-code, cross-boundary packages, discord-only, non-runtime.
  • vp check 0 errors; full recursive typecheck clean.

Follow-ups (separate)

  • ops repo: the additive-union hot-swap deploy step reading web_hot_swap.
  • Optional: server→client webVersionChanged WS signal so open/idle clients reload proactively (needs client verification).

🤖 Generated with Claude Code

…y deploys

Groundwork for redeploying the web bundle without restarting the server. The
server already serves dist/client live from disk per request, so replacing the
bundle in place is picked up immediately -- but two gaps blocked a safe hot swap:

1. Compression cache could serve stale bytes. Stable-name files (favicon,
   manifest, ...) were keyed by path+mtime+size, so an atomic asset swap that
   preserved metadata could return old compressed bytes under new headers. Add
   isContentHashedAsset(): hashed assets (name encodes content) stay cheaply
   keyed by metadata; every stable-name file is now keyed by content, as
   index.html already was.

2. The deploy classifier lumped apps/web into a full server restart. Add a
   server_code flag and emit web_hot_swap=true when the server target is
   affected purely through its served bundle (no server process code changed),
   so ops can swap dist/client on the running server instead of restarting it.
   Desktop bundles its own copy and still rebuilds.

Tests: isContentHashedAsset unit cases; classifier web_hot_swap cases for
web-only, server-code, cross-boundary, and non-runtime diffs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@patroza
patroza enabled auto-merge (squash) August 2, 2026 15:56
@patroza
patroza disabled auto-merge August 3, 2026 07:57
@patroza
patroza merged commit 35dfb20 into fork/changes Aug 3, 2026
9 checks passed
patroza added a commit that referenced this pull request Aug 4, 2026
…y deploys (#293)

Groundwork for redeploying the web bundle without restarting the server. The
server already serves dist/client live from disk per request, so replacing the
bundle in place is picked up immediately -- but two gaps blocked a safe hot swap:

1. Compression cache could serve stale bytes. Stable-name files (favicon,
   manifest, ...) were keyed by path+mtime+size, so an atomic asset swap that
   preserved metadata could return old compressed bytes under new headers. Add
   isContentHashedAsset(): hashed assets (name encodes content) stay cheaply
   keyed by metadata; every stable-name file is now keyed by content, as
   index.html already was.

2. The deploy classifier lumped apps/web into a full server restart. Add a
   server_code flag and emit web_hot_swap=true when the server target is
   affected purely through its served bundle (no server process code changed),
   so ops can swap dist/client on the running server instead of restarting it.
   Desktop bundles its own copy and still rebuilds.

Tests: isContentHashedAsset unit cases; classifier web_hot_swap cases for
web-only, server-code, cross-boundary, and non-runtime diffs.

Co-authored-by: Stack Test <stack-test@example.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
patroza added a commit that referenced this pull request Aug 4, 2026
…y deploys (#293)

Groundwork for redeploying the web bundle without restarting the server. The
server already serves dist/client live from disk per request, so replacing the
bundle in place is picked up immediately -- but two gaps blocked a safe hot swap:

1. Compression cache could serve stale bytes. Stable-name files (favicon,
   manifest, ...) were keyed by path+mtime+size, so an atomic asset swap that
   preserved metadata could return old compressed bytes under new headers. Add
   isContentHashedAsset(): hashed assets (name encodes content) stay cheaply
   keyed by metadata; every stable-name file is now keyed by content, as
   index.html already was.

2. The deploy classifier lumped apps/web into a full server restart. Add a
   server_code flag and emit web_hot_swap=true when the server target is
   affected purely through its served bundle (no server process code changed),
   so ops can swap dist/client on the running server instead of restarting it.
   Desktop bundles its own copy and still rebuilds.

Tests: isContentHashedAsset unit cases; classifier web_hot_swap cases for
web-only, server-code, cross-boundary, and non-runtime diffs.

Co-authored-by: Stack Test <stack-test@example.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
patroza added a commit that referenced this pull request Aug 4, 2026
…y deploys (#293)

Groundwork for redeploying the web bundle without restarting the server. The
server already serves dist/client live from disk per request, so replacing the
bundle in place is picked up immediately -- but two gaps blocked a safe hot swap:

1. Compression cache could serve stale bytes. Stable-name files (favicon,
   manifest, ...) were keyed by path+mtime+size, so an atomic asset swap that
   preserved metadata could return old compressed bytes under new headers. Add
   isContentHashedAsset(): hashed assets (name encodes content) stay cheaply
   keyed by metadata; every stable-name file is now keyed by content, as
   index.html already was.

2. The deploy classifier lumped apps/web into a full server restart. Add a
   server_code flag and emit web_hot_swap=true when the server target is
   affected purely through its served bundle (no server process code changed),
   so ops can swap dist/client on the running server instead of restarting it.
   Desktop bundles its own copy and still rebuilds.

Tests: isContentHashedAsset unit cases; classifier web_hot_swap cases for
web-only, server-code, cross-boundary, and non-runtime diffs.

Co-authored-by: Stack Test <stack-test@example.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
patroza added a commit that referenced this pull request Aug 5, 2026
…y deploys (#293)

Groundwork for redeploying the web bundle without restarting the server. The
server already serves dist/client live from disk per request, so replacing the
bundle in place is picked up immediately -- but two gaps blocked a safe hot swap:

1. Compression cache could serve stale bytes. Stable-name files (favicon,
   manifest, ...) were keyed by path+mtime+size, so an atomic asset swap that
   preserved metadata could return old compressed bytes under new headers. Add
   isContentHashedAsset(): hashed assets (name encodes content) stay cheaply
   keyed by metadata; every stable-name file is now keyed by content, as
   index.html already was.

2. The deploy classifier lumped apps/web into a full server restart. Add a
   server_code flag and emit web_hot_swap=true when the server target is
   affected purely through its served bundle (no server process code changed),
   so ops can swap dist/client on the running server instead of restarting it.
   Desktop bundles its own copy and still rebuilds.

Tests: isContentHashedAsset unit cases; classifier web_hot_swap cases for
web-only, server-code, cross-boundary, and non-runtime diffs.

Co-authored-by: Stack Test <stack-test@example.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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