Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Nov 6, 2025

Description

Addressing outstanding issues with E2Es

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Chores

    • Reduced build output noise during local development while preserving full output in CI.
    • Added a repository changeset file placeholder.
  • Bug Fixes

    • Improved error handling for user-creation flows: rate-limit (HTTP 429) failures now surface clearer, actionable error messages with retry timing and trace details.

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

🦋 Changeset detected

Latest commit: 46997f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 6, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Nov 6, 2025 4:32am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

Suppressed local build stdio while preserving CI output in the application model; added rate-limit (HTTP 429) error handling with enriched retry/tracing context to user creation in test utilities.

Changes

Cohort / File(s) Summary
Build output configuration
integration/models/application.ts
Build invocation now sets a conditional stdio option: 'ignore' when not running in CI to suppress local build output, and undefined in CI to allow full logs. Added explanatory comments and an ESLint directive.
User creation & error handling
integration/testUtils/usersService.ts
createBapiUser wrapped clerkClient.users.createUser in try/catch; on HTTP 429 rate-limit responses it constructs and rethrows an Error containing Retry-After, trace ID, and API error messages. Also reordered createFakeOrganization return object to include delete property earlier.
Changeset
.changeset/dirty-friends-kick.md
Added a new changeset file containing placeholder separators; no behavioral or API changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Caller
    participant AppModel as application.ts
    participant BuildTool as child_process.run
    Note over AppModel,BuildTool `#e2f0d9`: Build step selects stdio based on CI
    Caller->>AppModel: invoke build()
    AppModel->>BuildTool: run(buildCmd, { stdio: 'ignore' } or undefined)
    BuildTool-->>AppModel: exit
    AppModel-->>Caller: build result
Loading
sequenceDiagram
    autonumber
    participant Test as test code
    participant UsersSvc as usersService.ts
    participant Clerk as clerkClient
    Test->>UsersSvc: createBapiUser(fakeUser)
    UsersSvc->>Clerk: users.createUser(payload)
    alt success
        Clerk-->>UsersSvc: user
        UsersSvc-->>Test: resolved user
    else HTTP 429
        Clerk-->>UsersSvc: 429 + headers + body
        UsersSvc->>UsersSvc: build detailed error (Retry-After, Trace ID, API errors)
        UsersSvc-->>Test: throw Error(detailed message)
    else other error
        Clerk-->>UsersSvc: error
        UsersSvc-->>Test: rethrow original error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify CI detection (environment variable usage) matches project conventions.
  • Confirm stdio: 'ignore' doesn't hide actionable local build errors or make debugging too difficult.
  • Review rate-limit error parsing for header names/format and resilience to unexpected error shapes.
  • Ensure rethrown Error preserves useful stack/context; check callers/tests for reliance on property order changes in createFakeOrganization.

Poem

I nibble logs and hush the night,
Quiet local builds by moonlight.
When CI wakes, I let them sing—
I catch the rate-limit's tiny sting. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix(repo): Debug integration tests' is vague and generic. 'Debug integration tests' does not accurately describe the specific changes made (stdio configuration, error handling improvements, and changeset addition). Use a more specific title that reflects the actual changes, such as 'fix: Add error handling for rate limits and suppress build output in integration tests' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 fix/integration-tests

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 6, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7167

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7167

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7167

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7167

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7167

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7167

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7167

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@7167

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7167

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7167

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7167

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7167

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7167

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7167

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@7167

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7167

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7167

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7167

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7167

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7167

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7167

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7167

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7167

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7167

commit: 46997f7

@blacksmith-sh
Copy link

blacksmith-sh bot commented Nov 6, 2025

Found 5 test failures on Blacksmith runners:

Test View Logs
[chrome] › integration/tests/
legal-consent.test.ts:15:9 › sign up flow with legal consent @generic @nextjs › long-ru
nning--next.appRouter.withLegalConsent › sign up with email and password and legal cons
ent
View Logs
[chrome] › integration/tests/
oauth-flows.test.ts:214:9 › oauth flows with legal consent @nextjs › long-running--next
.appRouter.withLegalConsent › sign up via transfer with custom oauth provider
View Logs
[chrome] › integration/tests/
session-tasks-multi-session.test.ts:33:9 › session tasks multi-session flow @nextjs › l
ong-running--next.appRouter.withSessionTasks › when switching sessions, navigate to tas
k
View Logs
[chrome] › integration/tests/
sign-up-flow.test.ts:124:7 › sign up flow @generic @nextjs › long-running--next.appRout
er.withEmailCodes › sign up with first name, last name, email, phone and password
View Logs
[setup] › integration/tests/
global.setup.ts:7:6 › start long running apps ─────────────────────
View Logs


Fix in Cursor

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: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 622b062 and 012f867.

📒 Files selected for processing (1)
  • integration/testUtils/usersService.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • integration/testUtils/usersService.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • integration/testUtils/usersService.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • integration/testUtils/usersService.ts
integration/**

📄 CodeRabbit inference engine (.cursor/rules/global.mdc)

Framework integration templates and E2E tests should be placed under the integration/ directory

Files:

  • integration/testUtils/usersService.ts
integration/**/*

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

End-to-end tests and integration templates must be located in the 'integration/' directory.

Files:

  • integration/testUtils/usersService.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • integration/testUtils/usersService.ts
⏰ 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). (5)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

@jacekradko jacekradko changed the title fix: local integration tests fix(repo): Debug integration tests Nov 6, 2025
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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 012f867 and 46997f7.

📒 Files selected for processing (2)
  • .changeset/dirty-friends-kick.md (1 hunks)
  • integration/testUtils/usersService.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • integration/testUtils/usersService.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • integration/testUtils/usersService.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • integration/testUtils/usersService.ts
integration/**

📄 CodeRabbit inference engine (.cursor/rules/global.mdc)

Framework integration templates and E2E tests should be placed under the integration/ directory

Files:

  • integration/testUtils/usersService.ts
integration/**/*

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

End-to-end tests and integration templates must be located in the 'integration/' directory.

Files:

  • integration/testUtils/usersService.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • integration/testUtils/usersService.ts
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/dirty-friends-kick.md
🪛 LanguageTool
.changeset/dirty-friends-kick.md

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

⏰ 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). (27)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Static analysis
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
integration/testUtils/usersService.ts (2)

128-157: Well-implemented error handling with proper TypeScript practices.

The error handling correctly follows the coding guidelines:

  • Uses unknown type for caught errors instead of any
  • Implements proper type guards before narrowing (line 139)
  • Preserves original error context using { cause: error } option (line 154)
  • Extracts detailed rate-limit context (retry-after, trace ID, API messages) for improved debugging

207-218: LGTM! Organization name consistency issue resolved.

The function now correctly uses the same name variable for both creating the organization (line 211) and returning it in the result object (line 215), ensuring consistency between organization.name and the returned name property.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants