Skip to content

fix(repo): guard empty error lists in the integration role helper - #9939

Merged
manovotny merged 3 commits into
mainfrom
manovotny/guard-empty-error-list-role-helper
Sep 28, 2026
Merged

manovotny merged 3 commits into
mainfrom
manovotny/guard-empty-error-list-role-helper

Conversation

@manovotny

@manovotny manovotny commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

bulkCreateFeaturesPermissionsRoles tolerates the Backend API rejecting a permission assignment that already exists by reading err.errors[0].code inside its catch. When the API returns a ClerkAPIResponseError whose errors array is empty, that read throws a TypeError from inside the catch, replacing the real API error and repeating for every permission in the loop until the run aborts with No tests found. The same guard also only rethrew ClerkAPIResponseError instances, so any other rejection (a network failure, or an error the retry wrapper gave up on) was swallowed and the loop carried on as if the permission had been assigned.

This guards the read with optional chaining and inverts the condition so the helper only ignores the existing-association error. Anything else, including an API error with no entries, is rethrown as itself and the original failure is what surfaces in the CI log.

Seen on the Integration Tests (tanstack-react-start, chrome) job of #9783 (run 36161445397), where the underlying failure was a transient Backend API error unrelated to the PR under test.

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:

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Sep 28, 2026 4:02pm UTC
swingset Ready Ready Preview Sep 28, 2026 4:02pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f9ecc71

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

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Team

Run ID: b6f30000-4255-46b8-9b65-2cdcf3d90b10

📥 Commits

Reviewing files that changed from the base of the PR and between 2fac820 and f9ecc71.

📒 Files selected for processing (1)
  • integration/testUtils/bulkCreateFeaturesPermissionsRoles.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 5 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.


📝 Walkthrough

Walkthrough

The role-permission assignment catch now rethrows non-Clerk errors and Clerk API errors with a missing or non-matching first error code. It continues to ignore the existing-association error. An empty-frontmatter Changesets file was added.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested reviewers: dstaley

Merge Risk: ⚪ Minimal · up to f9ecc

The helper now surfaces unexpected failures while retaining duplicate-association handling, and the added no-release changeset is accepted by the repository workflow. No merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: guarding empty error lists in the integration role helper.
Description check ✅ Passed The description directly explains the bug, the error-handling changes, and the expected behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9939

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9939

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9939

@clerk/expo

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

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9939

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9939

@clerk/localizations

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

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@9939

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9939

@clerk/upgrade

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

@clerk/vue

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

commit: f9ecc71

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@dstaley dstaley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

might be clearer to rework this into two separate conditions

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@manovotny

Copy link
Copy Markdown
Contributor Author

@dstaley Fixed in f9ecc71.

@manovotny
manovotny merged commit 532b18a into main Sep 28, 2026
49 checks passed
@manovotny
manovotny deleted the manovotny/guard-empty-error-list-role-helper branch September 28, 2026 17:10

This branch was successfully deployed

2 active deployments
Preview – swingset — f9ecc71f Deployed Sep 28, 2026 by vercel[bot]
Preview – clerk-js-sandbox — f9ecc71f Deployed Sep 28, 2026 by vercel[bot]
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.

2 participants