Skip to content

Added support for subkey notifications - #4040

Merged
petyaslavova merged 10 commits into
masterfrom
vv-subkey-notifications
Apr 27, 2026
Merged

petyaslavova merged 10 commits into
masterfrom
vv-subkey-notifications

Conversation

@vladvildanov

@vladvildanov vladvildanov commented Apr 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description of change

This PR brings a support for subkey notifications feature introduced in Redis 8.8. The design introduces four subkey notification channel families in addition to the existing keyspace and keyevent channels.

Family Channel Payload
subkeyspace __subkeyspace@<db>__:<key> <event>|<subkey_len>:<subkey>[,<subkey_len>:<subkey>...]
subkeyevent __subkeyevent@<db>__:<event> <key_len>:<key>|<subkey_len>:<subkey>[,<subkey_len>:<subkey>...]
subkeyspaceitem __subkeyspaceitem@<db>__:<key>\\n<subkey> <event>
subkeyspaceevent __subkeyspaceevent@<db>__:<event>|<key> <subkey_len>:<subkey>[,<subkey_len>:<subkey>...]

The feature is gated by new notify-keyspace-events flags:

  • S -> subkeyspace
  • T -> subkeyevent
  • I -> subkeyspaceitem
  • V -> subkeyspaceevent

For now the subkey notifications supported only by hash data structure.

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.


Note

Medium Risk
Adds new public subscription APIs and extends KeyNotification parsing to handle new subkey channel wire formats; mistakes could break notification consumers or mis-parse payloads. Risk is mitigated by extensive new sync/async unit + integration tests and version-gated fixtures.

Overview
Adds first-class support for Redis 8.8 subkey-aware keyspace notifications by introducing four new channel families (__subkeyspace, __subkeyevent, __subkeyspaceitem, __subkeyspaceevent) with corresponding channel classes and subscribe_* convenience methods in both sync and asyncio notification managers.

Extends KeyNotification to parse these new channel/payload wire formats (including length-prefixed subkey lists), exposes subkeys and raw data, and updates channel-type detection (ChannelType/get_channel_type) accordingly; exports the new APIs from redis.__init__.

Updates CI to run Redis 8.8 tests against a newer unstable image, adds fixtures to enable the new notify-keyspace-events flags (KEASTIV), and adds comprehensive sync/async test coverage for subkey parsing, pattern subscriptions, and backward compatibility with existing keyspace/keyevent notifications.

Reviewed by Cursor Bugbot for commit ac4eea0. Bugbot is set up for automated code reviews on this repo. Configure here.

@vladvildanov
vladvildanov marked this pull request as draft April 21, 2026 08:45
@jit-ci

jit-ci Bot commented Apr 21, 2026 •

Copy link
Copy Markdown

πŸ›‘οΈ Jit Security Scan Results

CRITICAL HIGH MEDIUM

βœ… No security findings were detected in this PR


Security scan by Jit

@vladvildanov
vladvildanov marked this pull request as ready for review April 24, 2026 07:32

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c0e4d3d. Configure here.

@petyaslavova petyaslavova left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

@petyaslavova
petyaslavova merged commit a3c287f into master Apr 27, 2026
413 of 417 checks passed
@petyaslavova
petyaslavova deleted the vv-subkey-notifications branch April 27, 2026 06:58
@petyaslavova petyaslavova added the feature New feature label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants