Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsubscribe by attributes should check that all events and context ids exist in subscriptions #847

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented Jan 9, 2025

In #828 I also overlooked that removal of subscriptions should only apply if all unsubscribe attributes match existing subscription data. To remain backward compatible, this PR adds steps to account for that and cover the cases like the following:

For events:

subscribe(events=[A, B])
unsubscribe(events=[A]) => works
unsubscribe(events=[A, B]) => expected to throw

For contexts:

subscribe(contexts=[A, B])
unsubscribe(contexts=[A]) => works
unsubscribe(contexts=[A, B]) => expected to throw
subscribe(events=[A])
unsubscribe(events=[A], contexts=[A]) => expected to throw

Preview | Diff

@OrKoN OrKoN force-pushed the orkon/subscription-recover-errors branch from e044d74 to c06c363 Compare January 9, 2025 08:40
@OrKoN OrKoN requested a review from sadym-chromium January 9, 2025 08:43
@OrKoN OrKoN force-pushed the orkon/subscription-recover-errors branch from c06c363 to 636da25 Compare January 9, 2025 09:04
@OrKoN OrKoN force-pushed the orkon/subscription-recover-errors branch from 0e23a4c to 31c2fda Compare January 9, 2025 18:54
@OrKoN OrKoN changed the title Unsubscribe by attributes should only match a subset of subscriptions Unsubscribe by attributes should check that all events and context ids exist in subscriptions Jan 10, 2025
index.bs Outdated
@@ -2107,6 +2136,11 @@ The [=remote end steps=] with |session| and |command parameters| are:

1. [=list/append=] |partial subscription| to |new subscriptions|.

1. If |matched events| does not equal |event names|, return [=error=] with [=error code=] [=invalid argument=].

1. If |top-level traversable context ids| is not empty and |matched contexts| does not equal
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically we can simply compare |matched contexts| and |top-level traversable context ids|, as for global subscriptions they are both empty, for non-global the latest is non-empty. But the current version makes the algo more readable.

@OrKoN OrKoN requested a review from jgraham January 10, 2025 09:42
@OrKoN OrKoN closed this Jan 10, 2025
@OrKoN OrKoN reopened this Jan 10, 2025
@OrKoN
Copy link
Contributor Author

OrKoN commented Jan 10, 2025

@jgraham PTAL (this is another spec regression from my subscription ID refactoring that I discovered while actually working on the implementation, I believe this is the last one).

@OrKoN OrKoN merged commit 2c01081 into main Jan 15, 2025
8 of 9 checks passed
@OrKoN OrKoN deleted the orkon/subscription-recover-errors branch January 15, 2025 10:19
github-actions bot added a commit that referenced this pull request Jan 15, 2025
…s exist in subscriptions (#847)

SHA: 2c01081
Reason: push, by OrKoN

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
OrKoN added a commit that referenced this pull request Jan 17, 2025
…s exist in subscriptions (#847)

* Unsubscribe by attributes should only match a subset of subscriptions

* update algorithm

* use infra for set comparison
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.

3 participants