Repository navigation
feat(server-functions): send the build id header (solid #4215) - #492
Merged
Merged
Conversation
…he server Wires solidjs/solid#4215. The client build sends X-Server-Function-Build on non-GET calls through a wrapped configureServerFunctionsClient, so an app's own prepareRequest hook composes with it. The server build reads the id the client build persisted and passes it as buildId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWNxauSmmSdFhFbxZip
🦋 Changeset detectedLatest commit: ae827a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Requested by Ryan · project thread
solidjs/solid#4215 added an opt-in build check to the server-function runtime: a server configured with
buildIdanswers409(unknownFunction: trueon the client) to a call whoseX-Server-Function-Buildheader names another build. The client runtime never sends the header. The build integration is meant to add it. Until now, nothing did.What this does
prepareRequesthook that stamps non-GET calls with the build id. It also re-exportsconfigureServerFunctionsClient, wrapped so that an app's ownprepareRequestruns after the stamp instead of replacing it. Core'sconfigureServerFunctionsClientreplaces the hook rather than composing it, so without the wrapper an app hook would silently drop the header.buildIdtoconfigureServerFunctionsServer. The id is read from the client build's persisted.vite/solid-server-functions.json, which now carries abuildIdfield. Reading it from the file instead of the plugin closure keeps the classic two-invocation build consistent, and works when Vite resolves each environment's config separately.runtimeis left alone, because its configure contract is its own.Costs and trade-offs
unknownFunction(the existing skew signal). The chunk holding the wrapper also gets a new content hash on every build. A content-derived id would make builds reproducible, but it would miss shape changes that come from imported helpers. I chose the safer option.solid:client-build-firstenforces it.Tests
src/server-functions/build-id.test.tsruns a two-invocation build. It checks that the persisted id appears in the client bundle next to the app's hook, and that the server bundle is configured with the same id.fetch. The POST carried bothX-Server-Function-Buildand the app hook's header.examples/start-ssr: 779/779. The byte-identicalserver.jscheck now also masks the build id and the client chunk hashes in the baked manifest. ssr, css-matrix, start-client and start-env pass. Unit suite: 74/74.Generated by Claude Code