feat: Implement MSC4188: Handling 410 Gone Status in Matrix Server Discovery #39

Merged
silversys merged 6 commits from nex/feat/MSC4188 into main 2026-10-12 21:28:07 +00:00
Owner

Implements MSC4188: Handling 410 Gone Status in Matrix Server Discovery with the feature flag unstable-msc4188. The 410 status code is honoured and the server is treated as unresolvable with the new ServerResolutionError::Gone error.

Closes #38
Closes continuwuation/continuwuity#644

Implements [MSC4188: Handling 410 Gone Status in Matrix Server Discovery](https://github.com/matrix-org/matrix-spec-proposals/pull/4188) with the feature flag `unstable-msc4188`. The 410 status code is honoured and the server is treated as unresolvable with the new `ServerResolutionError::Gone` error. Closes #38 Closes https://forgejo.ellis.link/continuwuation/continuwuity/issues/644
fix: Handle response error in correct location
All checks were successful
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m1s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 4m15s
2480f8b48e
nex requested reviews from Jade, silversys 2026-10-09 22:16:44 +00:00
src/server.rs Outdated
@ -1245,0 +1347,4 @@
let resolver = Arc::new(MatrixResolver::new().unwrap());
// This server always returns HTTP 410 to `/.well-known/matrix/server`
let server_name = "graveyard.matrix.nexy7574.co.uk";
Member

could this be a parameter instead of a constant in the test itself? would make testing towards other servers in the future a lot easier

could this be a parameter instead of a constant in the test itself? would make testing towards other servers in the future a lot easier
silversys marked this conversation as resolved
silversys requested changes 2026-10-10 17:35:04 +00:00
Dismissed
src/server.rs Outdated
@ -506,0 +556,4 @@
tracing::debug!(
?url,
status = status.as_u16(),
"Response status not 200 when fetching .well-known"
Member

instead of having an "if not OK" for the MSC being disabled, and a match for it being enabled, can we just use the same match for both (and add special handling for gone)

instead of having an "if not OK" for the MSC being disabled, and a match for it being enabled, can we just use the same match for both (and add special handling for gone)
Author
Owner

I don't like the idea of having special handling for it when the spec does explicitly say non-200 and only the MSC modifies that clause. unless you mean something else?

I don't like the idea of having special handling for it when the spec does explicitly say non-200 and only the MSC modifies that clause. unless you mean something else?
Member

pseudocode example of what I mean:

match status {
  case 200 = ...
  #[if MSC]
  case 401 = ...
  else ...
}

that would let us keep the existing behaviour (accept 200s, error otherwise) and easily add the 401 case on top of it

pseudocode example of what I mean: ``` match status { case 200 = ... #[if MSC] case 401 = ... else ... } ``` that would let us keep the existing behaviour (accept 200s, error otherwise) and easily add the 401 case on top of it
Member

i just now realized this is supposed to be 410 not 401

i assume you knew but uh im stupid :3

i just now realized this is supposed to be 410 not 401 i assume you knew but uh im stupid :3
silversys marked this conversation as resolved
@ -616,3 +674,3 @@
}
/// Clear entire cache
/// Removes a specific server from the [MSC4188] gone cache.
Member

missing a target url for the [] here?

missing a target url for the [] here?
silversys marked this conversation as resolved
chore: Parametarize testcase
Some checks failed
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
534e356b3b
chore: Add missing MSC link
Some checks failed
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m25s
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
d74ef21479
chore: Replace two #[cfg] statements with one simplified
All checks were successful
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 42s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 1m39s
Checks / Prek / Pre-commit & Formatting (push) Successful in 1m59s
Checks / Prek / Clippy and Cargo Tests (push) Successful in 4m20s
2711a48252
silversys approved these changes 2026-10-11 18:15:41 +00:00
silversys removed review request for Jade 2026-10-12 21:28:03 +00:00
silversys deleted branch nex/feat/MSC4188 2026-10-12 21:28:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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/resolvematrix!39
No description provided.