Repository navigation
fix(cli): resolve workspaceDir and origin remoteUrl via git in worktrees - #5105
princejain756 wants to merge 1 commit into
Conversation
|
|
Hi @princejain756, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed.
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
| const tsconfigPath = await safeResolveTsConfig(cwd); | ||
| const lockfilePath = await resolveLockfile(cwd); | ||
| const workspaceDir = await findWorkspaceDir(cwd); | ||
| const workspaceDir = (await getGitTopLevel(cwd)) ?? (await findWorkspaceDir(cwd)); |
There was a problem hiding this comment.
🟡 Worktree fix absent from release notes
workspaceDir changes deployment behavior in linked worktrees, but this public CLI fix has no changeset. Customers cannot find the fix in release notes.
Learn more
This public CLI fix changes whether users can deploy from linked worktrees. The repository requires a patch changeset for user-facing bug fixes in public packages; none was added here. Without it, the release notes omit the fix.
Example: A user blocked from deploying in a nested worktree upgrades trigger.dev. The upgrade fixes their deployment, but the published changelog does not tell them about it.
Recommended fix: Add a patch changeset for trigger.dev describing the restored ability to deploy from linked Git worktrees in user-facing language.
Was this helpful? React with 👍 or 👎 to provide feedback.
| vi.stubEnv("GITHUB_ACTIONS", ""); | ||
| vi.stubEnv("TRIGGER_GITHUB_APP", ""); |
There was a problem hiding this comment.
🟡 Worktree tests stub CI state
Both new worktree tests use vi.stubEnv to disable CI detection. Repository testing rules ban stubs, so these tests violate the required test policy.
Learn more
The worktree integration tests mutate process-wide CI variables with vi.stubEnv, and the new cleanup calls vi.unstubAllEnvs. The repository's testing instructions explicitly prohibit stubs, even though the tests exercise real Git repositories.
Example: In a GitHub Actions run, the first worktree test replaces GITHUB_ACTIONS with an empty value before calling createGitMeta. It tests the local Git path by stubbing CI detection.
Recommended fix: Make the local Git metadata path testable without stubbing process environment, such as by passing an explicit environment or metadata source to the relevant function and using that option in both tests.
Was this helpful? React with 👍 or 👎 to provide feedback.
| const gitConfig = await parseGitConfig(configPath); | ||
| async function getOriginUrl(directory: string): Promise<string | null> { | ||
| try { | ||
| const result = await x("git", ["--no-optional-locks", "config", "--get", "remote.origin.url"], { |
There was a problem hiding this comment.
| return undefined; | ||
| } | ||
|
|
||
| return resolve(directory, cdup || "."); |
There was a problem hiding this comment.
🟥 Symlinked projects upload outside files
For a symlink to a repository subdirectory, getGitTopLevel computes the wrong workspaceDir from Git's physical cdup. createContextArchive can then upload unrelated files, including secrets.
Was this helpful? React with 👍 or 👎 to provide feedback.
| const tsconfigPath = await safeResolveTsConfig(cwd); | ||
| const lockfilePath = await resolveLockfile(cwd); | ||
| const workspaceDir = await findWorkspaceDir(cwd); | ||
| const workspaceDir = (await getGitTopLevel(cwd)) ?? (await findWorkspaceDir(cwd)); |
There was a problem hiding this comment.
🟥 Nested workspace secrets enter deployment archives
For a nested workspace, workspaceDir now points to the outer Git root. createContextArchive skips the nested .gitignore and can upload secrets it excludes.
Was this helpful? React with 👍 or 👎 to provide feedback.
Fixes #5103
In a linked git worktree,
.gitis a file (gitdir: /path/to/repo/.git/worktrees/<name>) rather than a directory, andremote.origin.urllives in the common repo config instead of the worktree dir. Because of that,createGitMetafailed to readoriginandresolveWorkspaceDirwalked past the worktree root up to whatever parent directory happened to have a.gitfolder orpackage.json.Updated
resolveWorkspaceDirto checkgit rev-parsefirst andresolveOriginUrlto fall back togit configwhen.git/configisn't a regular file in the worktree root. Added worktree tests ingitMeta.test.tsandconfig.test.ts.