Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Oct 31, 2025

Description

Adding debug logging to session update scenarios while offline

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

  • Documentation

    • Added a changelog entry for a patch release documenting offline debug logging behavior.
  • Chores

    • Added additional debug logging for session token updates when the browser is offline.
    • Added offline-aware debug warnings for network/fetch errors to improve troubleshooting visibility without changing runtime behavior.

@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2025

🦋 Changeset detected

Latest commit: 8cf67b0

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

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

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 Oct 31, 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 Oct 31, 2025 4:29pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Adds offline-aware debug logging in @clerk/clerk-js: logs a debug warning when session tokens become null while the browser is offline (AuthCookieService and clerk core) and replaces console.warn with debugLogger.warn for offline network errors in Base._baseFetch; no public APIs changed and control flow largely preserved.

Changes

Cohort / File(s) Summary
Changelog Entry
.changeset/every-chefs-mix.md
Adds a changelog entry documenting a patch release and the addition of offline-aware debug logging.
Auth cookie & clerk core
packages/clerk-js/src/core/auth/AuthCookieService.ts, packages/clerk-js/src/core/clerk.ts
Add offline detection and conditional debugLogger.warn when session tokens are null while the browser is offline; still emit TokenUpdate events and preserve existing control flow. Imports isValidBrowserOnline and debugLogger.
Base fetch error handling
packages/clerk-js/src/core/resources/Base.ts
Replace console.warn with debugLogger.warn for offline network errors in _baseFetch, include structured message, method, path, and baseResource tag; retains returning null on error.
Tests
packages/clerk-js/src/core/resources/__tests__/Token.test.ts
Update test logging spy to target debugLogger.warn instead of console.warn; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant AuthCookieService
  participant ClerkCore as Clerk
  participant BaseResource as Base
  participant Debug as debugLogger

  Browser->>AuthCookieService: updateSessionCookie(token)
  alt token == null AND Browser offline
    AuthCookieService->>Debug: warn("session token removed while offline")
  end
  AuthCookieService->>ClerkCore: emit TokenUpdate(token)
  alt token == null AND Browser offline
    ClerkCore->>Debug: warn("token unexpectedly null while offline")
  end

  Browser->>BaseResource: _baseFetch(request)
  alt network error due to offline
    BaseResource->>Debug: warn("offline network error", method, path, tag: "baseResource")
    BaseResource-->>Browser: return null
  else success
    BaseResource-->>Browser: return response
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review attention:
    • Verify correct usage of isValidBrowserOnline across environments.
    • Confirm debugLogger.warn message shapes and tags follow conventions.
    • Ensure TokenUpdate emission and tests cover the offline branch.

Poem

🐰 I nibble at code when networks nap,
I log a soft hop when tokens flap,
A tiny warn beneath the moon,
Sessions wait until morning soon,
Debug carrots saved in my map 🥕

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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat(clerk-js): Add debug logging to session update when offline" accurately and specifically summarizes the primary change across all modified files. The changeset consistently adds debug logging functionality to session update flows and related operations when the browser is offline—including updates to AuthCookieService, clerk.ts, Base.ts, and corresponding test files. The title is concise, clear, and avoids vague or generic language, making it immediately understandable to reviewers scanning the git history. It properly indicates both the scope (clerk-js) and the core intent (adding debug logging in offline scenarios).
✨ 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 feat/debug-off-line-session-cookie-update

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

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

🧹 Nitpick comments (3)
packages/clerk-js/src/core/clerk.ts (2)

383-389: Consider logging token-null scenarios regardless of connectivity.

While the offline logging is valuable, a null token when the browser is online might indicate a different issue (e.g., session expiry, API error) that's also worth tracking. Consider logging in both cases with different messages to distinguish offline vs online scenarios.

Example approach:

 if (!token) {
   if (!isValidBrowserOnline()) {
     debugLogger.warn(
       'Token is null when setting active session (offline)',
       { sessionId: newSession?.id },
       'clerk',
     );
+  } else {
+    debugLogger.warn(
+      'Token is null when setting active session (online)',
+      { sessionId: newSession?.id },
+      'clerk',
+    );
   }
   eventBus.emit(events.TokenUpdate, { token: null });
 }

390-396: Consider logging missing token scenarios regardless of connectivity.

Similar to the setActive case, a missing lastActiveToken while online could indicate an issue worth tracking separately from offline scenarios.

Apply the same pattern as suggested for lines 383-389 to distinguish between offline and online token-missing scenarios.

packages/clerk-js/src/core/auth/AuthCookieService.ts (1)

180-183: Consider logging session cookie removal regardless of connectivity.

Consistent with the suggestions for clerk.ts, logging when the session cookie is being removed while online could help identify different classes of issues (e.g., explicit sign-out vs network problems vs API errors).

Example:

 if (!token && !isValidBrowserOnline()) {
   debugLogger.warn('Removing session cookie (offline)', { sessionId: this.clerk.session?.id }, 'authCookieService');
+} else if (!token) {
+  debugLogger.warn('Removing session cookie (online)', { sessionId: this.clerk.session?.id }, 'authCookieService');
 }
📜 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 f47b5a3 and 58dc9f2.

📒 Files selected for processing (3)
  • .changeset/every-chefs-mix.md (1 hunks)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts (3 hunks)
  • packages/clerk-js/src/core/clerk.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:

  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.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:

  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
packages/**/*.{ts,tsx,d.ts}

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

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.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:

  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.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:

  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
