Assigning depth 0 to the oldest mainline power-levels event collided
with the 0 sentinel for events with no mainline ancestor, breaking ties
by timestamp instead of sorting no-ancestor events strictly earlier as
required by the Matrix spec.
The if condition is designed to make a new comment only once per PR. It
could probably use some further selectivity to only do this for specific
changed files, but we can cross that bridge when we get to it.
The Matrix state resolution spec requires events rejected under
state-at-event checks to be re-authenticated during iterative auth
checks to avoid state divergence across servers; only rejected auth
events should be excluded.
Prefetch rejection status concurrently once per unique event ID to
avoid repeated sequential lookups inside the loop.
Concurrent token refreshes or API requests clearing the previous refresh
token could overwrite userdeviceid_oauthsessioninfo with stale session
state or leave orphaned entries in refreshtoken_refreshtokeninfo.
Guard session mutations with a per-device MutexMap and re-read session
info under the lock when clearing the previous refresh token.
Previously, set_token skipped saving the replaced access token whenever
a previous token entry already existed. If a client refreshed again with
its current refresh token before making a valid API request (such as
after going idle until expiry), a dropped response would leave the
server holding an older access token and cause a hard logout.
Let callers explicitly specify whether to clear, replace, or preserve
the previous access token.
Candidate filtering previously checked unrequested old keys and tracked
all response keys as satisfied even when criteria failed. Passing the
lowest requested minimum_valid_until_ts to origin_request also avoids
rejecting valid historical queries.
Main changed the way we handle server signing keys to carry both the deserialised and serialised copy, so the notary code needs updating to use the right copy in several places (some places need to use the raw value, some need to use the serialised value).