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

Ensure all server events and their operations are handled #3408

Open
9 of 42 tasks
borisyankov opened this issue Mar 16, 2019 · 5 comments
Open
9 of 42 tasks

Ensure all server events and their operations are handled #3408

borisyankov opened this issue Mar 16, 2019 · 5 comments
Labels
a-data-sync Zulip's event system, event queues, staleness/liveness

Comments

@borisyankov
Copy link
Contributor

borisyankov commented Mar 16, 2019

We are handling almost all server events and the majority of their operations.
The ones not being handled have not been a priority to implement until now.

With the approaching implementation of Queue 2.0 we will stop refreshing our internal state frequently and it will be essential for the state consistency to add handling for the remaining ones.


[We've edited this list over time to try to keep it up to date. -- Greg]

For documentation of each of these, see: https://zulip.com/api/get-events

Since #5310, see also the event types we explicitly ignore at the end of eventToAction. (Many of those are for product features we simply don't support, though, and those are out of scope for this issue -- we'll handle them as part of adding those features.)

borisyankov added a commit to borisyankov/zulip-mobile that referenced this issue Mar 17, 2019
Fixes zulip#3397 Part of zulip#3408

Handles the three types of user data updates possible:
* full name
* avatar
* custom profile field

Extra care is taken not to mutate the state if not necessary.

This is done for two reasons:
 * currently editing values throught he web app causes two events,
   one of which is not necessary (maybe should be fixed)
 * this is likely the largest state, doing an extra `isEqual` can
   save copying all this data
@gnprice
Copy link
Member

gnprice commented Mar 21, 2019

Thanks @borisyankov for writing this up!

I just added a few items; if I see more in this category I'll add them too.

@chrisbobbe
Copy link
Contributor

If "Queue 2.0" is "long-lived event queues," linking #3916.

Also, just added stream_occupy to deduplicate #2604.

@gnprice
Copy link
Member

gnprice commented Feb 26, 2020

If "Queue 2.0" is "long-lived event queues,"

Yep, that's right. Thanks!

@chrisbobbe
Copy link
Contributor

Quoting Tim from zulip/zulip#10044 (comment):

For events, from a mobile team perspective, one useful existing resource is the schema definitions in test_events.py. E.g.

    def test_update_message_flags(self) -> None:                                                     
        # Test message flag update events                                                            
        schema_checker = self.check_events_dict([                                                    
            ('all', check_bool),                                                                     
            ('type', equals('update_message_flags')),                                                
            ('flag', check_string),                                                                  
            ('messages', check_list(check_int)),                                                     
            ('operation', equals("add")),                                                            
        ])                                                                                           
                                                                                                     
        message = self.send_personal_message(                                                        
            self.example_email("cordelia"),                                                          
            self.example_email("hamlet"),                                                            
            "hello",                                                                                 
        )                                                                                            
        user_profile = self.example_user('hamlet')                                                   
        events = self.do_test(                                                                       
            lambda: do_update_message_flags(user_profile, 'add', 'starred', [message]),              
            state_change_expected=False,                                                             
        )                                                                                            
        error = schema_checker('events[0]', events[0])                                               
        self.assert_on_error(error)                                                                  
        schema_checker = self.check_events_dict([                                                    
            ('all', check_bool),                                                                     
            ('type', equals('update_message_flags')),                                                
            ('flag', check_string),                                                                  
            ('messages', check_list(check_int)),                                                     
            ('operation', equals("remove")),                                                         
        ])                                                                                           

I think if we were to provide schema documentation for the events, I'd want it to be something that shares code with these tests, so it doesn't get stale, but I think a reasonable v1 for the mobile folks would be to ensure everyone's familiar with how to read the test_events tests, since they generally have complete coverage for the corner cases around a given event.

(And display_recipient is quite rare in being a concept that has variable type; almost all events are very consistently structured)

@gnprice
Copy link
Member

gnprice commented May 20, 2021

An update to this issue's description: happily, this part of the Zulip API is now documented!
https://zulip.com/api/get-events

So the reverse-engineering discussed above should no longer be necessary.

gnprice added a commit to gnprice/zulip-mobile that referenced this issue Feb 23, 2022
This handles part of zulip#3408, closely related to zulip#2688.  In particular
this means that if you find one of these messages in an interleaved
view where recipient headers are shown, the recipient header will
take you to the correct narrow.

The FlowIssue line here is essentially the same as one in the code we
removed here a couple of commits ago.
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Feb 25, 2022
This handles part of zulip#3408, closely related to zulip#2688.  In particular
this means that if you find one of these messages in an interleaved
view where recipient headers are shown, the recipient header will
take you to the correct narrow.

We actually did handle topic edits, but only for a single message,
and didn't handle moves between streams.
chrisbobbe pushed a commit to gnprice/zulip-mobile that referenced this issue Mar 2, 2022
This handles part of zulip#3408, closely related to zulip#2688.  In particular
this means that if you find one of these messages in an interleaved
view where recipient headers are shown, the recipient header will
take you to the correct narrow.

We actually did handle topic edits, but only for a single message,
and didn't handle moves between streams.
chrisbobbe pushed a commit to gnprice/zulip-mobile that referenced this issue Mar 2, 2022
This handles part of zulip#3408, closely related to zulip#2688.  In particular
this means that if you find one of these messages in an interleaved
view where recipient headers are shown, the recipient header will
take you to the correct narrow.

We actually did handle topic edits, but only for a single message,
and didn't handle moves between streams.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-data-sync Zulip's event system, event queues, staleness/liveness
Projects
None yet
Development

No branches or pull requests

3 participants