[PR #4646] [CLOSED] test: fix flaky test #5503

Closed
opened 2026-03-13 12:25:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4646
Author: @himself65
Created: 9/14/2025
Status: Closed

Base: canaryHead: himself65/2025/09/14/falky


📝 Commits (3)

  • 2576b77 test: fix flaky test
  • 7e4233e chore: lint fix
  • db42d2e Merge branch 'canary' into himself65/2025/09/14/falky

📊 Changes

1 file changed (+60 additions, -12 deletions)

View changed files

📝 packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts (+60 -12)

📄 Description

Summary by cubic

Fixes flaky tests by normalizing ID types in the Prisma adapter when useNumberId is enabled. Queries and writes now consistently use numeric IDs to avoid type mismatches.

  • Bug Fixes
    • Convert id, userId, and any field ending with Id (including arrays) to numbers in where clauses.
    • Coerce foreign key IDs in create, update, and updateMany payloads via a new convertDataValues helper.
    • Apply conversions across single, AND, and OR filter paths.
    • No changes when useNumberId is disabled.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4646 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/14/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2025/09/14/falky` --- ### 📝 Commits (3) - [`2576b77`](https://github.com/better-auth/better-auth/commit/2576b778b547a8e9a32176f29f7794e9cb66107f) test: fix flaky test - [`7e4233e`](https://github.com/better-auth/better-auth/commit/7e4233e9266015c589a15b7ea25fb66b97a41fa8) chore: lint fix - [`db42d2e`](https://github.com/better-auth/better-auth/commit/db42d2e008bdde9d450accd11b040ad47b7f0c44) Merge branch 'canary' into himself65/2025/09/14/falky ### 📊 Changes **1 file changed** (+60 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts` (+60 -12) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes flaky tests by normalizing ID types in the Prisma adapter when useNumberId is enabled. Queries and writes now consistently use numeric IDs to avoid type mismatches. - **Bug Fixes** - Convert id, userId, and any field ending with Id (including arrays) to numbers in where clauses. - Coerce foreign key IDs in create, update, and updateMany payloads via a new convertDataValues helper. - Apply conversions across single, AND, and OR filter paths. - No changes when useNumberId is disabled. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:25:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5503