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

api types: Update InitialDataRealm and RealmDataForUpdate to FL 237 #5806

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

chrisbobbe
Copy link
Contributor

@chrisbobbe chrisbobbe commented Dec 20, 2023

We can use this for #5804 and #5805.


Four of the nine added /register-response fields seem to have a small documentation issue: https://chat.zulip.org/#narrow/stream/412-api-documentation/topic/.60.2Fregister.60.3A.20fields.20missing.20.22Present.20if.20.5B.E2.80.A6.5D.22.3F/near/1707782

For three of them, I didn't find them mentioned in #api design:

realm_can_access_all_users_group
realm_create_multiuse_invite_group
realm_move_messages_between_streams_limit_seconds

@chrisbobbe chrisbobbe requested a review from gnprice December 20, 2023 19:39
@chrisbobbe chrisbobbe changed the title api: Update InitialDataRealm and RealmDataForUpdate to FL 237 api types: Update InitialDataRealm and RealmDataForUpdate to FL 237 Dec 20, 2023
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 taking care of this! Generally all looks good. A few comments below, mainly from making my own pass through the relevant swath of https://zulip.com/api/changelog .

// On future servers, we expect this case will never happen: we'll always include
// a delivery_email when you have access, including when the visibility is Everyone
// https://github.com/zulip/zulip-mobile/pull/5515#discussion_r997731727
// Not reached on FL 163+, where delivery_email is always present.
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
// Not reached on FL 163+, where delivery_email is always present.
// TODO(server-7.0): Not reached on FL 163+, where delivery_email is always present.

Comment on lines 357 to 361
server_needs_upgrade?: boolean,

// TODO(server-8.0): Added in feat. 221
server_supported_permission_settings?: JSONableDict, // unstable
Copy link
Member

Choose a reason for hiding this comment

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

Reading through the changelog, there's also these at FL 164:

POST /register: Added the server_presence_ping_interval_seconds and server_presence_offline_threshold_seconds fields for clients to use when implementing the presence system.

Copy link
Member

Choose a reason for hiding this comment

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

And similarly, at FL 204:

POST /register: Added server_typing_started_wait_period_milliseconds, server_typing_stopped_wait_period_milliseconds, and server_typing_started_expiry_period_milliseconds fields for clients to use when implementing typing notifications protocol.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. The commit is supposed to be about specifically updating InitialDataRealm, and those fields aren't designated

Present if realm is present in fetch_event_types.

. Do you think that's an accident, like the four accidents I reported on CZO?

Also, these are addressed in 47a8b3f and 45951db, respectively.

Copy link
Member

Choose a reason for hiding this comment

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

those fields aren't designated

Present if realm is present in fetch_event_types.

. Do you think that's an accident, like the four accidents I reported on CZO?

Looks like it must be — in zerver/lib/events.py, if you search for those names you find they get set in the if want("realm"): block.

Which has this comment:

    if want("realm"):
        # The realm bundle includes both realm properties and server
        # properties, since it's rare that one would want one and not
        # the other. We expect most clients to want it.

(It goes on from there, but that's the part relevant to this question.)

Also, these are addressed in 47a8b3f

Hmm, yeah, so I put those in InitialDataBase. But given the above, they actually belong in InitialDataRealm.

and 45951db, respectively.

I'd describe that more as skipping addressing it 🙂 More precisely, we skipped there actually looking at these fields (and propagating them through the reducer into RealmState), so as a result we didn't bother adding them to the API type either.

Here, since we're bumping the "This is current to …" note, it'd be good to add these types along the way in order to keep that note accurate. I think the comments in 45951db don't even need any adjustment for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool; this all makes sense. I've noted the fields missing the "if realm is present" note in the relevant CZO discussion: https://chat.zulip.org/#narrow/stream/412-api-documentation/topic/.60.2Fregister.60.3A.20fields.20missing.20.22Present.20if.20.5B.E2.80.A6.5D.22.3F/near/1712821

realm_can_access_all_users_group?: boolean,

// TODO(server-8.0): Added in feat. 209
realm_create_multiuse_invite_group?: number,

Copy link
Member

Choose a reason for hiding this comment

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

Reading through the changelog, here's a small other item at FL 195:

GET /events, POST /register: The default_code_block_language realm setting is now consistently an empty string when no default pygments language code is set. Previously, the server had a bug that meant it might represent no default for this realm setting as either null or an empty string. Clients supporting older server versions should treat either value (null or "") as no default being set.

So the line realm_default_code_block_language: string | null, should get a TODO(server-8.0) comment saying it's just string in current versions.

Comment on lines +185 to +178
// TODO(server-8.0): Added in feat. 225
realm_can_access_all_users_group?: boolean,
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
// TODO(server-8.0): Added in feat. 225
realm_can_access_all_users_group?: boolean,
// TODO(server-8.0): Added in feat. 225
realm_can_access_all_users_group_id?: boolean,

Right?

… Oh huh, the changelog and the /api/register-queue page disagree. The latter says …_group, so I guess that's what it actually is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, interesting, yeah.

Comment on lines 317 to 318
// TODO(server-8.0): Added in feat. 231
realm_push_notifications_enabled_end_timestamp?: boolean,
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
// TODO(server-8.0): Added in feat. 231
realm_push_notifications_enabled_end_timestamp?: boolean,
// TODO(server-8.0): Added in feat. 231
realm_push_notifications_enabled_end_timestamp?: number | null,

since it's "integer | null" in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, thanks for catching!

@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Dec 23, 2023

Thanks for the review! Revision pushed, and please see my comment above: #5806 (comment)

@gnprice
Copy link
Member

gnprice commented Dec 28, 2023

Thanks! Reply above on that one thread. Otherwise all LGTM.

I can't find a message in `#api design` on CZO that's explicitly
about removing realm_email_address_visibility from the register
response. The `#api design` discussion about transitioning that from
an org- to a user-level setting is here:
  https://chat.zulip.org/#narrow/stream/378-api-design/topic/email.20address.20visibility/near/1296131
That discussion includes mentions of the user-object fields that are
about email addresses, and it includes mentions of the per-user
visibility setting, but I don't see anything about removing the
realm setting from the /register response.

In retrospect, its removal there would have been an obvious thing to
anticipate and handle in our types. Oh well, better late than never.

Luckily I don't think there was a user-facing bug here. At FL 163+,
the value that we've been typing as the enum EmailAddressVisibility
will actually be `undefined`, but that's OK because on 163+ we don't
end up doing anything with it.
@chrisbobbe chrisbobbe force-pushed the pr-api-realm-types-update branch from 6b46817 to 5762333 Compare January 3, 2024 22:36
@chrisbobbe chrisbobbe merged commit 5762333 into zulip:main Jan 3, 2024
1 check passed
@chrisbobbe
Copy link
Contributor Author

Thanks for the review! Merged, after addressing that reply.

@chrisbobbe chrisbobbe deleted the pr-api-realm-types-update branch January 3, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants