Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Move experimental features MSC3026, MSC3881, and MSC3967 to per-user flags #15345

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Mar 28, 2023

This is a follow up to #15344 (and is based on that branch) which actually implements moving the features from the experimental config to per-user flags.

@H-Shay H-Shay requested a review from a team as a code owner March 28, 2023 22:11
@H-Shay H-Shay marked this pull request as draft March 28, 2023 22:20
@H-Shay H-Shay removed the request for review from a team March 28, 2023 22:20
@H-Shay H-Shay self-assigned this Apr 20, 2023
Base automatically changed from shay/experimental_flags to develop April 28, 2023 18:33
@H-Shay H-Shay force-pushed the shay/experimental_flags_part_2 branch 3 times, most recently from d8e9080 to 19e26c5 Compare May 2, 2023 03:14
@H-Shay H-Shay force-pushed the shay/experimental_flags_part_2 branch from 19e26c5 to 15dd372 Compare May 2, 2023 04:06
@H-Shay H-Shay changed the title Move experimental features MSC3026, MSC2654, MSC3881, and MSC3967 to per-user flags Move experimental features MSC3026, MSC3881, and MSC3967 to per-user flags May 2, 2023
@H-Shay H-Shay force-pushed the shay/experimental_flags_part_2 branch from 73cf3c3 to e8c571b Compare May 2, 2023 18:51
@H-Shay H-Shay marked this pull request as ready for review May 2, 2023 19:14
@H-Shay H-Shay requested a review from a team May 5, 2023 14:58
Copy link
Member

@clokep clokep left a comment

Choose a reason for hiding this comment

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

Looks reasonable overall. The main thing that scares me a bit is that we don't have a single spot we're checking logic. Let me know if you want to discuss!

changelog.d/15345.feature Outdated Show resolved Hide resolved
synapse/handlers/presence.py Outdated Show resolved Hide resolved
synapse/rest/client/sync.py Outdated Show resolved Hide resolved
Comment on lines 98 to +99
# Supports the busy presence state described in MSC3026.
"org.matrix.msc3026.busy_presence": self.config.experimental.msc3026_enabled,
"org.matrix.msc3026.busy_presence": True,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is really accurate -- don't we need to check this based on which user is requesting /versions?

For example, a client might use this to enable UI allowing users to say they're busy. The user would then receive an unexpected error when attempting to use that feature.

(Similar feedback to below for MSC3881)

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 I think you're right - it would be True or False based on either the config or whether the feature is enabled in the DB, but how would that be checked here per user? Is it possible to extract the username from the GET request to /versions (my suspicion is no?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevermind I figured it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I thought I figured it out but since /versions doesn't require authentication there's no access token to extract the user id from. Is there a way to figure out the user id from a request that doesn't require authentication? If not, what's the best way to handle what /versions should return here if we can't determine the user (and thus cannot check if it is enabled per user)?

Copy link
Contributor

@reivilibre reivilibre May 9, 2023

Choose a reason for hiding this comment

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

The only thing I can think of is to make it optionally accept authentication and ask the clients to pretty please change their request code so it sends auth for /versions if they want to use unstable features... :/

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I wonder if we should start putting unstable features in /capabilities API (which is authed) instead?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I wonder if we should start putting unstable features in /capabilities API (which is authed) instead?

I think at some point I was told to prefer /versions over /capabilities, but after some searching I can't seem to find a reference to this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't seem to find a reference to this.

It's in the spec: https://spec.matrix.org/v1.6/client-server-api/#capabilities-negotiation
The relevant bit is:

This system should not be used to advertise unstable or experimental features - this is better done by the /versions endpoint.

Given this it seems like Oliver's suggestion is the way to go? Any other suggestions I should consider?

Copy link
Member

Choose a reason for hiding this comment

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

Given this it seems like Oliver's suggestion is the way to go? Any other suggestions I should consider?

I'd probably double check if clients would be willing to do this first?

Copy link
Member

Choose a reason for hiding this comment

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

MSC4026 was written for this, it has now passed FCP.

synapse/storage/databases/main/experimental_features.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/experimental_features.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/experimental_features.py Outdated Show resolved Hide resolved
tests/handlers/test_presence.py Outdated Show resolved Hide resolved
from synapse.types import JsonDict, UserID

if TYPE_CHECKING:
from synapse.server import HomeServer


class ExperimentalFeature(str, Enum):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was moved to the experimental features database class to avoid a circular import that occurred when using this type in the presence handler.

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants