Skip to content

Comments

[FIXED] Consumer with overlapping filter subjects but not subset#7810

Merged
neilalexander merged 1 commit intomainfrom
maurice/consumer-overlapping-filter-subs
Feb 9, 2026
Merged

[FIXED] Consumer with overlapping filter subjects but not subset#7810
neilalexander merged 1 commit intomainfrom
maurice/consumer-overlapping-filter-subs

Conversation

@MauriceVanVeen
Copy link
Member

A consumer should be allowed to have filter subjects like event.foo.* and event.*.foo. They do collide but one isn't a subset of the other, but it currently fails as having overlapping subjects. This PR relaxes this check by allowing this former case, but still preventing having filter subjects like event.> and event.foo/event.*.foo/etc. since those are subsets (which was maybe too eagerly changed in #5224, as it used to be subjectIsSubsetMatch before).

Resolves #7779

Signed-off-by: Maurice van Veen github@mauricevanveen.com

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner February 9, 2026 11:05
wallyqs pushed a commit to wallyqs/nats-server that referenced this pull request Feb 9, 2026
Detailed review of the change from SubjectsCollide to subjectIsSubsetMatch
for consumer filter subject validation. Confirms the change is safe with
respect to duplicate delivery, NumPending counting, and work-queue consumers.

https://claude.ai/code/session_01KQLYhCHEvYZXFtHLaoCo4C
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM

@neilalexander neilalexander merged commit cfc1de8 into main Feb 9, 2026
90 of 92 checks passed
@neilalexander neilalexander deleted the maurice/consumer-overlapping-filter-subs branch February 9, 2026 11:39
wallyqs pushed a commit to wallyqs/nats-server that referenced this pull request Feb 9, 2026
Apply the production change from PR nats-io#7810 (SubjectsCollide ->
subjectIsSubsetMatch) and add comprehensive test coverage:

- TestJetStreamConsumerAllowOverlappingSubjectsIfNotSubset: original PR test
  verifying two-way overlap with delivery correctness (7 unique messages)
- TestJetStreamConsumerOverlappingSubjectsThreeWay: three overlapping-but-not-
  subset filters confirming 10 unique messages with no duplicates
- TestJetStreamConsumerSubsetFiltersStillRejected: table-driven tests covering
  5 reject cases (fwc/pwc subset relationships) and 4 allow cases (cross-
  wildcard, triple-cross, disjoint literals/wildcards)

Also updates the comment at consumer.go:822 to reflect the new semantics.

https://claude.ai/code/session_01KQLYhCHEvYZXFtHLaoCo4C
wallyqs pushed a commit to wallyqs/nats-server that referenced this pull request Feb 9, 2026
Apply the production change from PR nats-io#7810 (SubjectsCollide ->
subjectIsSubsetMatch) and add comprehensive test coverage:

- TestJetStreamConsumerAllowOverlappingSubjectsIfNotSubset: original PR test
  verifying two-way overlap with delivery correctness (7 unique messages)
- TestJetStreamConsumerOverlappingSubjectsThreeWay: three overlapping-but-not-
  subset filters confirming 10 unique messages with no duplicates
- TestJetStreamConsumerSubsetFiltersStillRejected: table-driven tests covering
  5 reject cases (fwc/pwc subset relationships) and 4 allow cases (cross-
  wildcard, triple-cross, disjoint literals/wildcards)

Also updates the comment at consumer.go:822 to reflect the new semantics.

https://claude.ai/code/session_01KQLYhCHEvYZXFtHLaoCo4C
neilalexander added a commit that referenced this pull request Feb 16, 2026
Includes the following:

- #7780
- #7784
- #7782
- #7783
- #7787
- #7789
- #7793
- #7797
- #7798
- #7799
- #7790
- #7805
- #7810
- #7811
- #7812
- #7809
- #7724
- #7815
- #7816
- #7818
- #7819
- #7820
- #7795
- #7825
- #7828
- #7835
- #7837

Signed-off-by: Neil Twigg <neil@nats.io>
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.

Support overlapping subject filters within a single consumer

2 participants