[PR #4915] [MERGED] fix: tests failing due to clock drift #13901

Closed
opened 2026-04-13 09:12:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4915
Author: @dvanmali
Created: 9/25/2025
Status: Merged
Merged: 9/25/2025
Merged by: @himself65

Base: canaryHead: timing


📝 Commits (1)

  • 7d18308 fix: tests failingdue to clock drift

📊 Changes

1 file changed (+10 additions, -6 deletions)

View changed files

📝 packages/better-auth/src/db/internal-adapter.test.ts (+10 -6)

📄 Description

Fix: #4910


Summary by cubic

Fix failing adapter tests caused by clock drift by computing expected expirations from the current time and allowing up to 1s drift. Addresses #4910.

  • Bug Fixes
    • Replace hardcoded 7-day TTL with expiresAt derived from Date.now and compare using seconds.
    • Add up-to-1s drift tolerance for session and token TTL checks to prevent CI flakiness.

🔄 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/4915 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 9/25/2025 **Status:** ✅ Merged **Merged:** 9/25/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `timing` --- ### 📝 Commits (1) - [`7d18308`](https://github.com/better-auth/better-auth/commit/7d183088c15d1cd8d780fe2cc3afc972bf1d48e4) fix: tests failingdue to clock drift ### 📊 Changes **1 file changed** (+10 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/internal-adapter.test.ts` (+10 -6) </details> ### 📄 Description Fix: #4910 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix failing adapter tests caused by clock drift by computing expected expirations from the current time and allowing up to 1s drift. Addresses #4910. - **Bug Fixes** - Replace hardcoded 7-day TTL with expiresAt derived from Date.now and compare using seconds. - Add up-to-1s drift tolerance for session and token TTL checks to prevent CI flakiness. <!-- 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-04-13 09:12:09 -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#13901