fix(ide): only error on missing telemetry token in CI#2507
Conversation
In local development, the post-build script now warns and exits cleanly instead of failing when VSCODE_TELEMETRY_TRACKING_TOKEN is not set. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @ymc9's task —— View job Code Review Complete ✅I've analyzed the changes in Todo List:
Code Quality & Best Practices ✅The code is clean, readable, and follows good practices:
Potential Bugs/Issues ✅No significant bugs detected. The implementation correctly:
Performance Considerations ✅Excellent performance improvement:
Security Concerns
|
📝 WalkthroughWalkthroughThe post-build script's error handling for a missing telemetry token is now conditional on the CI environment. In CI environments, it fails with an error as before. Outside CI, it logs a warning, skips token injection, and exits successfully. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ide/vscode/scripts/post-build.ts (1)
9-9: Normalize CI parsing instead of relying on string truthiness.Line 9 uses
if (process.env.CI), which treats string values like"false"as truthy. While most CI systems setCI=true, this is fragile and could incorrectly trigger the error path ifCIis explicitly set to any non-empty value.Proposed fix
+const isCi = ['1', 'true'].includes((process.env.CI ?? '').toLowerCase()); if (!telemetryToken) { - if (process.env.CI) { + if (isCi) { console.error('Error: VSCODE_TELEMETRY_TRACKING_TOKEN environment variable is not set'); process.exit(1); } else { console.warn('Warning: VSCODE_TELEMETRY_TRACKING_TOKEN environment variable is not set, skipping token injection'); process.exit(0); } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ide/vscode/scripts/post-build.ts` at line 9, Replace the current truthiness check on process.env.CI with a normalized boolean parse: create a local flag (e.g., isCI) by lowercasing process.env.CI and checking against explicit true-like values ("1", "true", "yes") and then use that flag in the existing if (process.env.CI) conditional; update the conditional to if (isCI) so values like "false" or empty strings don’t mistakenly evaluate as true while preserving CI detection logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/ide/vscode/scripts/post-build.ts`:
- Line 9: Replace the current truthiness check on process.env.CI with a
normalized boolean parse: create a local flag (e.g., isCI) by lowercasing
process.env.CI and checking against explicit true-like values ("1", "true",
"yes") and then use that flag in the existing if (process.env.CI) conditional;
update the conditional to if (isCI) so values like "false" or empty strings
don’t mistakenly evaluate as true while preserving CI detection logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 070bc687-cfa6-4ea3-9b77-a84998109e64
📒 Files selected for processing (1)
packages/ide/vscode/scripts/post-build.ts
Summary
VSCODE_TELEMETRY_TRACKING_TOKENwhen running in CI (process.env.CI)Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit