chore(e2e): pin anthropic for api e2e, servers, and ci#143
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Warning Rate limit exceeded
⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThe changes standardize end-to-end test infrastructure to use Anthropic as the exclusive AI provider. Environment variables are updated in CI workflows and scripts to set Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
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 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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/api/scripts/run-e2e-local.mjs (1)
78-82: Mirror the existing JWT fail-fast pattern forANTHROPIC_API_KEY.This script forces Anthropic, so validating the key up front will make local E2E failures deterministic and easier to diagnose.
Suggested guard clause
const env = { ...process.env, ...loaded, ALLOW_TEST: 'true', PGLITE: 'true', NODE_ENV: 'test', JWT_SECRET: jwtSecret, AI_PROVIDER: 'anthropic', } delete env.OPEN_ROUTER_API_KEY delete env.OLLAMA_BASE_URL delete env.AI_DEFAULT_MODEL + if (!env.ANTHROPIC_API_KEY) { + process.stderr.write( + 'E2E local: ANTHROPIC_API_KEY is required when AI_PROVIDER=anthropic.\n', + ) + process.exit(1) + }As per coding guidelines, "Favor fail-fast/guard clauses and keep success path at top indentation if refactoring logic around env construction/filters."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/api/scripts/run-e2e-local.mjs` around lines 78 - 82, Add a fail-fast guard that validates process.env.ANTHROPIC_API_KEY (same pattern used for the JWT check) before continuing: if the env var is missing or empty, log a clear error and exit non‑zero (e.g., console.error(...) and process.exit(1)). Place this check near the other env deletions/assignments so the script fails deterministically upfront and refer to the same env object/symbol (env / ANTHROPIC_API_KEY) and use the same exit/logging approach as the existing JWT guard.apps/web/scripts/start-e2e-servers.mjs (1)
22-26: Add a startup guard forANTHROPIC_API_KEYwhen forcing Anthropic.Since this entrypoint hard-pins provider selection, fail fast if the key is missing to avoid opaque downstream failures.
Suggested guard clause
const env = { ...process.env, ALLOW_TEST: 'true', PGLITE: 'true', NODE_ENV: 'test', NEXT_PUBLIC_API_URL: 'http://localhost:3001', AI_PROVIDER: 'anthropic', } delete env.OPEN_ROUTER_API_KEY delete env.OLLAMA_BASE_URL delete env.AI_DEFAULT_MODEL +if (!env.ANTHROPIC_API_KEY) { + process.stderr.write( + 'start-e2e-servers: ANTHROPIC_API_KEY is required when AI_PROVIDER=anthropic\n', + ) + process.exit(1) +}As per coding guidelines, "Favor fail-fast/guard clauses and keep success path at top indentation if refactoring logic around env construction/filters."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/scripts/start-e2e-servers.mjs` around lines 22 - 26, Add a fail-fast guard that checks for env.ANTHROPIC_API_KEY immediately after forcing AI_PROVIDER: 'anthropic' (before the deletes of OPEN_ROUTER_API_KEY/OLLAMA_BASE_URL/AI_DEFAULT_MODEL): if env.AI_PROVIDER === 'anthropic' and env.ANTHROPIC_API_KEY is missing/empty, log a clear error (e.g., console.error or processLogger.error) and terminate the process (throw or process.exit(1)) so startup fails fast with an explicit message.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/api-e2e.yml:
- Around line 26-27: Add a hard-fail guard to the CI workflow so that when
AI_PROVIDER is set to "anthropic" the job immediately errors if
ANTHROPIC_API_KEY is empty or unset: add a pre-step (before tests) that checks
the environment variables AI_PROVIDER and ANTHROPIC_API_KEY and exits non-zero
with a clear error message when AI_PROVIDER == "anthropic" and ANTHROPIC_API_KEY
is empty; reference the workflow env names AI_PROVIDER and ANTHROPIC_API_KEY
(and the job step that runs E2E) so the check runs before any API E2E execution
to enforce the non-empty secret requirement.
In @.github/workflows/web-e2e.yml:
- Around line 30-31: Add a fail-fast CI check before e2e tests that verifies the
ANTHROPIC_API_KEY secret when AI_PROVIDER is set to "anthropic": insert a
workflow step that reads the AI_PROVIDER and ANTHROPIC_API_KEY environment
variables (the symbols AI_PROVIDER and ANTHROPIC_API_KEY from the current job's
env) and exits non‑zero with a clear error if AI_PROVIDER == "anthropic" and
ANTHROPIC_API_KEY is empty or unset so the run fails fast instead of proceeding
with skip paths.
---
Nitpick comments:
In `@apps/api/scripts/run-e2e-local.mjs`:
- Around line 78-82: Add a fail-fast guard that validates
process.env.ANTHROPIC_API_KEY (same pattern used for the JWT check) before
continuing: if the env var is missing or empty, log a clear error and exit
non‑zero (e.g., console.error(...) and process.exit(1)). Place this check near
the other env deletions/assignments so the script fails deterministically
upfront and refer to the same env object/symbol (env / ANTHROPIC_API_KEY) and
use the same exit/logging approach as the existing JWT guard.
In `@apps/web/scripts/start-e2e-servers.mjs`:
- Around line 22-26: Add a fail-fast guard that checks for env.ANTHROPIC_API_KEY
immediately after forcing AI_PROVIDER: 'anthropic' (before the deletes of
OPEN_ROUTER_API_KEY/OLLAMA_BASE_URL/AI_DEFAULT_MODEL): if env.AI_PROVIDER ===
'anthropic' and env.ANTHROPIC_API_KEY is missing/empty, log a clear error (e.g.,
console.error or processLogger.error) and terminate the process (throw or
process.exit(1)) so startup fails fast with an explicit message.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bc5ea1ae-59b6-4475-ac38-fe2481ac7dc6
⛔ Files ignored due to path filters (1)
apps/api/.env.test.exampleis excluded by!**/.env*
📒 Files selected for processing (6)
.github/workflows/api-e2e.yml.github/workflows/web-e2e.ymlapps/api/scripts/run-e2e-local.mjsapps/docu/content/docs/testing/frontend-testing.mdxapps/web/e2e/chat-assistant.spec.tsapps/web/scripts/start-e2e-servers.mjs
Summary by CodeRabbit
Release Notes
Chores
Documentation