Skip to content

Conversation

@N2D4
Copy link
Contributor

@N2D4 N2D4 commented Dec 12, 2025


Note

Switches E2E tests from OTP sign-in to fastSignUp for faster setup, updates backend helpers and expectations, adjusts test logic/snapshots, and limits setup wizard test to CI.

  • E2E Tests:
    • Replace Auth.Otp.signIn() with Auth.fastSignUp() across backend tests (integrations, internal APIs, teams, users, payments, projects, data-vault, etc.).
    • Update snapshots and expectations to reflect fastSignUp user state (e.g., auth flags, emails, IDs, responses).
    • Adjust test flows to set/switch user context via tokens instead of mailboxes; minor logic tweaks (e.g., permissions, team ops, transfer checks).
  • Test Helpers (apps/e2e/tests/backend/backend-helpers.ts):
    • Add Auth.fastSignUp() (creates user + session) and related token validation utilities.
    • Strengthen User.create response assertions (check status and returned id).
    • Expose additional project key utilities and refine helper behaviors used by tests.
  • Setup Wizard:
    • Run setup wizard test only in CI (it.runIf(!!process.env.CI)); placeholder not implemented.

Written by Cursor Bugbot for commit ff77394. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Tests
    • Optimized end-to-end test suite authentication flow for faster test execution across integration and API tests.
    • Enhanced test assertion validation for improved response structure verification.
    • Streamlined test setup procedures for internal and custom integration endpoints.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 12, 2025 23:02
@cmux-agent
Copy link

cmux-agent bot commented Dec 12, 2025

Preview Screenshots

Open Diff Heatmap

Preview screenshots are being captured...

Workspace and dev browser links will appear here once the preview environment is ready.


Generated by cmux preview system

@vercel
Copy link

vercel bot commented Dec 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
stack-backend Ready Ready Preview, Comment Dec 12, 2025 11:02pm
stack-dashboard Ready Ready Preview, Comment Dec 12, 2025 11:02pm
stack-demo Ready Ready Preview, Comment Dec 12, 2025 11:02pm
stack-docs Ready Ready Preview, Comment Dec 12, 2025 11:02pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

This PR systematically refactors authentication setup across 40+ e2e test files, replacing OTP-based sign-in (Auth.Otp.signIn) with fast signup (Auth.fastSignUp) and removing magic-link-enabled project configurations. Some tests transition from mailbox-based to token-based authentication context. One backend helper assertion is updated to use structural matching.

Changes

Cohort / File(s) Summary
Backend Helpers Assertion
apps/e2e/tests/backend/backend-helpers.ts
Updated post-call assertion for User.create to use toMatchObject, verifying response has status 201 with an id field of type string, rather than only checking status code.
Data Vault & Custom Integration Tests
apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts, apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/*
Replaced Auth.Otp.signIn() with Auth.fastSignUp() across all tests; control flow and logic remain unchanged aside from authentication method.
Neon Integration Tests
apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/*
Replaced all occurrences of Auth.Otp.signIn() with Auth.fastSignUp(); test logic, token retrieval, and API calls remain intact.
Internal API Endpoint Tests
apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts, apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts, apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
Replaced Auth.Otp.signIn() with Auth.fastSignUp(); no other logic or control flow changes.
Internal Projects Tests
apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
Introduced InternalProjectKeys symbol from backend-helpers; added backendContext.set calls to configure backend context; replaced Auth.Otp.signIn() with Auth.fastSignUp().
Internal Projects Transfer Tests
apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
Replaced OTP sign-in with fast signup; refactored from mailbox-based to token-based authentication context; now captures and uses accessToken and refreshToken via backendContext.set({ userAuth }).
Payment Tests
apps/e2e/tests/backend/endpoints/api/v1/payments/*.test.ts
Replaced all occurrences of Auth.Otp.signIn() with Auth.fastSignUp() across payment endpoint tests; test expectations and API interactions unchanged.
OAuth & Provider Tests
apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts, apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
Replaced Auth.Otp.signIn() with Auth.fastSignUp(); some tests also removed magic_link_enabled project configurations.
Project & Team Tests
apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts, apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts, apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
Replaced Auth.Otp.signIn() with Auth.fastSignUp(); removed Project.createAndSwitch({ config: { magic_link_enabled: true } }) in favor of simpler Project.createAndSwitch() calls.
Team Member & Membership Tests
apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts, apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
Replaced OTP-based sign-in with fastSignUp; imported User module; transitioned from mailbox-based restoration to userAuth-based context restoration; updated snapshot expectations to reflect new user state.
User & Invitation Tests
apps/e2e/tests/backend/endpoints/api/v1/users.test.ts, apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts, apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
Replaced Auth.Otp.signIn() with Auth.fastSignUp(); removed bumpEmailAddress() calls; removed magic_link_enabled project configuration.
General Setup Tests
apps/e2e/tests/general/setup-wizard.test.ts
Added CI gating to test execution (it.runIf(!!process.env.CI)) and added early "Not implemented" error throw.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~45 minutes

  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts — Introduces new InternalProjectKeys symbol and backendContext.set patterns; requires verification of context configuration flow
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts — Significant refactoring from mailbox-based to token-based authentication context; verify token usage and context restoration patterns
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts — New User module import and userAuth caching patterns; confirm userAuth restoration logic
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts — Multiple snapshot updates and assertion changes; validate updated test expectations align with fastSignUp behavior
  • apps/e2e/tests/backend/backend-helpers.ts — Assertion logic change from status-only to structural matching; ensure validation captures all required response shape

Possibly related PRs

Poem

🐰 A whisker-twitch, a hop, a bound,
Fast signup speeds us 'round and 'round,
No OTP delays to slow our pace,
Tests now sprint through auth's new race!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main objective of the pull request - replacing slower OTP sign-in with faster signup methods across E2E tests to improve test performance.
Description check ✅ Passed The PR description includes a comprehensive Cursor-generated summary with specific details about changes to test files, helper functions, and test logic updates, providing good context for reviewers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch faster-tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes test execution speed by replacing the slower OTP-based authentication flow (Auth.Otp.signIn()) with a faster direct user creation and session setup approach (Auth.fastSignUp()). This eliminates the need for magic link email verification in tests.

Key changes:

  • Migrated from Auth.Otp.signIn() to Auth.fastSignUp() across all e2e tests
  • Removed unnecessary magic_link_enabled: true configuration flags from test project setups
  • Simplified user creation by eliminating redundant bumpEmailAddress() calls since fastSignUp() creates unique users automatically

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
apps/e2e/tests/general/setup-wizard.test.ts Conditionally runs test only in CI environments
apps/e2e/tests/backend/endpoints/api/v1/users.test.ts Replaces OTP sign-in with fast signup; removes magic_link config
apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts Updates auth method and fixes test name for deletion permission test
apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts Migrates to fast signup authentication
apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts Updates auth and adjusts snapshots for users without email auth
apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts Changes from mailbox-based to userAuth-based context switching
apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts Migrates to fast signup with email parameters for invitation tests
apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts Updates all project tests to use fast signup
apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts Migrates permission tests to fast signup
apps/e2e/tests/backend/endpoints/api/v1/payments/*.test.ts Updates payment-related tests to fast signup
apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts Migrates OAuth provider tests to fast signup
apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts Updates notification preference tests
apps/e2e/tests/backend/endpoints/api/v1/internal/*.test.ts Updates internal API tests with proper context switching
apps/e2e/tests/backend/endpoints/api/v1/integrations/**/*.test.ts Migrates integration tests to fast signup
apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts Updates data vault tests
apps/e2e/tests/backend/backend-helpers.ts Enhances User.create() response validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

