Skip to content

Conversation

@bradtaniguchi
Copy link
Collaborator

@bradtaniguchi bradtaniguchi commented May 23, 2025

  • Used copilot running ontop of gemini 2.5 pro (preview) to try out fixing this issue as I'm less versed in this part of the codebase. Suggesting this PR as a starting point, will keep in draft until verified. (I may utilize tests and pound the pipeline to validate this change)

Fix: #82

@bradtaniguchi bradtaniguchi self-assigned this May 23, 2025
@bradtaniguchi bradtaniguchi requested a review from Copilot May 23, 2025 02:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #82 by updating the behavior of getExpirationDate in the session store to ensure that the session touch operation properly applies the expiration reset. The key changes include:

  • Reordering of imports for clarity.
  • Updated getExpirationDate implementation that prioritizes sessionCookie.expires if it's a Date, falls back to sessionCookie.maxAge, and otherwise uses the default TTL.
Comments suppressed due to low confidence (1)

src/store.ts:1

  • [nitpick] Consider verifying that the updated import order adheres to your project's ordering guidelines for consistency across the codebase.
import session, { Store as ExpressSessionStore, SessionData } from 'express-session';

Copy link
Collaborator Author

@bradtaniguchi bradtaniguchi left a comment

Choose a reason for hiding this comment

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

At a glance the change seems sensible.

I dislike the original implementation's use of an OR leading directly into a ternary as that's somewhat confusing (I got tripped up as I wasn't completely sure if the OR takes precedent over the rest of the ternary)

I'll have to review the docs on the provided cookie and maybe cross check this sort of change with other session stores.

For the most part, pretty sane changes from AI here.

Copy link
Owner

@JLuboff JLuboff left a comment

Choose a reason for hiding this comment

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

Looks okay to me, and is passing tests locally...

@bradtaniguchi
Copy link
Collaborator Author

So I skimmed the express-session docs here:
https://github.com/expressjs/session?tab=readme-ov-file#session-store-implementation

I've had a busy weekend, so will go over this more in-depth.

The docs also gave one example, the redis-store, so I checked out their implementation as a reference:
https://github.com/tj/connect-redis/blob/536b465d2cc590a3a6877b816335051da7aeb4df/index.ts#L133

Will re-read both sometime this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] express-session resave required despite touch being implemented

2 participants