Apply worktree prefix in monorepo default mode#270
Open
DreadPirateJohn wants to merge 1 commit intovercel-labs:mainfrom
Open
Apply worktree prefix in monorepo default mode#270DreadPirateJohn wants to merge 1 commit intovercel-labs:mainfrom
DreadPirateJohn wants to merge 1 commit intovercel-labs:mainfrom
Conversation
handleDefaultSingle prepends the git worktree prefix to the resolved hostname so each linked worktree gets a unique URL. handleDefaultMulti did not, so bare `portless` from a workspace root produced identical hostnames across worktrees and routes collided. Mirror the single-package behavior: detect the worktree once at the top of handleDefaultMulti and prepend the prefix to both the appOverride.name branch and the inferred-name branch. No behavior change in the main checkout (detectWorktreePrefix returns null and the ternary falls through to the existing baseName).
|
@DreadPirateJohn is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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
Bare
portlessfrom a workspace root assigns the same hostnames in every git worktree, causing route collisions.portless run --name <name>works correctly. Only the bare-binary monorepo path is affected.Reproduction
Same behavior with or without a
portless.jsonappsmap. Reproduced on 0.11.1 and against currentmain.Root cause
In
packages/portless/src/cli.ts:handleDefaultSinglecallsdetectWorktreePrefix(cwd)and prependsworktree.prefixto the resolved name.handleDefaultMultinever callsdetectWorktreePrefix. Thenameis taken straight fromappOverride.nameor${pkgLabel}.${projectName}with no prefix.The README's "Git Worktrees" section and the
nameconfig field doc ("Worktree prefix still applies") both suggest the prefix should apply in either path.Fix
Mirror what
handleDefaultSinglealready does. Detect the worktree once at the top ofhandleDefaultMulti, then in both branches that computenameextract the existing logic into abaseNamelocal and prepend the prefix when a worktree is detected.No behavior change in the main checkout:
detectWorktreePrefixreturnsnull, the ternary falls through tobaseName, and the assignednameis byte-identical to the previous output.Verification
pnpm install,pnpm type-check,pnpm lint,pnpm build,pnpm testall green (595/595 tests pass).<app>.<project>.localhost, linked worktree on branchtest-portlessproducestest-portless.<app>.<project>.localhostas expected.Happy to add a regression test if there's a preferred fixture pattern for
handleDefaultMulti(the existing CLI tests cover the surface but I did not see one specifically exercising the multi + worktree combination).