Skip to content

fix(clerk-js): preserve indefinite session deadlines - #9871

Open
swolfand wants to merge 8 commits into
mainfrom
sam/mobile-session-lifetimes
Open

swolfand wants to merge 8 commits into
mainfrom
sam/mobile-session-lifetimes

Conversation

@swolfand

@swolfand swolfand commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

Preserve zero expiration and abandonment timestamps through session loading and snapshots. Add hasMaximumLifetime to session resources so native and Expo clients can distinguish indefinite sessions from finite deadlines.

Load a session with expire_at: 0, restore its snapshot, and verify that the deadline remains zero and hasMaximumLifetime is false. Release before enabling the backend native-session policy.

Part of MOBILE-517. Companion PRs:

Checklist

  • pnpm test runs as expected. @clerk/shared, @clerk/clerk-js, and @clerk/expo unit tests passed; full monorepo suite not run.
  • pnpm build runs as expected. @clerk/shared, @clerk/clerk-js, and @clerk/expo builds passed; full monorepo build not run.
  • (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:

Preserve zero timestamps through date conversion and snapshots, and expose hasMaximumLifetime on session resources.

Part of MOBILE-517
@changeset-bot

changeset-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 53c1fed

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

This PR includes changesets to release 23 packages
Name Type
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/chrome-extension Patch
@clerk/electron Patch
@clerk/expo Patch
@clerk/mosaic Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/swingset Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue 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

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 069d4c9d-4677-4228-8a50-07354c70367d
📥 Commits

Reviewing files that changed from the base of the PR and between 7b3a07d and 53c1fed.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: 16e7f4e2-6bd5-4157-ac27-6452d1e2d48c
📥 Commits

Reviewing files that changed from the base of the PR and between baa8e61 and 7b3a07d.

📒 Files selected for processing: 2
  • packages/backend/src/api/resources/Session.ts
  • packages/shared/src/types/session.ts
🔗 Linked repositories identified

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

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

📝 Walkthrough

unixEpochToDate now preserves an explicit zero timestamp. Session and SessionWithActivities expose hasMaximumLifetime, and shared session types document the property. Tests cover deadline values and maximum-lifetime status after snapshot restoration, including restored client sessions.

Priority: ➖ Normal

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

Suggested reviewers: wobsoriano, sarahsoutoul

Merge Risk: ⚪ Minimal · up to 7b3a0

Zero-valued indefinite-session deadlines are preserved through restoration, and the lifetime indicator is exposed. No actionable merge-blocking issue was found in the changed boundaries.

Pre-merge checks: Passed 4 · Failed 1

Failed 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 2 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preserving indefinite session deadlines in Clerk JS.
Description check Passed The description directly explains the deadline preservation, snapshot restoration, and new hasMaximumLifetime property. It matches the changeset.
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@vercel

vercel Bot commented Sep 22, 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 Oct 16, 2026 1:03am UTC
swingset Ready Ready Preview Oct 16, 2026 1:03am UTC

Request Review

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-biometrics

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

@clerk/expo-google-signin

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

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@9871

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/mosaic

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 53c1fed

hasMaximumLifetime is a new public property, so clerk-js and shared take a minor bump. The changeset now describes the user-facing fix.

Part of MOBILE-517
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-10-16T01:04:58.345Z

Summary

Metric Count
Packages analyzed 20
Packages with changes 1
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 2

@clerk/shared

Current version: 4.40.0
Recommended bump: MINOR → 4.41.0

Subpath ./types

🟢 Additions (2)

Added: SessionResource.hasMaximumLifetime
+ readonly hasMaximumLifetime?: boolean;

Added property SessionResource.hasMaximumLifetime

Added: SessionWithActivitiesResource.hasMaximumLifetime
+ readonly hasMaximumLifetime?: boolean;

Added property SessionWithActivitiesResource.hasMaximumLifetime


Report generated by Break Check

Last ran on 53c1fed.

@wobsoriano wobsoriano 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.

looks good! pushed a tiny change

@SarahSoutoul

SarahSoutoul commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

@swolfand Explained everything in the accompanying docs PR, but pushed some JSDoc changes to include some of that info you had in the docs before but are better included as part of the property in the Typedoc output. Have a look and let me know if that looks good to you.

This branch was successfully deployed

2 active deployments
Preview – swingset — 53c1fed0 Deployed Oct 16, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 53c1fed0 Deployed Oct 16, 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.

3 participants