Skip to content

Make session.driver optional in config schema#15208

Merged
matthewp merged 5 commits into
nextfrom
session-driver-optional
Jan 15, 2026
Merged

Make session.driver optional in config schema#15208
matthewp merged 5 commits into
nextfrom
session-driver-optional

Conversation

@matthewp

Copy link
Copy Markdown
Contributor

Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users should be able to configure session options (like ttl) without explicitly specifying a driver.

Changes

Testing

Added test case to packages/astro/test/units/config/config-validate.test.js

Docs

N/A, bug fix

@changeset-bot

changeset-bot Bot commented Jan 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6c24dc1

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

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

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label Jan 14, 2026
Adapters like Cloudflare, Netlify, and Node provide default session drivers,
so users should be able to configure session options (like ttl) without
explicitly specifying a driver.

Fixes #15202
@matthewp matthewp force-pushed the session-driver-optional branch from c74d085 to 507260d Compare January 14, 2026 21:49
@github-actions

github-actions Bot commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

⚠️ Package Trust Level Decreased

Caution

Decreased trust levels may indicate a higher risk of supply chain attacks. Please review these changes carefully.

📦 Package 🔒 Before 🔓 After
@cloudflare/kv-asset-handler trusted-with-provenance none
@cloudflare/unenv-preset trusted-with-provenance none
workerd trusted-with-provenance none
ts-api-utils provenance none
miniflare trusted-with-provenance none
youch provenance none
@cloudflare/workerd-darwin-64 trusted-with-provenance none
@cloudflare/workerd-darwin-arm64 trusted-with-provenance none
@cloudflare/workerd-linux-64 trusted-with-provenance none
@cloudflare/workerd-linux-arm64 trusted-with-provenance none
@cloudflare/workerd-windows-64 trusted-with-provenance none
wrangler trusted-with-provenance none

@matthewp matthewp marked this pull request as ready for review January 14, 2026 22:38

@florian-lefebvre florian-lefebvre 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.

I think you need to also update session/types.ts. There are several instances of driver: ... to update.

Once the types are updated, can you also add a type test in packages/astro/test/types/define-config.ts maybe?

Comment thread .changeset/hojze-jglnm-ggfbv.md Outdated

@ematipico ematipico 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. Should address Florian's suggestion

matthewp and others added 2 commits January 15, 2026 07:57
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
TDriver,
] extends [never]
? UnstorageConfig<keyof BuiltinDriverOptions>
? CustomConfig

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.

Is it possible to keep the unstorage config as the default somehow? IIRC from my tests it was the only way to keep autocomplete for now. Maybe try to update UnstorageConfig driver property to be optional

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's odd, it's essentially the same as CustomConfig, but sure, can try that.

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.

Yeah I know it's weird. If the autocomplete works in the current state then we're good!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this: 9b99f4f

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't check autocomplete with the previous change but this one works.

@matthewp matthewp merged commit 8dbdd8e into next Jan 15, 2026
42 checks passed
@matthewp matthewp deleted the session-driver-optional branch January 15, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants