feat: generate same-origin configs with offset devPorts, fix fork detection - #25
Open
flipvh wants to merge 1 commit into
Open
feat: generate same-origin configs with offset devPorts, fix fork detection#25flipvh wants to merge 1 commit into
flipvh wants to merge 1 commit into
Conversation
…ection Pairs with cella#1067 (devPorts knob). The generator's config shapes were pre-same-origin (backendUrl on its own port, /auth path, no yjs/mcp URLs), and the port offset only moved URLs and the .env PORT line, which the hardcoded Vite proxy target then defeated. Generated configs now mirror cella's same-origin shapes for development/staging/tunnel/test and bake an offset devPorts block into development; PORT is dropped from the .env replacements (a stale line silently overrides the offset). Fork detection handles same-origin shapes: frontendUrl regex no longer requires a bare closing quote, backend port parses from devPorts with legacy fallbacks. Co-Authored-By: Claude Fable 5 <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.
Pairs with cellajs/cella#1067 (the
devPortsconfig knob). Generated configs catch up with cella's same-origin URL shapes, and new forks get collision-free service ports again.Why
The port-offset system only ever moved the URL ports and the
.envPORT=line. Since cella's same-origin migration, the backend port no longer appears in any URL and the Vite proxy target was hardcoded tolocalhost:4000— so an offsetPORTbroke the fork's own frontend, and in practice forks (e.g. projectcampus) resetPORTto 4000 and collided on the shared service ports. The generator was also emitting the pre-same-origin config shape (backendUrlon its own port,/authpath, noyjsUrl/mcpUrl), anddetectUsedPortsfailed to recognize same-origin forks (itsbackendUrlregex requires a port before the closing quote), so offset suggestions ignored them.What
generateEnvConfigs: development/staging/tunnel/test now mirror cella's current same-origin shapes (URL family incl.yjsUrl/mcpUrl; tunnel gains its slug), and development bakes in an offsetdevPortsblock (api/cdcHealth/yjs/mcp = 400x + offset) paired with the offsetfrontendUrl.getBackendEnvReplacements:PORTdropped —devPortsgoverns, and a stalePORT=env line silently overrides the fork's offset (the exact projectcampus failure mode).detectUsedPorts: recognizes all three config generations (devPorts, legacy portedbackendUrl, bare same-origin) with the backend port parsed fromdevPortswhere present.detect-used-ports.test.tscovering the three shapes and offset suggestion.Notes
devPortskey only typechecks against a template that declares it inRequiredConfig.generateEnvConfigsdrift with cella's config shape has now bitten three times (named exports,.tsextensions, this); the shapes here are copied verbatim from cella's currentconfig.<mode>.tsfiles.🤖 Generated with Claude Code