Skip to content

feat: add cluster mode support and harden registration validation#33

Open
janisto wants to merge 8 commits intofastify:mainfrom
janisto:cluster-mode
Open

feat: add cluster mode support and harden registration validation#33
janisto wants to merge 8 commits intofastify:mainfrom
janisto:cluster-mode

Conversation

@janisto
Copy link
Copy Markdown

@janisto janisto commented Mar 16, 2026

Adds managed cluster support (clientMode: 'cluster'), strengthens runtime validation (invalid clientMode, empty namespace, and mixed default/namespaced registration rejection), updates typings/tests accordingly, and refreshes README with upgrade notes and corrected async usage/examples.

Fix #31

Checklist

Copilot AI review requested due to automatic review settings March 16, 2026 08:27
Copy link
Copy Markdown
Contributor

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 extends @fastify/valkey-glide to support managed cluster clients via a new clientMode option, tightens registration/option validation (including rejecting mixed default + namespaced registrations), and updates TypeScript typings, tests, and documentation accordingly.

Changes:

  • Add clientMode: 'standalone' | 'cluster' to create either GlideClient or GlideClusterClient, with runtime validation.
  • Enforce stricter registration rules (no mixed default + namespaced usage in the same Fastify instance tree) and validate namespace (empty string rejected).
  • Update TS types + tsd assertions, README examples/upgrade notes, and add/adjust unit tests.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
index.js Adds cluster client creation and mixed-mode detection using an internal namespace-container marker; adds option validation.
types/index.d.ts Updates public TS types to represent fastify.valkey as a union (root client vs namespaced container) and adds cluster option typings.
types/index.test-d.ts Updates tsd tests for the new typings and adds negative assertions that require narrowing.
test/index.test.js Adds unit tests for empty namespace, mixed-mode rejection, and cluster client creation; fixes one close-client test access.
README.md Adds upgrade notes and new examples (cluster + async/await usage).
package.json Bumps package version and broadens the allowed @valkey/valkey-glide semver range.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread index.js Outdated
Comment thread index.js
Comment thread types/index.test-d.ts Outdated
Comment thread README.md Outdated
Comment thread package.json Outdated
@janisto janisto changed the title feat: bump version to 0.3.0, add cluster mode support and harden registration validation feat: add cluster mode support and harden registration validation May 7, 2026
@janisto janisto requested a review from Fdawgs May 7, 2026 12:32
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.

Release a new version with updated dependencies.

3 participants