it("completes successfully", async ({ expect }) => {
// note that we run this only in CI environments
it.runIf(!!process.env.CI)("completes successfully", async ({ expect }) => {
throw new Error("Not implemented");
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is being skipped in non-CI environments but has a throw new Error("Not implemented") statement that will always execute when the test runs in CI. This will cause the test to fail in CI environments. If the test is not yet implemented, it should be marked with it.todo() instead, or the throw statement should be removed if the test body below it is the actual implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +316 to 317
const { userId: user2Id } = await Auth.fastSignUp();

Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable user2Id.

Suggested change
const { userId: user2Id } = await Auth.fastSignUp();

Copilot uses AI. Check for mistakes.

backendContext.set({ mailbox: createMailbox() });
const user2 = await Auth.Otp.signIn();
const user2 = await Auth.fastSignUp();
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable user2.

Suggested change
const user2 = await Auth.fastSignUp();
await Auth.fastSignUp();

Copilot uses AI. Check for mistakes.

it("lets users be on multiple teams", async ({ expect }) => {
const { userId: creatorUserId } = await Auth.Otp.signIn();
const { userId: creatorUserId } = await Auth.fastSignUp();
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable creatorUserId.

Suggested change
const { userId: creatorUserId } = await Auth.fastSignUp();
await Auth.fastSignUp();

Copilot uses AI. Check for mistakes.
it("completes successfully", async ({ expect }) => {
// note that we run this only in CI environments
it.runIf(!!process.env.CI)("completes successfully", async ({ expect }) => {
throw new Error("Not implemented");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Test always fails due to unconditional throw statement

The test has a throw new Error("Not implemented") statement at the beginning of its body that causes the test to always fail in CI environments. This appears to be accidentally committed debug/WIP code since the test is supposed to verify that the setup wizard "completes successfully" but will unconditionally throw before executing any test logic.

Fix in Cursor Fix in Web


backendContext.set({ mailbox: mailboxB });
await Auth.Otp.signIn();
await Auth.fastSignUp();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing email parameter when accepting team invitation

The Auth.fastSignUp() call is missing the email parameter. The test sends a team invitation to mailboxB.emailAddress (line 357) but then creates a user without that email. The original Auth.Otp.signIn() would use the mailbox email from the backend context, and similar tests in team-invitations.test.ts correctly pass { primary_email: mailboxB.emailAddress, primary_email_verified: true } to fastSignUp() when accepting invitations. This inconsistency may cause the test to fail if invitation acceptance validates that the user's email matches the invited email.

Fix in Cursor Fix in Web

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
apps/e2e/tests/general/setup-wizard.test.ts (1)

9-14: Remove unreachable code.

Lines 9-14 are unreachable due to the throw on line 8. If the test is truly disabled, remove the dead code. If the test should be active, remove the throw on line 8 instead.

Apply this diff if the test is permanently/temporarily disabled:

-    const [error, stdout, stderr] = await new Promise<[Error | null, string, string]>((resolve) => {
-      exec("pnpm -C packages/init-stack run test-run", (error, stdout, stderr) => {
-        resolve([error, stdout, stderr]);
-      });
-    });
-    expect(error, `Expected no error to be thrown!\n\n\n\nstdout: ${stdout}\n\n\n\nstderr: ${stderr}`).toBeNull();
apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts (1)

91-91: Remove magic_link_enabled: true to align with PR objective.

The PR aims to remove magic-link-enabled configurations for test speedup. This test doesn't validate magic link functionality—it focuses on permission creation and granting. The flag should be removed.

Apply this diff:

-  const { adminAccessToken } = await Project.createAndGetAdminToken({ config: { magic_link_enabled: true } });
+  const { adminAccessToken } = await Project.createAndGetAdminToken();
apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts (1)

493-503: Guard against code extraction returning undefined (flaky wrong-error failure)

If the regex match fails, you’ll send code: undefined and likely get a schema/validation error instead of ITEM_QUANTITY_INSUFFICIENT_AMOUNT. Add a precondition assertion.

   backendContext.set({ mailbox: mailboxB });
   await Auth.fastSignUp({ primary_email: mailboxB.emailAddress, primary_email_verified: true });

   const invitationMessages = await mailboxB.waitForMessagesWithSubject("join");
+  const code =
+    invitationMessages
+      .findLast((m) => m.subject.includes("join"))
+      ?.body?.text
+      .match(/http:\/\/localhost:12345\/some-callback-url\?code=([a-zA-Z0-9]+)/)
+      ?.[1];
+  expect(code).toBeTruthy();

   const acceptResponse = await niceBackendFetch("/api/v1/team-invitations/accept", {
     method: "POST",
     accessType: "client",
     body: {
-      code: invitationMessages.findLast((m) => m.subject.includes("join"))?.body?.text.match(/http:\/\/localhost:12345\/some-callback-url\?code=([a-zA-Z0-9]+)/)?.[1],
+      code,
     },
   });
apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts (1)

100-109: Test name mismatch: “invalid customer_id” vs actual assertion (“customer type mismatch”).

This test asserts PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH (team vs user product), not an invalid customer_id. Consider renaming the test to reflect what it’s actually validating (or change the request to truly represent an invalid customer_id scenario).

apps/e2e/tests/backend/endpoints/api/v1/users.test.ts (1)

520-531: Remove unused secret local in the “valid base64” test.
It’s currently dead code.

 it("should be able to update totp_secret_base64 to valid base64", async ({ expect }) => {
   await Auth.fastSignUp();
-  const secret = generateSecureRandomString(32);
   const response = await niceBackendFetch("/api/v1/users/me", {
     accessType: "client",
     method: "PATCH",
     body: {
       totp_secret_base64: "ZXhhbXBsZSB2YWx1ZQ==",
     },
   });
   expect(response.status).toEqual(200);
 });
apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts (1)

303-330: Multi-user flow likely depends on Auth.fastSignUp() switching the active auth context—make that dependency explicit (or document it).

Right now team2 creation occurs after signing up user2, but you don’t explicitly set backendContext.userAuth to user2. If fastSignUp() ever stops switching context, team2 may be created as user1 and weaken the “not a member” assertion.

One option is to capture user2 tokens + set context before creating team2:

-    const { userId: user2Id } = await Auth.fastSignUp();
+    const { userId: user2Id, accessToken: user2AccessToken, refreshToken: user2RefreshToken } = await Auth.fastSignUp();
+    backendContext.set({ userAuth: { accessToken: user2AccessToken, refreshToken: user2RefreshToken } });

(or add a short comment that fastSignUp() switches backendContext.userAuth as a contract).

🧹 Nitpick comments (10)
apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts (1)

55-58: Consider consolidating repeated signup setup (if isolation permits)

Doing await Auth.fastSignUp(); in each test is fine for isolation, but if fastSignUp is expensive and safe to share, consider a beforeEach/beforeAll helper for the suite to reduce overhead.

apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts (1)

4-18: Remove unnecessary magic_link_enabled: true from project configuration.

Since Auth.fastSignUp() doesn't depend on or use magic_link_enabled, this configuration flag can be removed from the createAndSwitchToOAuthEnabledProject() helper function to keep test setup minimal.

apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts (1)

249-263: Permission tests look consistent after auth migration; same caution about project/session coupling

If any of these accessType: "client" calls rely on an implicit current project, consider consistently calling Project.createAndSwitch() at the top of such tests to avoid hidden dependencies.

apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts (1)

92-114: Auth.fastSignUp() swap is good; consider making the Stripe URL assertion less brittle if this ever flakes.
E.g., assert status + url origin/path prefix (instead of the full URL string).

apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts (1)

303-310: Auth.fastSignUp() usage is clean here; optionally re-check if magic_link_enabled: true is still required.

Also applies to: 440-450

apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts (1)

303-309: Auth.fastSignUp() swap looks correct; optionally confirm magic_link_enabled can be dropped for more speed.

apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts (1)

5-14: Make the fastSignUp → backendContext.userAuth dependency explicit (and store a stable copy).
This avoids “mystery” failures if Auth.fastSignUp() ever stops populating backendContext.value.userAuth.

 async function signInAndCreateTeam() {
   const { userId: userId1 } = await Auth.fastSignUp();
-  const userAuth = backendContext.value.userAuth;
+  const userAuth = backendContext.value.userAuth;
+  expect(userAuth).not.toBeNull();
+  const userAuth1 = { ...userAuth! };

   await bumpEmailAddress();
   const { userId: userId2 } = await Auth.fastSignUp();

   await bumpEmailAddress();
   const { userId: userId3 } = await Auth.fastSignUp();
@@
   // Sign back in as user 1
   backendContext.set({
-    userAuth: userAuth,
+    userAuth: userAuth1,
   });
   const currentUser = await User.getCurrent();
   expect(currentUser.id).toBe(userId1);

Also applies to: 54-60

apps/e2e/tests/backend/endpoints/api/v1/users.test.ts (1)

593-621: Avoid redundant sign-up right before clearing userAuth (saves time).
If the test only needs “no user auth”, you can skip Auth.fastSignUp() here.

 it("should not be able to read a user", async ({ expect }) => {
-  await Auth.fastSignUp();
   backendContext.set({
     userAuth: null,
   });
   const response = await niceBackendFetch("/api/v1/users/123", {
     accessType: "client",
   });
   expect(response).toMatchInlineSnapshot(`
     NiceResponse {
       "status": 401,
       "body": {
         "code": "INSUFFICIENT_ACCESS_TYPE",
         "details": {
           "actual_access_type": "client",
           "allowed_access_types": [
             "server",
             "admin",
           ],
         },
         "error": "The x-stack-access-type header must be 'server' or 'admin', but was 'client'.",
       },
       "headers": Headers {
         "x-stack-known-error": "INSUFFICIENT_ACCESS_TYPE",
         <some fields may have been hidden>,
       },
     }
   `);
 });
apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts (1)

782-796: Consider replacing fixed wait(5000) with polling for webhook delivery.
This is often a bigger win for “speed up tests” (and reduces flakiness).

apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts (1)

2-2: Context switching looks intentional; consider scoping it to avoid cross-test leakage.
If available, prefer backendContext.with({ projectKeys: ... }, async () => { ... }) over backendContext.set(...) for temporary key changes.

Also applies to: 46-67, 109-123, 400-403

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3137d2 and ff77394.

📒 Files selected for processing (33)
  • apps/e2e/tests/backend/backend-helpers.ts (1 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts (6 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts (5 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts (3 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts (6 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts (1 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts (6 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts (5 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts (3 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts (3 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts (6 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts (1 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts (2 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts (2 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts (5 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts (7 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts (3 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts (20 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts (3 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts (1 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts (4 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts (2 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts (1 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts (2 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts (7 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts (14 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts (17 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts (2 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts (26 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts (7 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts (21 hunks)
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts (16 hunks)
  • apps/e2e/tests/general/setup-wizard.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Always add new E2E tests when changing the API or SDK interface
For blocking alerts and errors, never use toast; use alerts instead as they are less easily missed by the user
NEVER try-catch-all, NEVER void a promise, and NEVER .catch(console.error); use loading indicators and async callbacks instead, or use runAsynchronously/runAsynchronouslyWithAlert for error handling
Use ES6 maps instead of records wherever you can

Files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer .toMatchInlineSnapshot over other selectors in tests when possible; check snapshot-serializer.ts for formatting details

Files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,css}: Keep hover/click transitions snappy and fast; avoid fade-in delays on hover. Apply transitions after action completion instead, like smooth fade-out when hover ends
Use hover-exit transitions instead of hover-enter transitions; for example, use 'transition-colors hover:transition-none' instead of fade-in on hover

Files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

NEVER use Next.js dynamic functions if you can avoid them; prefer using client components and hooks like usePathname instead of await params to keep pages static

Files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
{.env*,**/*.{ts,tsx,js}}

📄 CodeRabbit inference engine (AGENTS.md)

Prefix environment variables with STACK_ (or NEXT_PUBLIC_STACK_ if public) so changes are picked up by Turborepo and improves readability

Files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
apps/e2e/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Always add new E2E tests when changing API or SDK interface; err on the side of creating too many tests due to the critical nature of the industry

Files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
🧠 Learnings (5)
📚 Learning: 2025-12-04T18:03:49.984Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to apps/e2e/**/*.{ts,tsx} : Always add new E2E tests when changing API or SDK interface; err on the side of creating too many tests due to the critical nature of the industry

Applied to files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
📚 Learning: 2025-12-04T18:03:49.984Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to **/*.{ts,tsx} : Always add new E2E tests when changing the API or SDK interface

Applied to files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts
  • apps/e2e/tests/backend/backend-helpers.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts
  • apps/e2e/tests/general/setup-wizard.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/users.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/internal/payments/setup.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
📚 Learning: 2025-12-03T07:19:44.433Z
Learnt from: madster456
Repo: stack-auth/stack-auth PR: 1040
File: packages/stack-shared/src/interface/crud/oauth-providers.ts:62-87
Timestamp: 2025-12-03T07:19:44.433Z
Learning: In packages/stack-shared/src/interface/crud/oauth-providers.ts and similar CRUD files, the tag "Oauth" (not "OAuth") is the correct capitalization format as it's used by the documentation generation system and follows OpenAPI conventions.

Applied to files:

  • apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
  • apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts
📚 Learning: 2025-12-04T18:03:49.984Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Run typecheck, lint, and test to ensure changes are working. You can save time by only linting and testing changed files and related E2E tests

Applied to files:

  • apps/e2e/tests/general/setup-wizard.test.ts
📚 Learning: 2025-12-04T18:03:49.984Z
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to **/*.test.{ts,tsx} : Prefer .toMatchInlineSnapshot over other selectors in tests when possible; check snapshot-serializer.ts for formatting details

Applied to files:

  • apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts
🧬 Code graph analysis (14)
apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts (2)
packages/template/src/lib/stack-app/index.ts (1)
  • Auth (96-96)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts (2)
packages/template/src/lib/stack-app/index.ts (1)
  • Auth (96-96)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts (5)
packages/template/src/lib/stack-app/index.ts (3)
  • Auth (96-96)
  • Project (76-76)
  • Team (87-87)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
packages/template/src/lib/stack-app/projects/index.ts (1)
  • Project (9-13)
packages/template/src/lib/stack-app/teams/index.ts (1)
  • Team (36-50)
apps/e2e/tests/helpers.ts (1)
  • it (12-12)
apps/e2e/tests/backend/endpoints/api/v1/payments/purchase-session.test.ts (1)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts (1)
apps/e2e/tests/backend/backend-helpers.ts (1)
  • backendContext (35-57)
apps/e2e/tests/general/setup-wizard.test.ts (1)
apps/e2e/tests/helpers.ts (1)
  • it (12-12)
apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts (2)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
packages/template/src/lib/stack-app/projects/index.ts (1)
  • Project (9-13)
apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts (4)
packages/template/src/lib/stack-app/index.ts (1)
  • Auth (96-96)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/backend-helpers.ts (1)
  • niceBackendFetch (109-173)
apps/e2e/tests/helpers.ts (1)
  • it (12-12)
apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts (2)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/backend-helpers.ts (2)
  • backendContext (35-57)
  • InternalProjectKeys (77-82)
apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts (2)
packages/template/src/lib/stack-app/index.ts (1)
  • Auth (96-96)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts (2)
packages/template/src/lib/stack-app/index.ts (1)
  • Auth (96-96)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts (1)
apps/e2e/tests/backend/backend-helpers.ts (2)
  • backendContext (35-57)
  • bumpEmailAddress (179-187)
apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts (1)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts (4)
packages/template/src/lib/stack-app/index.ts (3)
  • Auth (96-96)
  • Team (87-87)
  • Project (76-76)
packages/template/src/lib/stack-app/users/index.ts (1)
  • Auth (71-77)
packages/template/src/lib/stack-app/teams/index.ts (1)
  • Team (36-50)
apps/e2e/tests/backend/backend-helpers.ts (1)
  • backendContext (35-57)
🪛 Biome (2.1.2)
apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts

[error] 160-160: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)

apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts

[error] 160-160: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: Agent
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: Cursor Bugbot
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: all-good
  • GitHub Check: check_prisma_migrations (22.x)
  • GitHub Check: build (22.x)
  • GitHub Check: setup-tests
  • GitHub Check: build (22.x)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: docker
  • GitHub Check: restart-dev-and-test-with-custom-base-port
  • GitHub Check: build (22.x)
🔇 Additional comments (49)
apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/current.test.ts (2)

5-7: Verify Auth.fastSignUp() provides the expected auth context for Project.createAndGetAdminToken()

If Project.createAndGetAdminToken() depends on an existing authenticated session/user, confirm Auth.fastSignUp() establishes that deterministically (and doesn’t introduce cross-test state that could make this test flaky).


112-115: Double-check user/project coupling assumptions with fast signup

This test mutates project config; verify Auth.fastSignUp() doesn’t accidentally reuse a shared user/project (or cached identity) that could cause order-dependent failures when tests run in parallel or are retried.

apps/e2e/tests/backend/endpoints/api/v1/internal/email-templates.test.ts (2)

5-9: Verify Auth.fastSignUp() actually establishes the admin/auth context needed by Project.createAndGetAdminToken().

If Project.createAndGetAdminToken() doesn’t depend on the current auth session, Auth.fastSignUp() here may be redundant; if it does, this change is correct but should be explicit in helper docs/usages to avoid future flakiness. (Based on learnings, apps/e2e tests are critical.)


48-63: No action needed — both tests properly establish admin access. Test 2's Project.createAndSwitch() automatically sets adminAccessToken in the project context, which niceBackendFetch() includes in request headers when accessType: "admin" is specified. The approaches differ by design (explicit vs. context-based), but both are correct and consistent with the test helper architecture.

apps/e2e/tests/backend/endpoints/api/v1/payments/items.test.ts (2)

340-340: LGTM! Authentication method updated to speed up tests.

The replacement of OTP-based sign-in with fastSignUp aligns with the PR objective to speed up test execution while maintaining the same test coverage.


374-374: LGTM! Consistent authentication method change.

The replacement maintains test integrity while improving execution speed. The subsequent invitation acceptance flow remains properly tested.

apps/e2e/tests/backend/endpoints/api/v1/project-permissions.test.ts (7)

5-5: LGTM: Auth flow optimized for speed.

The change from OTP-based sign-in to fastSignUp() appropriately speeds up test setup while maintaining the same authentication context needed for this test.


21-21: LGTM: Auth flow optimized for speed.

The change to fastSignUp() appropriately obtains the userId needed for testing permission grants while improving test performance.


45-46: LGTM: Test setup optimized.

The addition of Project.createAndSwitch() ensures test isolation, and the change to fastSignUp() speeds up authentication setup while maintaining necessary context for permission scope validation.


180-180: LGTM: Initial auth setup optimized.

The change to fastSignUp() speeds up the initial test setup. The subsequent use of Auth.Password.signUpWithEmail on line 253 is appropriate for testing default permission assignment to a newly created user.


279-279: LGTM: Auth flow optimized for speed.

The change to fastSignUp() appropriately obtains the userId needed for testing permission grants and webhook triggers while improving test performance.


318-318: LGTM: Auth flow optimized for speed.

The change to fastSignUp() speeds up the test setup for validating permission revocation and webhook events.


364-364: LGTM: Auth flow optimized for speed.

The change to fastSignUp() appropriately speeds up authentication setup for testing duplicate permission ID validation.

apps/e2e/tests/backend/endpoints/api/v1/payments/before-offer-to-product-rename/outdated--create-purchase-url.test.ts (3)

257-280: LGTM for server path; consider adding a minimal assertion that the URL is tied to the signed-up user only if that’s a contract.
Current assertions validate 200 + URL shape; that’s probably sufficient for this endpoint test, and fastSignUp() is a clean speedup.


100-109: Confirm Auth.fastSignUp() establishes client auth context (not just a user record).
This test’s client request expects a 400 (customer/product type mismatch). If Auth.fastSignUp() doesn’t also authenticate the client (cookies/session), this could start failing with 401/403 and mask the intended assertion.

Search in stack-auth repo docs/usage for `Auth.fastSignUp` in e2e tests: does it authenticate the session/cookies for subsequent client fetches, or only create a user?

177-199: Looks good; the test correctly validates the client-access restriction.

Using fastSignUp() to establish a session with valid tokens is correct here. The niceBackendFetch with accessType: "client" receives the access token from backendContext.userAuth (set by fastSignUp) and includes it in request headers. The "Cannot specify product_inline when calling from client" error is triggered by the backend validating the access type restriction, not by missing authentication. Note that userId is used in the request body as customer_id, so no unused variables here.

apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/projects/transfer.test.ts (6)

29-41: Auth swap looks correct for transfer confirmation flow (initiate → sign up → confirm).
This keeps the “Neon initiates” step independent while still ensuring the confirm runs under an authenticated client context.


70-73: Good: use Auth.fastSignUp() before Project.create() to avoid OTP latency.


126-138: Potential flake vector: ensure Auth.fastSignUp() produces the expected client auth context for repeated confirms.
If Auth.fastSignUp() relies on shared/global state (cookie jar) across tests, parallel runs can get noisy—worth confirming this file passes under the CI’s parallelization settings.


165-177: LGTM: auth setup moved to fast path without changing assertions/coverage.


247-259: LGTM: fast signup before confirm/check keeps the test intent unchanged.


268-287: LGTM: fast signup before confirm preserves the “already used” check semantics.

apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts (1)

367-367: LGTM! Auth method change aligns with PR objectives.

The switch from Auth.Otp.signIn() to Auth.fastSignUp() appropriately supports the "speed up tests" objective while maintaining test correctness. The test only requires a valid userId, so the authentication method doesn't affect the inline product granting functionality being tested.

apps/e2e/tests/backend/endpoints/api/v1/oauth-providers.test.ts (1)

22-22: LGTM! Systematic refactoring to speed up tests.

The replacement of Auth.Otp.signIn() with Auth.fastSignUp() across all test cases is consistent and well-executed. The change:

  • Maintains all test assertions and expected behavior
  • Properly preserves return values where needed for multi-user scenarios
  • Aligns with the PR objective to speed up test execution
  • Only modifies test infrastructure without changing the API surface being tested

Also applies to: 60-60, 104-104, 154-154, 199-199, 247-247, 298-298, 316-316, 337-337, 355-355, 374-374, 475-475, 496-496, 622-622, 694-694, 722-722, 749-749, 815-815, 935-935, 956-956

apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts (10)

26-28: Potential test coupling: Auth.fastSignUp() without an explicit project switch before client calls

This test later performs a accessType: "client" request; if Auth.fastSignUp() doesn’t guarantee an active project context, this can become order-dependent/flaky. Consider adding await Project.createAndSwitch() here (or document that fastSignUp implicitly selects a project).


60-63: Good speedup path; verify createAndAddCurrentUserWithoutMemberPermission() still targets the intended “current” user

Project.createAndSwitch() + Auth.fastSignUp() should make User.getCurrent() deterministic for the helper; this looks aligned with the PR goal.


76-79: Recipient fast-signup looks right; ensure context isolation across sign-ups

Switching to Auth.fastSignUp({ primary_email, primary_email_verified: true }) is consistent with the suite-wide migration. Just ensure backendContext/session reset is intentional since the test signs up multiple users.


133-136: Nice cleanup of “no current server user” flow; watch for backendContext leakage

Setting backendContext.set({ userAuth: null }) earlier and then signing up here is fine as long as the harness resets context per test; otherwise, add a reset at the end.


146-149: Auth.fastSignUp() swap is fine; consider explicit project setup if required by your auth helper


211-214: Multiple fastSignUp() calls: ensure the “acting user” matches the accessType: "client" request

This test intentionally ends with the “teamAdmin” user as the current session before the client GET—good. Just verify Team.addMember(teamId, teamAdmin) is truly server-privileged (i.e., not relying on whichever user is currently signed in).

Also applies to: 223-225


319-332: Good migration to fastSignUp(); keep tests deterministic re: current project


368-381: Good: inviter/admin setup is much faster; verify team membership mutations don’t depend on current session


427-441: Good coverage retained after migration; same “acting user” verification for revoke permission paths


467-471: Looks correct with InternalProjectKeys; confirm fastSignUp() respects the set project keys

apps/e2e/tests/backend/endpoints/api/v1/internal/api-keys.test.ts (1)

59-59: Approved. Authentication method updated for faster test execution.

The replacement of Auth.Otp.signUp() with Auth.fastSignUp() aligns with the PR's goal to speed up tests. Both tests verify admin operations using accessType: "admin" in subsequent fetch calls, which combine the user authentication context established by fastSignUp() with admin credentials from the internal project keys.

⛔ Skipped due to learnings
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to apps/e2e/**/*.{ts,tsx} : Always add new E2E tests when changing API or SDK interface; err on the side of creating too many tests due to the critical nature of the industry
Learnt from: CR
Repo: stack-auth/stack-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-04T18:03:49.984Z
Learning: Applies to **/*.{ts,tsx} : Always add new E2E tests when changing the API or SDK interface
apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth-providers.test.ts (1)

6-6: LGTM! Auth.fastSignUp() provides equivalent authentication context for these tests.

The migration from Auth.Otp.signIn() to Auth.fastSignUp() is clean and consistent across all test cases. Both methods create a user account and retrieve an admin token via the same getAdminToken() call, producing functionally equivalent tokens. The OAuth provider tests don't depend on email verification state, so skipping the OTP flow has no impact on test validity. This change safely accelerates test execution while preserving test functionality.

apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/oauth.test.ts (1)

154-154: LGTM! OAuth flow tests work correctly with fast signup.

The auth method migration is safe for OAuth integration tests. Each test properly isolates the OAuth flow with independent project creation, and the authorization code exchanges validate correctly with proper token generation.

apps/e2e/tests/backend/endpoints/api/v1/payments/create-purchase-url.test.ts (1)

173-199: Auth.fastSignUp() usage looks consistent with needing an authenticated client context.

Capturing { userId } from fastSignUp() and using it as customer_id is coherent and keeps the tests deterministic.

Also applies to: 253-280, 282-365

apps/e2e/tests/backend/backend-helpers.ts (1)

1352-1367: Improved User.create() assertion (status + structural body check).

Checking 201 plus { id: string } is a good balance: stricter than status-only, while still tolerant of additional response fields.

apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/projects/transfer.test.ts (1)

29-41: Auth.fastSignUp() placement is consistent with requiring accessType: "client" auth for confirm/check paths.

Given these endpoints are called with accessType: "client" and rely on me/current-user semantics, setting user auth via fastSignUp() here makes sense.

Also applies to: 70-73, 126-138, 165-168, 247-255, 268-276

apps/e2e/tests/backend/endpoints/api/v1/notification-preferences.test.ts (1)

33-35: Auth.fastSignUp() before me preference endpoints is appropriate.

This keeps the tests fast (no mailbox polling) and preserves behavior for authenticated “me” routes.

Also applies to: 55-57, 89-91

apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/api-keys.test.ts (1)

57-66: Auth.fastSignUp() swap looks fine for establishing authenticated context before admin calls.

apps/e2e/tests/backend/endpoints/api/v1/team-member-profiles.test.ts (1)

3-3: Importing User for token-based “current user” verification makes sense.

apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts (1)

154-154: Auth.fastSignUp migration looks consistent with the test intent (and should speed up).

Also applies to: 161-161, 193-193, 247-247

apps/e2e/tests/backend/endpoints/api/v1/team-permissions.test.ts (1)

4-7: Auth.fastSignUp + simplified project setup updates look correct for these permission tests.

Also applies to: 21-24, 46-50, 197-200, 271-276, 316-321, 360-363

apps/e2e/tests/backend/endpoints/api/v1/users.test.ts (1)

206-246: Auth.fastSignUp swaps look consistent with the surrounding assertions.

Also applies to: 336-368, 370-410, 533-745, 746-780, 873-956, 2097-2129

apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts (1)

5-15: Auth.fastSignUp + simplified project setup changes look correct across these team endpoint tests.

Also applies to: 17-28, 30-56, 58-85, 86-115, 117-136, 138-176, 178-237, 239-277, 279-319, 321-353, 355-387, 389-423, 425-468, 470-503, 505-558, 560-605, 606-632, 634-668, 669-698

apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts (1)

6-35: fastSignUp migration + updated snapshots look coherent for membership scenarios.

Also applies to: 37-195, 197-367, 455-525, 527-580, 583-618, 621-663, 664-699, 701-837

apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts (1)

112-119: Good: explicit user switching via backendContext.set({ userAuth }) keeps the intent clear.

Also applies to: 183-184

Comment on lines 40 to 43
it("can store and retrieve values from data vault", async ({ expect }: { expect: any }) => {
await createDataVaultEnabledProject();
await Auth.Otp.signIn();
await Auth.fastSignUp();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Likely unnecessary Auth.fastSignUp() for accessType: "server" data-vault tests (adds cost).

In this same file, the “requires authentication” test does not sign in yet still expects 200 for accessType: "server" calls—so adding fastSignUp() in other tests appears redundant and slows the suite.

Consider removing the added sign-ins:

   await createDataVaultEnabledProject();
-  await Auth.fastSignUp();

Also applies to: 79-82, 134-137, 168-171, 281-284, 337-340

🤖 Prompt for AI Agents
In apps/e2e/tests/backend/endpoints/api/v1/data-vault.test.ts around lines 40-43
(and similarly at 79-82, 134-137, 168-171, 281-284, 337-340), the tests call
Auth.fastSignUp() unnecessarily for data-vault scenarios using accessType:
"server" (which do not require authentication and add test cost); remove the
Auth.fastSignUp() calls from those test setups and any redundant sign-in
assertions so the tests rely on server-access behavior only, keeping other
authentication-dependent tests intact.

Comment on lines 4 to 6
it("list domains", async ({ expect }) => {
await Auth.Otp.signIn();
await Auth.fastSignUp();
const { adminAccessToken } = await Project.createAndGetAdminToken();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid redundant Auth.fastSignUp() before Project.createAndGetAdminToken() (double signup).

Same pattern as other files: Project.createAndGetAdminToken() already signs up by default, so the added Auth.fastSignUp() likely slows tests.

Also applies to: 25-27, 47-49, 98-100, 129-131

🤖 Prompt for AI Agents
In apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/domain.test.ts
around lines 4-6 (and similarly at 25-27, 47-49, 98-100, 129-131), the test is
calling Auth.fastSignUp() before Project.createAndGetAdminToken(), causing a
redundant double signup; remove the initial Auth.fastSignUp() calls so each test
relies solely on Project.createAndGetAdminToken() (which performs signup by
default), leaving the subsequent lines that use the returned adminAccessToken
unchanged.

Comment on lines 153 to 158
it(`should redirect to the correct callback URL`, async ({}) => {
await Auth.Otp.signIn();
await Auth.fastSignUp();
const createdProject = await Project.create();

await authorize(createdProject.projectId);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix Biome lint error: remove the empty object pattern in it callbacks.
async ({}) => should be async () => (also applies to the earlier test at Line 153), otherwise CI will fail with lint/correctness/noEmptyPattern.

-it(`should redirect to the correct callback URL`, async ({}) => {
+it(`should redirect to the correct callback URL`, async () => {
   await Auth.fastSignUp();
   const createdProject = await Project.create();

   await authorize(createdProject.projectId);
 });

-it(`should not redirect to the incorrect callback URL`, async ({}) => {
+it(`should not redirect to the incorrect callback URL`, async () => {
   await Auth.fastSignUp();
   await Project.create();

   const result = await authorizePart1("http://localhost:30000/api/v2/wrong-url/authorize");
   expect(result).toMatchInlineSnapshot(`
     {
       "cookies": "",
       "responses": [
         NiceResponse {
           "status": 307,
           "headers": Headers {
             "location": "http://localhost:<$NEXT_PUBLIC_STACK_PORT_PREFIX>02/api/v1/integrations/custom/oauth/idp/auth?response_type=code&client_id=custom-local&redirect_uri=%3Cstripped+query+param%3E&state=%3Cstripped+query+param%3E&code_challenge=%3Cstripped+query+param%3E&code_challenge_method=S256&scope=openid",
             <some fields may have been hidden>,
           },
         },
         NiceResponse {
           "status": 400,
           "body": {
             "error": "invalid_redirect_uri",
             "error_description": "redirect_uri did not match any of the client's registered redirect_uris",
             "iss": "http://localhost:<$NEXT_PUBLIC_STACK_PORT_PREFIX>02/api/v1/integrations/custom/oauth/idp",
             "state": "eyJkZXRhaWxzIjp7ImV4dGVybmFsX3Byb2plY3RfbmFtZSI6ImN1c3RvbS1wcm9qZWN0In19",
           },
           "headers": Headers { <some fields may have been hidden> },
         },
         undefined,
       ],
     }
   `);
 });

Also applies to: 160-190, 192-285

🧰 Tools
🪛 Biome (2.1.2)

[error] 153-153: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)

🤖 Prompt for AI Agents
In apps/e2e/tests/backend/endpoints/api/v1/integrations/custom/oauth.test.ts
around lines 153 to 158 (and also for the other occurrences in ranges 160-190
and 192-285), the test callbacks use an empty object pattern `async ({}) =>`
which triggers the Biome lint rule `lint/correctness/noEmptyPattern`; change
each occurrence to use an empty parameter list `async () =>` so the callbacks
are `async () =>` instead of `async ({}) =>`.

Comment on lines 4 to 6
it("list domains", async ({ expect }) => {
await Auth.Otp.signIn();
await Auth.fastSignUp();
const { adminAccessToken } = await Project.createAndGetAdminToken();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid redundant Auth.fastSignUp() before Project.createAndGetAdminToken() (double signup).

Project.createAndGetAdminToken() already calls Auth.fastSignUp() by default (unless useExistingUser is true), so these added calls likely slow tests and are unnecessary.

Options:

  1. Remove the standalone Auth.fastSignUp() lines, or
  2. If you intended to reuse an existing user session, pass useExistingUser: true to Project.createAndGetAdminToken(...) and ensure backendContext.value.userAuth is set.

Also applies to: 25-27, 47-49, 98-100, 129-131, 194-196

🤖 Prompt for AI Agents
In apps/e2e/tests/backend/endpoints/api/v1/integrations/neon/domain.test.ts
around lines 4-6 (and also at 25-27, 47-49, 98-100, 129-131, 194-196): tests
call Auth.fastSignUp() immediately before Project.createAndGetAdminToken(),
which itself calls Auth.fastSignUp() by default, causing redundant double
signups; remove the standalone Auth.fastSignUp() calls OR, if you really need to
reuse an existing user session, call Project.createAndGetAdminToken({
useExistingUser: true }) and ensure backendContext.value.userAuth is set prior
to that call so only one signup occurs.

Comment on lines +11 to 12
const { userId } = await Auth.fastSignUp();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid implicit auth state: make backendContext.userAuth explicit after Auth.fastSignUp() (prevents order-dependent flakes).

In these tests you call Auth.fastSignUp() but don’t set/clear backendContext.userAuth. If fastSignUp() ever stops mutating global context (or a prior test leaves userAuth set), subsequent accessType: "server" calls can become order-dependent.

Suggested tweak (apply similarly to both tests):

-    const { userId } = await Auth.fastSignUp();
+    const { userId, accessToken, refreshToken } = await Auth.fastSignUp();
+    backendContext.set({ userAuth: { accessToken, refreshToken } });

Also consider clearing at the start of each it right after projectKeys:

-    backendContext.set({ projectKeys: InternalProjectKeys });
+    backendContext.set({ projectKeys: InternalProjectKeys, userAuth: null });

Also applies to: 219-220

🤖 Prompt for AI Agents
In apps/e2e/tests/backend/endpoints/api/v1/internal/projects/transfer.test.ts
around lines 11-12 (and also apply to lines 219-220 and the sibling test),
Auth.fastSignUp() is called but backendContext.userAuth is left implicit which
makes tests order-dependent; after each Auth.fastSignUp() call explicitly set
backendContext.userAuth = { userId } (or the proper auth object returned) and/or
clear backendContext.userAuth at the start of each it block (right after
projectKeys) to ensure tests don't rely on global mutated state; apply the same
explicit set/clear pattern to both tests mentioned.

});

it("should grant inline product without needing configuration", async ({ expect }) => {
await Project.createAndSwitch({ config: { magic_link_enabled: true } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unnecessary magic_link_enabled config.

This project configuration appears inconsistent with the PR's refactoring pattern. According to the AI summary, this PR systematically removes magic_link_enabled configurations while transitioning to Auth.fastSignUp(). No other test in this file uses this config, and the test logic doesn't rely on magic link functionality.

Apply this diff:

-  await Project.createAndSwitch({ config: { magic_link_enabled: true } });
+  await Project.createAndSwitch();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await Project.createAndSwitch({ config: { magic_link_enabled: true } });
await Project.createAndSwitch();
🤖 Prompt for AI Agents
In apps/e2e/tests/backend/endpoints/api/v1/payments/products.test.ts around line
365, remove the unnecessary magic_link_enabled configuration from the
Project.createAndSwitch call; update the call to create/switch the project
without passing { config: { magic_link_enabled: true } } so it matches the
refactor pattern and other tests (i.e., call Project.createAndSwitch() or pass
only required config values).

Comment on lines 65 to 68
it("creates and updates the basic project information of a project", async ({ expect }) => {
await Auth.Otp.signIn();
await Auth.fastSignUp();
const { adminAccessToken } = await Project.createAndGetAdminToken();
const { updateProjectResponse: response } = await Project.updateCurrent(adminAccessToken, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid redundant Auth.fastSignUp() before Project.createAndGetAdminToken() (double signup).

These tests now do fastSignUp() and then call Project.createAndGetAdminToken(), which (by default) signs up again. That’s likely extra work per test and counter to “Speed up tests”.

Concrete fix (example pattern):

-  await Auth.fastSignUp();
   const { adminAccessToken } = await Project.createAndGetAdminToken();

Also applies to: 114-117, 166-169, 286-289, 343-346, 378-381, 702-705, 779-782, 1184-1187, 1206-1209, 1238-1241, 1569-1572

Comment on lines +7 to +8
it.runIf(!!process.env.CI)("completes successfully", async ({ expect }) => {
throw new Error("Not implemented");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: This test will fail in CI.

The test is gated to run only in CI (runIf(!!process.env.CI)), but immediately throws "Not implemented", which will cause CI pipeline failures.

If the test is being temporarily disabled for performance reasons (aligning with the PR's "Speed up tests" objective), use it.skip(...) instead. If it's genuinely not implemented yet, use it.todo(...).

Apply this diff to skip the test:

-  // note that we run this only in CI environments
-  it.runIf(!!process.env.CI)("completes successfully", async ({ expect }) => {
-    throw new Error("Not implemented");
+  // Temporarily skipped to speed up test suite
+  it.skip("completes successfully", async ({ expect }) => {

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In apps/e2e/tests/general/setup-wizard.test.ts around lines 7-8, the test is
currently gated to run only in CI with it.runIf(!!process.env.CI) but
immediately throws "Not implemented", which will fail CI; replace the CI-gated
test with a skipped or todo test so CI won't run it (for example change to
it.skip("completes successfully", async () => { /* temporarily skipped */ }) or
it.todo("completes successfully")), removing the throw and the CI runIf guard.

it("completes successfully", async ({ expect }) => {
// note that we run this only in CI environments
it.runIf(!!process.env.CI)("completes successfully", async ({ expect }) => {
throw new Error("Not implemented");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Error("Not implemented");

The test immediately throws an error with the message "Not implemented", which will cause the test to always fail and make all subsequent test code unreachable.

View Details

Analysis

Removed accidentally added "Not implemented" error in setup-wizard test

What fails: The setup wizard test (setupWizard.test.ts) throws an error with message "Not implemented" immediately when executed, preventing the actual test logic from running.

How to reproduce:

# Run the setup wizard test
pnpm -C apps/e2e test -- setup-wizard.test.ts
# When CI environment variable is set, the test will fail with:
# Error: Not implemented

Result: Test always throws Error("Not implemented") and never executes the actual test code that runs pnpm init-stack tests.

Expected: Test should execute the pnpm -C packages/init-stack run test-run command without throwing.

Root cause: The throw new Error("Not implemented"); statement was accidentally added in commit ff77394 ("Speed up tests", Dec 12 2025 14:54 UTC) during a refactoring that added it.runIf(!!process.env.CI) to conditionally run the test only in CI environments. This throw statement blocks the actual test implementation from ever executing.

Fix: Removed the erroneous throw statement to allow the test implementation to proceed normally.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 12, 2025

Greptile Overview

Greptile Summary

This PR optimizes E2E test execution time by replacing the slow Auth.Otp.signIn() flow (which requires email sending/receiving via mailbox) with a new Auth.fastSignUp() helper that creates users directly via the server API and session endpoints.

  • New Auth.fastSignUp() helper: Creates a user via User.create() and immediately establishes a session via the /api/v1/auth/sessions endpoint, bypassing the OTP email verification flow entirely
  • Test refactoring across 32 files: All backend E2E tests now use fastSignUp() instead of Otp.signIn(), eliminating unnecessary email round-trips
  • Snapshot updates: Inline snapshots updated to reflect users created via fastSignUp have different auth states (no email verification, auth_with_email: false, team names as "Personal Team")
  • Simplified test setup: Removed redundant bumpEmailAddress() calls and magic_link_enabled config where no longer needed
  • Setup wizard change: Modified to run only in CI environments, but has a critical bug that will cause it to always fail

Confidence Score: 3/5

  • Most changes are straightforward test refactoring, but the setup wizard test has a critical bug that will cause CI failures.
  • The bulk of this PR is a safe and beneficial refactoring to speed up tests. However, the setup wizard test has been modified to throw an error unconditionally when running in CI, which will cause test failures. This needs to be addressed before merging.
  • apps/e2e/tests/general/setup-wizard.test.ts - contains throw new Error("Not implemented") that will always fail in CI.

Important Files Changed

File Analysis

Filename Score Overview
apps/e2e/tests/backend/backend-helpers.ts 5/5 Added Auth.fastSignUp() helper that creates users via server API and session endpoints, bypassing OTP email flow; strengthened User.create response assertions.
apps/e2e/tests/general/setup-wizard.test.ts 1/5 Test modified to run only in CI with it.runIf(!!process.env.CI), but has a throw new Error("Not implemented") that will always fail in CI.
apps/e2e/tests/backend/endpoints/api/v1/users.test.ts 5/5 Replaced Auth.Otp.signIn() with Auth.fastSignUp() throughout; removed unnecessary magic_link_enabled configs and bumpEmailAddress() calls.
apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts 5/5 Replaced Auth.Otp.signIn() with Auth.fastSignUp() across all test cases; removed bumpEmailAddress() calls; removed magic_link_enabled config where unnecessary.
apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts 5/5 Replaced OTP sign-in with fastSignUp; updated inline snapshots to reflect users without email authentication (email-related fields now false/null, team names now "Personal Team").
apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts 5/5 Replaced OTP sign-in with fastSignUp; passes primary_email and primary_email_verified to fastSignUp when users need to receive/accept invitations by email.

Sequence Diagram

sequenceDiagram
    participant Test as E2E Test
    participant Helper as Auth.fastSignUp()
    participant UserAPI as /api/v1/users
    participant SessionAPI as /api/v1/auth/sessions
    participant Context as backendContext

    Note over Test,Context: Before (Auth.Otp.signIn)
    Test->>Helper: Auth.Otp.signIn()
    Helper->>UserAPI: Send OTP email
    Helper->>Helper: Wait for email delivery
    Helper->>Helper: Parse email for code
    Helper->>SessionAPI: Sign in with code
    SessionAPI-->>Helper: access_token, refresh_token
    Helper->>Context: Set userAuth
    Helper-->>Test: Return userId

    Note over Test,Context: After (Auth.fastSignUp)
    Test->>Helper: Auth.fastSignUp()
    Helper->>UserAPI: POST /api/v1/users (server access)
    UserAPI-->>Helper: userId
    Helper->>SessionAPI: POST /api/v1/auth/sessions
    SessionAPI-->>Helper: access_token, refresh_token
    Helper->>Context: Set userAuth
    Helper-->>Test: Return userId, tokens
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

33 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

it("completes successfully", async ({ expect }) => {
// note that we run this only in CI environments
it.runIf(!!process.env.CI)("completes successfully", async ({ expect }) => {
throw new Error("Not implemented");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This throw new Error("Not implemented") will cause the test to always fail when running in CI environments. The code below this line is unreachable. Either remove this line to enable the test, or remove the entire test body if the test isn't ready yet.

Suggested change
throw new Error("Not implemented");
// throw new Error("Not implemented");
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/e2e/tests/general/setup-wizard.test.ts
Line: 8:8

Comment:
**logic:** This `throw new Error("Not implemented")` will cause the test to always fail when running in CI environments. The code below this line is unreachable. Either remove this line to enable the test, or remove the entire test body if the test isn't ready yet.

```suggestion
    // throw new Error("Not implemented");
```

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants