fix: Properly disable some functionality when related experiments aren't enabled #2533

Merged
nex merged 10 commits from nex/fix/more-experiments into main 2026-11-19 18:44:07 +00:00
Owner

#2517 introduced the new experiments policy, but forgot to hook half of the experiments up to actual code functionality. This PR plugs that gap, and also adds a couple proposals that I missed our implementation of.

Pull request checklist:

  • This pull request targets the main branch, and the branch is named something other than
    main.
  • I have written an appropriate pull request title and my description is clear.
  • I understand I am responsible for the contents of this pull request.
  • I have followed the contributing guidelines:
#2517 introduced the new experiments policy, but forgot to hook half of the experiments up to actual code functionality. This PR plugs that gap, and also adds a couple proposals that I missed our implementation of. **Pull request checklist:** <!-- You need to complete these before your PR can be considered. If you aren't sure about some, feel free to ask for clarification in #dev:continuwuity.org. --> - [x] This pull request targets the `main` branch, and the branch is named something other than `main`. - [x] I have written an appropriate pull request title and my description is clear. - [x] I understand I am responsible for the contents of this pull request. - I have followed the [contributing guidelines][c1]: - [x] My contribution follows the [code style][c2], if applicable. - [x] I ran [pre-commit checks][c1pc] before opening/drafting this pull request. - [ ] I have [tested my contribution][c1t] (or proof-read it for documentation-only changes) myself, if applicable. This includes ensuring code compiles. - [x] My commit messages follow the [commit message format][c1cm] and are descriptive. <!-- Notes on these requirements: - While not required, we encourage you to sign your commits with GPG or SSH to attest the authenticity of your changes. - While we allow LLM-assisted contributions, we do not appreciate contributions that are low quality, which is typical of machine-generated contributions that have not had a lot of love and care from a human. Please do not open a PR if all you have done is asked ChatGPT to tidy up the codebase with a +-100,000 diff. - In the case of code style violations, reviewers may leave review comments/change requests indicating what the ideal change would look like. For example, a reviewer may suggest you lower a log level, or use `match` instead of `if/else` etc. - In the case of code style violations, pre-commit check failures, minor things like typos/spelling errors, and in some cases commit format violations, reviewers may modify your branch directly, typically by making changes and adding a commit. Particularly in the latter case, a reviewer may rebase your commits to squash "spammy" ones (like "fix", "fix", "actually fix"), and reword commit messages that don't satisfy the format. - Pull requests MUST pass the `Checks` CI workflows to be capable of being merged. This can only be bypassed in exceptional circumstances. If your CI flakes, let us know in matrix:r/dev:continuwuity.org. - Pull requests have to be based on the latest `main` commit before being merged. If the main branch changes while you're making your changes, you should make sure you rebase on main before opening a PR. Your branch will be rebased on main before it is merged if it has fallen behind. - We typically only do fast-forward merges, so your entire commit log will be included. Once in main, it's difficult to get out cleanly, so put on your best dress, smile for the cameras! --> [c1]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md [c2]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/docs/development/code_style.mdx [c1pc]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#pre-commit-checks [c1t]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#running-tests-locally [c1cm]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#commit-messages
This proposal is still itself a draft, not even ready for review, so we definitely shouldn't enable it by default per the policy.
chore: Regenerate config reference
Some checks failed
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 4s
Checks / Prek / Check changed files (pull_request) Successful in 8s
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 9s
Documentation / Build and Deploy Documentation (pull_request) Successful in 1m7s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m13s
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
42fedc55dc
chore: Add changelog
All checks were successful
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 30s
Checks / Prek / Check changed files (pull_request) Successful in 5s
Documentation / Build and Deploy Documentation (pull_request) Successful in 1m0s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m12s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 9m10s
66a30abff8
nex requested review from Owners 2026-11-15 14:21:28 +00:00
ginger requested changes 2026-11-15 15:09:58 +00:00
Dismissed
@ -344,3 +346,3 @@
let mut scopes = BTreeSet::from_iter([OAuthClientScope::ApiFullAccess]);
if services.admin.user_is_admin(&sender_user).await {
if services.config.experiments.msc4484.is_enabled()
Owner

this will break the admin routes. we enable the ruma msc4484 feature flag, so the scope list for the admin routes always includes the admin oauth scope, meaning that this change will just make them unusable for admins.

this will break the admin routes. we enable the ruma msc4484 feature flag, so the scope list for the admin routes always includes the admin oauth scope, meaning that this change will just make them unusable for admins.
Author
Owner

I thought it'd break something. How do you think I should approach this then? I'm not too familiar with the admin scope stuff

I thought it'd break something. How do you think I should approach this then? I'm not too familiar with the admin scope stuff
Owner

there isn't really a good approach tbh, I'll give it some thought

there isn't really a good approach tbh, I'll give it some thought
Owner

I think the best way to do it is, if the MSC is disabled:

  1. in the auth code, if the user is an admin, unconditionally add the admin scope to the scope set, including on the oauth branch
  2. in the oauth code, forbid attempts to request the scope for new devices. existing devices can keep it, including during token refresh, it just won't do anything.
  3. revert the change to to_scopes, it's ugly and not RFC-compliant
I think the best way to do it is, if the MSC is disabled: 1. in the auth code, if the user is an admin, _unconditionally_ add the admin scope to the scope set, including on the oauth branch 2. in the oauth code, forbid attempts to request the scope for _new_ devices. existing devices can keep it, including during token refresh, it just won't do anything. 3. revert the change to `to_scopes`, it's ugly and not RFC-compliant
Author
Owner

I think c95f3afc85 solves this?

I think c95f3afc85c5e6f2e31d447e9b75d21ef0d010d5 solves this?
ginger marked this conversation as resolved
fix: Work around MSC4484 lockout when disabled
All checks were successful
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 7s
Checks / Prek / Check changed files (pull_request) Successful in 7s
Documentation / Build and Deploy Documentation (pull_request) Successful in 1m2s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m18s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 9m53s
c95f3afc85
nex requested review from ginger 2026-11-15 15:54:43 +00:00
nex added this to the 26.11.0 milestone 2026-11-15 17:43:53 +00:00
Aranjedeath left a comment

works as advertised

works as advertised
@ -67,2 +71,4 @@
"vapid": services.pusher.webpush_vapid_public_key()
}),
)?;
Member

Was redirected from #2542 but not sure where to leave a review. Please make sure that sticky events is natively supported and that org.matrix.msc4354 is advertised in /versions.

Was redirected from #2542 but not sure where to leave a review. Please make sure that sticky events is natively supported and that `org.matrix.msc4354` is advertised in `/versions`.
Author
Owner

You were misinformed that the issue was introduced in this PR, it was actually just in main, and addressed by b3d099a52a. I don't think this PR has been rebased yet though

You were misinformed that the issue was introduced in this PR, it was actually just in main, and addressed by b3d099a52aa9b018edf25f7a13901f350568df1b. I don't think this PR has been rebased yet though
stratself marked this conversation as resolved
ginger approved these changes 2026-11-19 18:43:30 +00:00
nex merged commit 49207a42f8 into main 2026-11-19 18:44:07 +00:00
nex deleted branch nex/fix/more-experiments 2026-11-19 18:44:08 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
continuwuation/continuwuity!2533
No description provided.