Skip to content

channel: Maintain maps consistently when removing subscriptions #1479

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

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented Apr 23, 2025

When a subscription is removed, the data in streams and streamsByName are left as instances of Subscription. This is inconsistent with the data store's assumption that unsubscribed channels should have plain ZulipStream instances.

This doesn't seem to have user-facing effects, though. The assertion errors only affect debug builds.

CZO discussion:
https://chat.zulip.org/#narrow/channel/48-mobile/topic/Unsubscribe.20then.20resubscribe.20to.20channel/with/2160241

@PIG208 PIG208 requested a review from chrisbobbe April 23, 2025 20:54
@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label Apr 23, 2025
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM! Marking for Greg's review.

@chrisbobbe chrisbobbe requested a review from gnprice April 24, 2025 21:24
@chrisbobbe chrisbobbe assigned gnprice and unassigned chrisbobbe Apr 24, 2025
@chrisbobbe chrisbobbe added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Apr 24, 2025
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Just a couple of nits below.

@@ -68,6 +68,22 @@ void main() {
));
checkUnified(store);
});

test('removed then added by events', () async {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
test('removed then added by events', () async {
test('unsubscribed then subscribed by events', () async {

The group is about "stream/sub data" in general, so this otherwise sounds like it's probably about removing the whole stream.

Copy link
Member

Choose a reason for hiding this comment

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

Separately, since this is a regression test for a particular bug that we actually had, let's link that context:

Suggested change
test('removed then added by events', () async {
test('removed then added by events', () async {
// Regression test for: https://chat.zulip.org/#narrow/channel/48-mobile/topic/Unsubscribe.20then.20resubscribe.20to.20channel/with/2160241

@PIG208
Copy link
Member Author

PIG208 commented Apr 25, 2025

Thanks! Updated the PR.

When a subscription is removed, the data in streams and streamsByName
are left as instances of `Subscription`.  This is inconsistent with the
data store's assumption that unsubscribed channels should have plain
`ZulipStream` instances.

This doesn't seem to have user-facing effects, though.  The assertion
errors only affect debug builds.

CZO discussion:
  https://chat.zulip.org/#narrow/channel/48-mobile/topic/Unsubscribe.20then.20resubscribe.20to.20channel/with/2160241
@gnprice
Copy link
Member

gnprice commented Apr 26, 2025

Thanks! Looks good; merging.

@gnprice gnprice merged commit 5c812e7 into zulip:main Apr 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants