feat(csr): version drift detection between SDK and worker - #415
Draft
nicklasl wants to merge 4 commits into
Draft
Conversation
nicklasl
force-pushed
the
nicklasl/csr-version-drift
branch
from
July 17, 2026 11:19
2cb3fb4 to
5b04414
Compare
nicklasl
force-pushed
the
nicklasl/csr-version-drift
branch
from
July 17, 2026 12:46
5b04414 to
0a33c63
Compare
The worker file now carries a content hash (SHA-256 prefix) set at build time via globalThis.__WORKER_HASH__. When using a custom workerUrl and the hash doesn't match the installed SDK, a warning is logged via debugLogger. Recording still proceeds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nicklasl
force-pushed
the
nicklasl/csr-version-drift
branch
from
August 18, 2026 13:30
0a33c63 to
3a43c81
Compare
Move vi.mock for worker-hash into loadCreateUploader so it applies fresh after each vi.resetModules call. The module-level mock leaked into blob: fallback tests on CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
build-worker.mjscomputes a SHA-256 hash of the bundled worker code and writes it toworker-hash.tsemit-worker-file.mjsprependsglobalThis.__WORKER_HASH__to the standalone fileglobalThisand sends it in the welcome messagedebugLogger, recording still proceedsurlScheme === 'custom') — inlined workers (data:/blob:) can't driftWhy hashes instead of versions
csr-common and session-recording have independent version numbers. Using either package's version for the drift check would show a version the customer doesn't recognize. A content hash sidesteps versioning entirely — if the worker code changed, the hash changed, regardless of which package bumped.
Test plan
workerHashincluded in welcome whenglobalThis.__WORKER_HASH__is setworkerHashis undefined when not set (inlined worker path)urlScheme === 'custom'and hashes differworkerHashabsent (graceful degradation for old workers)🤖 Generated with Claude Code