-
-
Notifications
You must be signed in to change notification settings - Fork 713
v4: Can now set project ref using the TRIGGER_PROJECT_REF env var #2109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 89e8c7f The changes in this PR will be included in the next version bump. 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 |
Warning Rate limit exceeded@ericallam has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 3 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughA new environment variable, ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
packages/cli-v3/src/dev/devSupervisor.ts (1)
582-590
: 🛠️ Refactor suggestionRemove unused duplicate function.
The
gatherProcessEnv
function at the bottom of the file appears to be unused after the refactoring. It's now redundant since the same functionality is provided by thegatherProcessEnv
function inenvVars.ts
.-function gatherProcessEnv() { - const $env = { - ...process.env, - NODE_ENV: "development", - }; - - // Filter out undefined values - return Object.fromEntries(Object.entries($env).filter(([key, value]) => value !== undefined)); -}
🧹 Nitpick comments (1)
packages/cli-v3/src/utilities/envVars.ts (1)
15-23
: Consider documenting the NODE_ENV override behavior.The function sets
NODE_ENV
to "development" which overrides any existing value. This might be intentional for dev environments, but consider adding a comment explaining this behavior.function gatherProcessEnv() { const $env = { ...process.env, + // Force NODE_ENV to development for dev environments NODE_ENV: "development", };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
references/d3-chat/src/trigger/chat.ts
is excluded by!references/**
references/d3-chat/trigger.config.ts
is excluded by!references/**
📒 Files selected for processing (7)
.changeset/silly-timers-repair.md
(1 hunks)packages/cli-v3/src/commands/deploy.ts
(2 hunks)packages/cli-v3/src/commands/dev.ts
(3 hunks)packages/cli-v3/src/dev/devSupervisor.ts
(2 hunks)packages/cli-v3/src/entryPoints/dev-run-controller.ts
(1 hunks)packages/cli-v3/src/entryPoints/managed/execution.ts
(1 hunks)packages/cli-v3/src/utilities/envVars.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/cli-v3/src/dev/devSupervisor.ts (1)
packages/cli-v3/src/utilities/envVars.ts (1)
resolveEnvVars
(4-13)
packages/cli-v3/src/utilities/envVars.ts (1)
packages/cli-v3/src/entryPoints/managed/env.ts (1)
gatherProcessEnv
(215-226)
packages/cli-v3/src/commands/dev.ts (1)
packages/cli-v3/src/utilities/envVars.ts (1)
resolveEnvVars
(4-13)
⏰ Context from checks skipped due to timeout of 90000ms (25)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (10, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (9, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 10)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 10)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 10)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 10)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 10)
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 10)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
- GitHub Check: typecheck / typecheck
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (12)
packages/cli-v3/src/utilities/envVars.ts (1)
4-13
: LGTM! Well-structured environment variable consolidation.The function properly consolidates environment variables from multiple sources with clear precedence: process environment < additional variables < dotenv variables. The sanitization of all sources ensures consistent handling.
.changeset/silly-timers-repair.md (1)
1-6
: LGTM! Clear and concise changeset documentation.The changeset properly documents the new
TRIGGER_PROJECT_REF
environment variable feature as a patch-level change.packages/cli-v3/src/entryPoints/dev-run-controller.ts (1)
615-615
: LGTM! Correct implementation of TRIGGER_PROJECT_REF injection.The environment variable is properly added to the TaskRunProcess environment, making the project reference available to task execution processes.
packages/cli-v3/src/dev/devSupervisor.ts (2)
28-28
: LGTM! Proper import of the new utility.The import correctly brings in the new
resolveEnvVars
utility for environment variable consolidation.
381-384
: Excellent refactoring! Simplified environment variable resolution.The refactoring successfully replaces the previous multi-step environment variable gathering and sanitization with a single call to
resolveEnvVars
, improving code maintainability and consistency.packages/cli-v3/src/entryPoints/managed/execution.ts (1)
589-592
: LGTM! Clean injection of project reference into task environment.The code correctly adds
TRIGGER_PROJECT_REF
to the environment variables for the task run process, ensuring the project reference is available during task execution. The spread operator maintains existing environment variables while explicitly setting the project reference.packages/cli-v3/src/commands/deploy.ts (3)
39-39
: Good addition of centralized environment variable utility.The import of
resolveEnvVars
promotes consistent environment variable handling across the CLI.
211-215
: Well-implemented environment variable resolution with helpful debugging.The code properly resolves environment variables from multiple sources and provides clear debug logging when
TRIGGER_PROJECT_REF
is detected, which aids in troubleshooting configuration issues.
219-219
: Excellent precedence design for project reference resolution.The fallback pattern
options.projectRef ?? envVars.TRIGGER_PROJECT_REF
correctly prioritizes explicit CLI options over environment variables, providing a sensible default mechanism while maintaining explicit control.packages/cli-v3/src/commands/dev.ts (3)
4-9
: Good import cleanup and consistent utility usage.The removal of unused imports (
SkipLoggingError
,BundleError
) and addition ofresolveEnvVars
improves code maintainability and follows the same pattern established in the deploy command.
131-135
: Consistent environment variable resolution pattern.The implementation mirrors the deploy command's approach, ensuring uniform behavior across CLI commands. The debug logging when
TRIGGER_PROJECT_REF
is found maintains consistency with other commands.
149-149
: Proper fallback mechanism implementation.The same precedence pattern as the deploy command (
options.projectRef ?? envVars.TRIGGER_PROJECT_REF
) ensures consistent project reference resolution across all CLI commands.
…ENV into the dev supervisor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/cli-v3/src/utilities/localEnvVars.ts (1)
4-16
: Add documentation and consider explicit return type.The function logic is sound, but could benefit from improved documentation and type safety.
+/** + * Resolves environment variables from multiple sources with the following precedence: + * 1. dotenv file (highest priority) + * 2. additional variables (medium priority) + * 3. process environment (lowest priority) + */ -export function resolveLocalEnvVars( +export function resolveLocalEnvVars( envFile?: string, additionalVariables?: Record<string, string> -) { +): Record<string, string> { const processEnv = gatherProcessEnv(); const dotEnvVars = resolveDotEnvVars(undefined, envFile); return { ...sanitizeEnvVars(processEnv), ...sanitizeEnvVars(additionalVariables ?? {}), ...sanitizeEnvVars(dotEnvVars), }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/cli-v3/src/commands/deploy.ts
(2 hunks)packages/cli-v3/src/commands/dev.ts
(3 hunks)packages/cli-v3/src/dev/devSupervisor.ts
(2 hunks)packages/cli-v3/src/utilities/localEnvVars.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/cli-v3/src/commands/dev.ts
- packages/cli-v3/src/commands/deploy.ts
- packages/cli-v3/src/dev/devSupervisor.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/cli-v3/src/utilities/localEnvVars.ts (1)
packages/cli-v3/src/entryPoints/managed/env.ts (1)
gatherProcessEnv
(215-226)
⏰ Context from checks skipped due to timeout of 90000ms (25)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (10, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (9, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 10)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 10)
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
- GitHub Check: typecheck / typecheck
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/cli-v3/src/utilities/localEnvVars.ts (1)
1-2
: LGTM! Clean imports.The imports are well-organized and properly reference the existing utilities for dotenv resolution and environment variable sanitization.
No description provided.