.changeset/**

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

Automated releases must use Changesets.

Files:

  • .changeset/every-chefs-mix.md
🧬 Code graph analysis (2)
packages/clerk-js/src/core/clerk.ts (1)
packages/clerk-js/src/utils/debug.ts (1)
  • debugLogger (150-179)
packages/clerk-js/src/core/auth/AuthCookieService.ts (1)
packages/clerk-js/src/utils/debug.ts (1)
  • debugLogger (150-179)
⏰ 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). (4)
  • GitHub Check: pr-title-lint
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
.changeset/every-chefs-mix.md (1)

1-5: LGTM!

The changeset correctly documents this as a patch-level change with an appropriate description of the debug logging additions for offline scenarios.

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

🧹 Nitpick comments (1)
packages/clerk-js/src/core/resources/Base.ts (1)

103-110: Consider including error details in the debug context.

The structured logging is a good improvement, but the original error object e (caught on line 95) may contain useful debugging information such as the error message, type, or stack trace. Consider including this in the context to preserve debugging capability.

Apply this diff to include error details:

       } else if (!isValidBrowserOnline()) {
         debugLogger.warn(
           'Network request failed while offline, returning null',
           {
             method: requestInit.method,
             path: requestInit.path,
+            error: e instanceof Error ? e.message : String(e),
           },
           'baseResource',
         );
         return null;
📜 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 58dc9f2 and 7b5e340.

📒 Files selected for processing (1)
  • packages/clerk-js/src/core/resources/Base.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:

  • packages/clerk-js/src/core/resources/Base.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:

  • packages/clerk-js/src/core/resources/Base.ts
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/core/resources/Base.ts
packages/**/*.{ts,tsx,d.ts}

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

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/core/resources/Base.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:

  • packages/clerk-js/src/core/resources/Base.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:

  • packages/clerk-js/src/core/resources/Base.ts
🧬 Code graph analysis (1)
packages/clerk-js/src/core/resources/Base.ts (1)
packages/clerk-js/src/utils/debug.ts (1)
  • debugLogger (150-179)
⏰ 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
🔇 Additional comments (1)
packages/clerk-js/src/core/resources/Base.ts (1)

11-11: LGTM! Clean import addition.

The import of debugLogger follows the codebase conventions and enables structured logging for offline scenarios.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 31, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 8cf67b0

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

🧹 Nitpick comments (1)
packages/clerk-js/src/core/resources/__tests__/Token.test.ts (1)

47-82: Good change to align with debug logging. Consider enhancing test robustness.

The spy correctly targets debugLogger.warn instead of console.warn, which aligns with the PR's objective. The test setup and cleanup are properly structured.

Optional improvements:

  1. Add explicit type annotation for warnSpy (line 47):
-    let warnSpy;
+    let warnSpy: ReturnType<typeof vi.spyOn>;
  1. Consider verifying the actual arguments passed to debugLogger.warn for more robust testing (line 82):
-    expect(warnSpy).toBeCalled();
+    expect(warnSpy).toHaveBeenCalledWith(
+      expect.stringContaining('offline'),
+      expect.objectContaining({ method: 'POST', path: expect.stringContaining('/path/to/tokens') }),
+      'baseResource'
+    );

This would ensure the warning message, context, and source are correct, not just that logging occurred.

Based on coding guidelines: "Create type-safe test builders/factories" and "Use proper type annotations for variables and parameters where inference isn't clear."

📜 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 7b5e340 and 8cf67b0.

📒 Files selected for processing (1)
  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{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:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.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:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts
packages/**/*.{ts,tsx,d.ts}

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

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.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:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

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

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

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

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.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:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts
**/__tests__/**/*.{ts,tsx}

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

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/core/resources/__tests__/Token.test.ts
🧬 Code graph analysis (1)
packages/clerk-js/src/core/resources/__tests__/Token.test.ts (1)
packages/clerk-js/src/utils/debug.ts (1)
  • debugLogger (150-179)
⏰ 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). (4)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
packages/clerk-js/src/core/resources/__tests__/Token.test.ts (1)

5-5: LGTM! Import aligns with debug logging strategy.

The import of debugLogger correctly supports the PR's objective of adding debug logging for offline scenarios. The use of a named import follows the coding guidelines.

@blacksmith-sh
Copy link

blacksmith-sh bot commented Oct 31, 2025

Found 8 test failures on Blacksmith runners:

Test View Logs
[chrome] › integration/tests/
pricing-table.test.ts:385:7 › pricing table @billing › long-running--withBilling.astro.
node › subscribing to other paid plans while on free trial is immediate cancellation
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:456:9 › pricing table @billing › long-running--withBilling.astro.
node › in UserProfile › renders pricing table, subscribes to a plan, revalidates paymen
t method on complete and then downgrades to free
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:510:9 › pricing table @billing › long-running--withBilling.next.a
ppRouter › in UserProfile › unsubscribes from a plan
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:558:9 › pricing table @billing › long-running--withBilling.next.a
ppRouter › in UserProfile › checkout always revalidates on open
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:588:9 › pricing table @billing › long-running--withBilling.astro.
node › in UserProfile › adds payment method via checkout and resets stripe setup intent
after failed payment
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:588:9 › pricing table @billing › long-running--withBilling.next.a
ppRouter › in UserProfile › adds payment method via checkout and resets stripe setup in
tent after failed payment
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:625:9 › pricing table @billing › long-running--withBilling.astro.
node › in UserProfile › displays notice then plan cannot change
View Logs
[chrome] › integration/tests/
pricing-table.test.ts:625:9 › pricing table @billing › long-running--withBilling.next.a
ppRouter › in UserProfile › displays notice then plan cannot change
View Logs


Fix in Cursor

@jacekradko jacekradko merged commit 5b85ea9 into main Nov 3, 2025
133 of 158 checks passed
@jacekradko jacekradko deleted the feat/debug-off-line-session-cookie-update branch November 3, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants