matrix-org / matrix-org/gomatrixserverlib

Improperly falling back to unstable endpoint for room hierarchies

Open
#406 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
67
Forks
60
PR merge metrics
No merged PRs in 30d

Description

In [`federationclient.go / RoomHierarchy`](https://github.com/matrix-org/gomatrixserverlib/blob/1b697d109d8781f9a1aba3b6f2a49de7bcae5fa6/fclient/federationclient.go#L713), we fall back to the unstable endpoint if the spec endpoint returns 404.

However, the [spec](https://spec.matrix.org/v1.7/server-server-api/#get_matrixfederationv1hierarchyroomid) states that 404 is a valid response of this endpoint, in the case where a room is unknown or the server is otherwise unable to peek it. But the error that is ultimately returned isn't this 404, but rather another `M_UNRECOGNIZED` 404 error from the unstable endpoint.

This just obfuscates the original error, making logs harder to interpret - perhaps we should not just check for 404 on the spec endpoint but also check for `M_UNRECOGNIZED` before falling back to unstable, and if both the unstable and spec endpoints error, somehow pass on both errors with some information that we re-tried.

Or maybe, since MSC2946 has been spec for quite a while, we just remove the whole fallback to unstable mechanism in the first place?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in fclient/federationclient.go at RoomHierarchy and compare its 404 fallback with the linked Matrix v1.7 endpoint specification. Resolve whether the unstable fallback remains supported, then verify that an unknown or unpeekable room preserves the meaningful spec response and that the chosen retry behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.