Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return some room data in Sliding Sync /sync #17320

Merged
merged 75 commits into from
Jul 2, 2024

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Jun 17, 2024

Return some room data in Sliding Sync /sync:

  • Timeline events
  • Stripped invite_state

Based on MSC3575: Sliding Sync

Dev notes

SYNAPSE_POSTGRES=1 SYNAPSE_POSTGRES_USER=postgres SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sliding_sync
SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sliding_sync

SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.rest.client.test_sync.SlidingSyncTestCase

SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.storage.test_stream

Handle state resets

See #17320 (comment)

Commit: 81c06be

SELECT
    COALESCE(e.event_id, e_by_stream.event_id) AS event_id,
    s.prev_event_id,
    s.room_id,
    s.instance_name,
    COALESCE(e.stream_ordering, e_by_stream.stream_ordering, s.stream_id) AS stream_ordering,
    COALESCE(m.membership, m_by_stream.membership) AS membership,
    COALESCE(e.sender, e_by_stream.sender) AS sender,
    m_prev.membership AS prev_membership
FROM current_state_delta_stream AS s
    LEFT JOIN events AS e ON e.event_id = s.event_id
    LEFT JOIN room_memberships AS m ON m.event_id = s.event_id
    LEFT JOIN room_memberships AS m_prev ON s.prev_event_id = m_prev.event_id
    LEFT JOIN events AS e_by_stream ON e_by_stream.stream_ordering = s.stream_id
        AND e_by_stream.type = ?
        AND e_by_stream.state_key = ?
    LEFT JOIN room_memberships AS m_by_stream ON m_by_stream.event_stream_ordering = s.stream_id
        AND m_by_stream.user_id = ?
WHERE s.stream_id > ? AND s.stream_id <= ?
    AND s.type = ?
    AND s.state_key = ?
ORDER BY s.stream_id ASC

Other references

Dumping database tables during tests:

events_db_dump = self.get_success(
    self.store.db_pool.simple_select_list(
        table="events",
        keyvalues={},
        retcols=["*"],
        desc="debug dump events",
    )
)

logger.info("events_db_dump: %s", events_db_dump)

current_state_delta_stream_db_dump = self.get_success(
    self.store.db_pool.simple_select_list(
        table="current_state_delta_stream",
        keyvalues={},
        retcols=["*"],
        desc="debug dump current_state_delta_stream",
    )
)

logger.info(
    "current_state_delta_stream_db_dump: %s", current_state_delta_stream_db_dump
)

Token comparison:

is_before_or_eq
persisted_after
wait_for_stream_token


Membership:

get_rooms_for_local_user_where_membership_is(...)
get_membership_changes_for_user(...)


State:

get_state_at(...)

Potential name: get_current_state_at(...)
Potential name: get_membership_in_rooms_at_token_for_user(...)

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

@@ -167,7 +164,6 @@ class IncludeOldRooms(RequestBodyModel):
timeline_limit: int
else:
timeline_limit: conint(le=1000, strict=True) # type: ignore[valid-type]
include_old_rooms: Optional[IncludeOldRooms] = None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing include_old_rooms because we will opt to always include old rooms (easiest option).

sliding_sync_result: SlidingSyncResult,
) -> JsonDict:
response: JsonDict = defaultdict(dict)

response["next_pos"] = await sliding_sync_result.next_pos.to_string(self.store)
response["pos"] = await sliding_sync_result.next_pos.to_string(self.store)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just updating this field to match the MSC3575. next_pos sounds better to me but I assume pos was originally chosen to save on bytes and this can throw this in the bikeshed for later.

@MadLittleMods MadLittleMods force-pushed the madlittlemods/sliding-sync-room-data branch from ea2f8d4 to 1c06153 Compare June 19, 2024 03:31
Comment on lines 832 to 833
# TODO: Does `newly_joined` affect `limited`? It does in sync v2 but I fail
# to understand why.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does newly_joined affect limited? It does in sync v2 but I fail to understand why. The logic there is also messy and redundant.

limited also plays into bundled_aggregations which mentions "This is only calculated if limited is true." but the logic to decide to bundle aggregations vs limited is not the same although I think it may be equivalent because of the redundant/messy nature of the logic there.

Copy link
Member

Choose a reason for hiding this comment

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

I think we also need to set limited to true if newly_joined. We need to handle the case where we've done a remote join (and so paginate events will only return the one join event), and we want limited to be true so clients not to paginate (and so trigger backfill).

We also need to handle the timeline_gaps logic from sync v2 as well. But that can wait.

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 think the newly_joined remote room case would be handled by checking for timeline gaps which I'll be tackling in a follow-up (already has a TODO).

I can't think of a reason why newly_joined would affect limited specifically though.

Comment on lines +873 to +877
# Update the `prev_batch_token` to point to the position that allows us to
# keep paginating backwards from the oldest event we return in the timeline.
prev_batch_token = prev_batch_token.copy_and_replace(
StreamKeyType.ROOM, new_room_key
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reviewer, please double-check the limited and prev_batch_token logic.

It's unclear how these fields should be set in cases where the user's room membership is invite with shared/joined history visibility where they can't see any timeline events until they join.

Where should the prev_batch token be pointing to? If we do it just like other rooms, we paginate up to the timeline_limit, then all of those events are filtered out (because we're not joined yet) and the prev_batch token points to a place before those events that we never saw. And then potentially when we join, we will miss those events depending on what the client does.

If we change the scenario to a room with world_readable or invited history visibility where timeline events would be returned when you are invited; The answer is timeline events are returned, limited is set respectively, and prev_batch points to the first event to continue paginating (no problems there).

For ban/leave, we can just query for timeline events up to the point where they were banned/left (no problem here either).


To compare, Sync v2 doesn't have to deal with this invite memberhip problem because rooms are separated to their own fields (invite, join, knock, leave) in the sync response and invite rooms don't include timeline events or limited, etc (only stripped state).

Perhaps I'm making a leap too far in the Sliding Sync response and invite membership rooms should only have invite_state set (no timeline or limited). This may be the dumb-simple approach which I've only thought about now after writing all of this and isn't spelled out in the MSC. It feels like we could make rooms in the Sliding Sync response more uniform if we decide on some semantics here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, ermh, I'd ask what the proxy does. My hunch is that we don't return any timeline events (bar maybe the invite?), and just set prev_batch to the just before the invite. I'd guess clients don't actually use it, as the api will send down a new room entry for when we joined the room?

Copy link
Contributor Author

@MadLittleMods MadLittleMods Jun 25, 2024

Choose a reason for hiding this comment

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

I asked what the Sliding Sync proxy does for invite rooms: it only returns invite_state (no timeline, limited, or prev_batch).

Because the proxy is just a Matrix client, it can basically only pass along events from Sync v2 so it's not able to pull out extra events and have some filtering logic or history visibility checks on them. I also asked whether a full server implementation of Sliding Sync should do something more/better in the invite situation but I only got one response back about preferring to keep the already complex sync endpoint to just be for syncing live traffic, and defer loading history to a separate endpoint.

That sentiment makes some sense. Especially, if we were to return strictly live traffic only but the sync endpoint is already loading history.

I assume the history is useful for room previews and being able to show something immediately. Ultimately, we're leaving that decision is also up to the client depending on the timeline_limit and filters they want to use anyway.

Deciding on how we treat invite rooms, doesn't really change how sync works in this sense though. Returning live traffic for invite rooms where you can see the messages also could make sense. And history is returned during an initial sync like any other room.

⏩ Since nothing was decided and there wasn't traction either way, I'll just copy the proxy for now and only have invite_state. I've also brought up this point on the MSC for wider discussion and to be clarified -> matrix-org/matrix-spec-proposals#3575 (comment)

@@ -185,14 +191,15 @@ class RoomResult:
(with potentially other old events in the timeline).
"""

name: str
name: Optional[str]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're deciding to make name optional because the m.room.name state event is not required and it doesn't make sense to calculate room names that need to be localized on the client anyway.

@MadLittleMods MadLittleMods requested review from erikjohnston and removed request for erikjohnston June 27, 2024 23:14
MadLittleMods added a commit that referenced this pull request Jul 2, 2024
@@ -0,0 +1 @@
Add `rooms` data to experimental [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) Sliding Sync `/sync` endpoint.
Copy link
Contributor Author

@MadLittleMods MadLittleMods Jul 2, 2024

Choose a reason for hiding this comment

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

CI keeps failing on building debs. It's unclear what's even going wrong or a change to cause this and I'm unable to merge with the failing status. It was building fine on the develop merge.

https://github.com/element-hq/synapse/actions/runs/9754628604/job/26922590117

...

Building wheels for collected packages: cffi, jaeger-client, markupsafe, opentracing, psycopg2, pyicu, systemd-python, threadloop, thrift, zope-interface
  Building wheel for cffi (pyproject.toml): started
  error: subprocess-exited-with-error
  
  × Building wheel for cffi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for cffi (pyproject.toml): finished with status 'error'
  ERROR: Failed building wheel for cffi

....

Failed to build cffi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cffi)
Traceback (most recent call last):
  File "/usr/bin/dh_virtualenv", line 111, in <module>
    sys.exit(main() or 0)
             ^^^^^^
  File "/usr/bin/dh_virtualenv", line 91, in main
    deploy.install_dependencies()
  File "/usr/lib/python3/dist-packages/dh_virtualenv/deployment.py", line 202, in install_dependencies
    subprocess.check_call(self.pip('-r', requirements_path))
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/python', '/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/pip', 'install', '--log=/tmp/tmp1je1k3qf', '--no-deps', '--no-cache-dir', '--compile', '-r', './exported_requirements.txt']' returned non-zero exit status 1.
make[1]: Leaving directory '/synapse/build'
make[1]: *** [debian/rules:57: override_dh_virtualenv] Error 1
make: *** [debian/rules:66: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
build of debian:sid failed: Command '['docker', 'run', '--rm', '--name', 'synapse_build_sid', '--volume=/home/runner/work/synapse/synapse/src:/synapse/source:ro', '--volume=/home/runner/work/synapse/synapse/src/../debs:/debs', '-e', 'TARGET_USERID=1001', '-e', 'TARGET_GROUPID=127', '-e', 'DEB_BUILD_OPTIONS=', 'dh-venv-builder:sid']' returned non-zero exit status 2.
Traceback (most recent call last):
  File "/home/runner/work/synapse/synapse/./src/scripts-dev/build_debian_packages.py", line 225, in <module>
    run_builds(
  File "/home/runner/work/synapse/synapse/./src/scripts-dev/build_debian_packages.py", line 182, in run_builds
    for _ in res:
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/synapse/synapse/./src/scripts-dev/build_debian_packages.py", line 179, in <lambda>
    res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/synapse/synapse/./src/scripts-dev/build_debian_packages.py", line 70, in run_build
    self._inner_build(dist, skip_tests)
  File "/home/runner/work/synapse/synapse/./src/scripts-dev/build_debian_packages.py", line 123, in _inner_build
    subprocess.check_call(
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'run', '--rm', '--name', 'synapse_build_sid', '--volume=/home/runner/work/synapse/synapse/src:/synapse/source:ro', '--volume=/home/runner/work/synapse/synapse/src/../debs:/debs', '-e', 'TARGET_USERID=1001', '-e', 'TARGET_GROUPID=127', '-e', 'DEB_BUILD_OPTIONS=', 'dh-venv-builder:sid']' returned non-zero exit status 2.

If I run scripts-dev/build_debian_packages.py locally, I see a different error (even on develop) which is a bit confusing because I'd assume it should behaving about the same given it's all running in Docker.

Local build output
...
Successfully installed matrix-synapse-1.110.0rc2
/ /synapse/build
Running 0 tests.
E
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/lib/python3.9/site-packages/twisted/trial/runner.py", line 711, in loadByName
    return self.suiteFactory([self.findByName(name, recurse=recurse)])
  File "/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/lib/python3.9/site-packages/twisted/trial/runner.py", line 474, in findByName
    obj = reflect.namedModule(searchName)
  File "/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/lib/python3.9/site-packages/twisted/python/reflect.py", line 156, in namedModule
    topLevel = __import__(name)
  File "/tmp/tmp.DNj5v3i4RS/tests/__init__.py", line 24, in <module>
    from synapse.util.patch_inline_callbacks import do_patch
  File "/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/__init__.py", line 32, in <module>
    from synapse.util.rust import check_rust_lib_up_to_date
  File "/synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/util/rust.py", line 27, in <module>
    from synapse.synapse_rust import get_rust_file_digest
builtins.ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /synapse/build/debian/matrix-synapse-py3/opt/venvs/matrix-synapse/lib/python3.9/site-packages/synapse/synapse_rust.abi3.so)

tests
-------------------------------------------------------------------------------
Ran 1 tests in 0.000s

FAILED (errors=1)
make[1]: *** [debian/rules:57: override_dh_virtualenv] Error 1
make[1]: Leaving directory '/synapse/build'
make: *** [debian/rules:66: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
build of debian:bullseye failed: Command '['docker', 'run', '--rm', '--name', 'synapse_build_bullseye', '--volume=/home/eric/Documents/github/element/synapse:/synapse/source:ro', '--volume=/home/eric/Documents/github/element/synapse/../debs:/debs', '-e', 'TARGET_USERID=1000', '-e', 'TARGET_GROUPID=1000', '-e', 'DEB_BUILD_OPTIONS=', 'dh-venv-builder:bullseye']' returned non-zero exit status 2.
not building debian:bookworm due to earlier failure
not building debian:sid due to earlier failure
not building ubuntu:focal due to earlier failure
not building ubuntu:jammy due to earlier failure
not building ubuntu:lunar due to earlier failure
not building ubuntu:mantic due to earlier failure
not building debian:trixie due to earlier failure
Traceback (most recent call last):
  File "/home/eric/Documents/github/element/synapse/scripts-dev/build_debian_packages.py", line 225, in <module>
    run_builds(
  File "/home/eric/Documents/github/element/synapse/scripts-dev/build_debian_packages.py", line 182, in run_builds
    for _ in res:
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eric/Documents/github/element/synapse/scripts-dev/build_debian_packages.py", line 179, in <lambda>
    res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eric/Documents/github/element/synapse/scripts-dev/build_debian_packages.py", line 70, in run_build
    self._inner_build(dist, skip_tests)
  File "/home/eric/Documents/github/element/synapse/scripts-dev/build_debian_packages.py", line 123, in _inner_build
    subprocess.check_call(
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'run', '--rm', '--name', 'synapse_build_bullseye', '--volume=/home/eric/Documents/github/element/synapse:/synapse/source:ro', '--volume=/home/eric/Documents/github/element/synapse/../debs:/debs', '-e', 'TARGET_USERID=1000', '-e', 'TARGET_GROUPID=1000', '-e', 'DEB_BUILD_OPTIONS=', 'dh-venv-builder:bullseye']' returned non-zero exit status 2.

Copy link
Member

Choose a reason for hiding this comment

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

I've just rerun this on develop and it looks like its broken there too

Copy link
Member

Choose a reason for hiding this comment

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

#17389 was the issue in CI

#17390 was the issue running locally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for fixing up the deb build issues @erikjohnston!

For the first one, the fact that it was building a wheel at all is the hint as it should be downloading one normally.

For the second one, it makes more sense but if we expect a clean checkout for the Docker builds, it would be nice to remove things according to the .gitignore.

@MadLittleMods MadLittleMods merged commit fa91655 into develop Jul 2, 2024
39 checks passed
@MadLittleMods MadLittleMods deleted the madlittlemods/sliding-sync-room-data branch July 2, 2024 16:07
@MadLittleMods
Copy link
Contributor Author

Thanks for the great review and CI unblocks @erikjohnston 🦜

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 12, 2024
# Synapse 1.112.0 (2024-07-30)

This security release is to update our locked dependency on Twisted to 24.7.0rc1, which includes a security fix for [CVE-2024-41671 / GHSA-c8m8-j448-xjx7: Disordered HTTP pipeline response in twisted.web, again](GHSA-c8m8-j448-xjx7).

Note that this security fix is also available as **Synapse 1.111.1**, which does not include the rest of the changes in Synapse 1.112.0.

This issue means that, if multiple HTTP requests are pipelined in the same TCP connection, Synapse can send responses to the wrong HTTP request.
If a reverse proxy was configured to use HTTP pipelining, this could result in responses being sent to the wrong user, severely harming confidentiality.

With that said, despite being a high severity issue, **we consider it unlikely that Synapse installations will be affected**.
The use of HTTP pipelining in this fashion would cause worse performance for clients (request-response latencies would be increased as users' responses would be artificially blocked behind other users' slow requests). Further, Nginx and Haproxy, two common reverse proxies, do not appear to support configuring their upstreams to use HTTP pipelining and thus would not be affected. For both of these reasons, we consider it unlikely that a Synapse deployment would be set up in such a configuration.

Despite that, we cannot rule out that some installations may exist with this unusual setup and so we are releasing this security update today.

**pip users:** Note that by default, upgrading Synapse using pip will not automatically upgrade Twisted. **Please manually install the new version of Twisted** using `pip install Twisted==24.7.0rc1`. Note also that even the `--upgrade-strategy=eager` flag to `pip install -U matrix-synapse` will not upgrade Twisted to a patched version because it is only a release candidate at this time.

### Internal Changes

- Upgrade locked dependency on Twisted to 24.7.0rc1. ([\#17502](element-hq/synapse#17502))


# Synapse 1.112.0rc1 (2024-07-23)

Please note that this release candidate does not include the security dependency update
included in version 1.111.1 as this version was released before 1.111.1.
The same security fix can be found in the full release of 1.112.0.

### Features

- Add to-device extension support to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17416](element-hq/synapse#17416))
- Populate `name`/`avatar` fields in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17418](element-hq/synapse#17418))
- Populate `heroes` and room summary fields (`joined_count`, `invited_count`) in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17419](element-hq/synapse#17419))
- Populate `is_dm` room field in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17429](element-hq/synapse#17429))
- Add room subscriptions to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17432](element-hq/synapse#17432))
- Prepare for authenticated media freeze. ([\#17433](element-hq/synapse#17433))
- Add E2EE extension support to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17454](element-hq/synapse#17454))

### Bugfixes

- Add configurable option to always include offline users in presence sync results. Contributed by @Michael-Hollister. ([\#17231](element-hq/synapse#17231))
- Fix bug in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint when using room type filters and the user has one or more remote invites. ([\#17434](element-hq/synapse#17434))
- Order `heroes` by `stream_ordering` as the Matrix specification states (applies to `/sync`). ([\#17435](element-hq/synapse#17435))
- Fix rare bug where `/sync` would break for a user when using workers with multiple stream writers. ([\#17438](element-hq/synapse#17438))

### Improved Documentation

- Update the readme image to have a white background, so that it is readable in dark mode. ([\#17387](element-hq/synapse#17387))
- Add Red Hat Enterprise Linux and Rocky Linux 8 and 9 installation instructions. ([\#17423](element-hq/synapse#17423))
- Improve documentation for the [`default_power_level_content_override`](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#default_power_level_content_override) config option. ([\#17451](element-hq/synapse#17451))

### Internal Changes

- Make sure we always use the right logic for enabling the media repo. ([\#17424](element-hq/synapse#17424))
- Fix argument documentation for method `RateLimiter.record_action`. ([\#17426](element-hq/synapse#17426))
- Reduce volume of 'Waiting for current token' logs, which were introduced in v1.109.0. ([\#17428](element-hq/synapse#17428))
- Limit concurrent remote downloads to 6 per IP address, and decrement remote downloads without a content-length from the ratelimiter after the download is complete. ([\#17439](element-hq/synapse#17439))
- Remove unnecessary call to resume producing in fake channel. ([\#17449](element-hq/synapse#17449))
- Update experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint to bump room when it is created. ([\#17453](element-hq/synapse#17453))
- Speed up generating sliding sync responses. ([\#17458](element-hq/synapse#17458))
- Add cache to `get_rooms_for_local_user_where_membership_is` to speed up sliding sync. ([\#17460](element-hq/synapse#17460))
- Speed up fetching room keys from backup. ([\#17461](element-hq/synapse#17461))
- Speed up sorting of the room list in sliding sync. ([\#17468](element-hq/synapse#17468))
- Implement handling of `$ME` as a state key in sliding sync. ([\#17469](element-hq/synapse#17469))



### Updates to locked dependencies

* Bump bytes from 1.6.0 to 1.6.1. ([\#17441](element-hq/synapse#17441))
* Bump hiredis from 2.3.2 to 3.0.0. ([\#17464](element-hq/synapse#17464))
* Bump jsonschema from 4.22.0 to 4.23.0. ([\#17444](element-hq/synapse#17444))
* Bump matrix-org/done-action from 2 to 3. ([\#17440](element-hq/synapse#17440))
* Bump mypy from 1.9.0 to 1.10.1. ([\#17445](element-hq/synapse#17445))
* Bump pyopenssl from 24.1.0 to 24.2.1. ([\#17465](element-hq/synapse#17465))
* Bump ruff from 0.5.0 to 0.5.4. ([\#17466](element-hq/synapse#17466))
* Bump sentry-sdk from 2.6.0 to 2.8.0. ([\#17456](element-hq/synapse#17456))
* Bump sentry-sdk from 2.8.0 to 2.10.0. ([\#17467](element-hq/synapse#17467))
* Bump setuptools from 67.6.0 to 70.0.0. ([\#17448](element-hq/synapse#17448))
* Bump twine from 5.1.0 to 5.1.1. ([\#17443](element-hq/synapse#17443))
* Bump types-jsonschema from 4.22.0.20240610 to 4.23.0.20240712. ([\#17446](element-hq/synapse#17446))
* Bump ulid from 1.1.2 to 1.1.3. ([\#17442](element-hq/synapse#17442))
* Bump zipp from 3.15.0 to 3.19.1. ([\#17427](element-hq/synapse#17427))

# Synapse 1.111.0 (2024-07-16)

No significant changes since 1.111.0rc2.




# Synapse 1.111.0rc2 (2024-07-10)

### Bugfixes

- Fix bug where using `synapse.app.media_repository` worker configuration would break the new media endpoints. ([\#17420](element-hq/synapse#17420))

### Improved Documentation

- Document the new federation media worker endpoints in the [upgrade notes](https://element-hq.github.io/synapse/v1.111/upgrade.html) and [worker docs](https://element-hq.github.io/synapse/v1.111/workers.html). ([\#17421](element-hq/synapse#17421))

### Internal Changes

- Route authenticated federation media requests to media repository workers in Complement tests. ([\#17422](element-hq/synapse#17422))




# Synapse 1.111.0rc1 (2024-07-09)

### Features

- Add `rooms` data to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17320](element-hq/synapse#17320))
- Add `room_types`/`not_room_types` filtering to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17337](element-hq/synapse#17337))
- Return "required state" in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17342](element-hq/synapse#17342))
- Support [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3916-authentication-for-media.md) by adding [`_matrix/client/v1/media/download`](https://spec.matrix.org/v1.11/client-server-api/#get_matrixclientv1mediadownloadservernamemediaid) endpoint. ([\#17365](element-hq/synapse#17365))
- Support [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/blob/rav/authentication-for-media/proposals/3916-authentication-for-media.md)
  by adding [`_matrix/client/v1/media/thumbnail`](https://spec.matrix.org/v1.11/client-server-api/#get_matrixclientv1mediathumbnailservernamemediaid), [`_matrix/federation/v1/media/thumbnail`](https://spec.matrix.org/v1.11/server-server-api/#get_matrixfederationv1mediathumbnailmediaid) endpoints and stabilizing the
  remaining [`_matrix/client/v1/media`](https://spec.matrix.org/v1.11/client-server-api/#get_matrixclientv1mediaconfig) endpoints. ([\#17388](element-hq/synapse#17388))
- Add `rooms.bump_stamp` for easier client-side sorting in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17395](element-hq/synapse#17395))
- Forget all of a user's rooms upon deactivation, preventing local room purges from being blocked on deactivated users. ([\#17400](element-hq/synapse#17400))
- Declare support for [Matrix 1.11](https://matrix.org/blog/2024/06/20/matrix-v1.11-release/). ([\#17403](element-hq/synapse#17403))
- [MSC3861](matrix-org/matrix-spec-proposals#3861): allow overriding the introspection endpoint. ([\#17406](element-hq/synapse#17406))

### Bugfixes

- Fix rare race which caused no new to-device messages to be received from remote server. ([\#17362](element-hq/synapse#17362))
- Fix bug in experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint when using an old database. ([\#17398](element-hq/synapse#17398))

### Improved Documentation

- Clarify that `url_preview_url_blacklist` is a usability feature. ([\#17356](element-hq/synapse#17356))
- Fix broken links in README. ([\#17379](element-hq/synapse#17379))
- Clarify that changelog content *and file extension* need to match in order for entries to merge. ([\#17399](element-hq/synapse#17399))

### Internal Changes

- Make the release script create a release branch for Complement as well. ([\#17318](element-hq/synapse#17318))
- Fix uploading packages to PyPi. ([\#17363](element-hq/synapse#17363))
- Add CI check for the README. ([\#17367](element-hq/synapse#17367))
- Fix linting errors from new `ruff` version. ([\#17381](element-hq/synapse#17381), [\#17411](element-hq/synapse#17411))
- Fix building debian packages on non-clean checkouts. ([\#17390](element-hq/synapse#17390))
- Finish up work to allow per-user feature flags. ([\#17392](element-hq/synapse#17392), [\#17410](element-hq/synapse#17410))
- Allow enabling sliding sync per-user. ([\#17393](element-hq/synapse#17393))



### Updates to locked dependencies

* Bump certifi from 2023.7.22 to 2024.7.4. ([\#17404](element-hq/synapse#17404))
* Bump cryptography from 42.0.7 to 42.0.8. ([\#17382](element-hq/synapse#17382))
* Bump ijson from 3.2.3 to 3.3.0. ([\#17413](element-hq/synapse#17413))
* Bump log from 0.4.21 to 0.4.22. ([\#17384](element-hq/synapse#17384))
* Bump mypy-zope from 1.0.4 to 1.0.5. ([\#17414](element-hq/synapse#17414))
* Bump pillow from 10.3.0 to 10.4.0. ([\#17412](element-hq/synapse#17412))
* Bump pydantic from 2.7.1 to 2.8.2. ([\#17415](element-hq/synapse#17415))
* Bump ruff from 0.3.7 to 0.5.0. ([\#17381](element-hq/synapse#17381))
* Bump serde from 1.0.203 to 1.0.204. ([\#17409](element-hq/synapse#17409))
* Bump serde_json from 1.0.117 to 1.0.120. ([\#17385](element-hq/synapse#17385), [\#17408](element-hq/synapse#17408))
* Bump types-setuptools from 69.5.0.20240423 to 70.1.0.20240627. ([\#17380](element-hq/synapse#17380))

# Synapse 1.110.0 (2024-07-03)

No significant changes since 1.110.0rc3.




# Synapse 1.110.0rc3 (2024-07-02)

### Bugfixes

- Fix bug where `/sync` requests could get blocked indefinitely after an upgrade from Synapse versions before v1.109.0. ([\#17386](element-hq/synapse#17386), [\#17391](element-hq/synapse#17391))

### Internal Changes

- Limit size of presence EDUs to 50 entries. ([\#17371](element-hq/synapse#17371))
- Fix building debian package for debian sid. ([\#17389](element-hq/synapse#17389))




# Synapse 1.110.0rc2 (2024-06-26)

### Internal Changes

- Fix uploading packages to PyPi. ([\#17363](element-hq/synapse#17363))




# Synapse 1.110.0rc1 (2024-06-26)

### Features

- Add initial implementation of an experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17187](element-hq/synapse#17187))
- Add experimental support for [MSC3823](matrix-org/matrix-spec-proposals#3823) - Account suspension. ([\#17255](element-hq/synapse#17255))
- Improve ratelimiting in Synapse. ([\#17256](element-hq/synapse#17256))
- Add support for the unstable [MSC4151](matrix-org/matrix-spec-proposals#4151) report room API. ([\#17270](element-hq/synapse#17270), [\#17296](element-hq/synapse#17296))
- Filter for public and empty rooms added to Admin-API [List Room API](https://element-hq.github.io/synapse/latest/admin_api/rooms.html#list-room-api). ([\#17276](element-hq/synapse#17276))
- Add `is_dm` filtering to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17277](element-hq/synapse#17277))
- Add `is_encrypted` filtering to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17281](element-hq/synapse#17281))
- Include user membership in events served to clients, per [MSC4115](matrix-org/matrix-spec-proposals#4115). ([\#17282](element-hq/synapse#17282))
- Do not require user-interactive authentication for uploading cross-signing keys for the first time, per [MSC3967](matrix-org/matrix-spec-proposals#3967). ([\#17284](element-hq/synapse#17284))
- Add `stream_ordering` sort to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17293](element-hq/synapse#17293))
- `register_new_matrix_user` now supports a --password-file flag, which
  is useful for scripting. ([\#17294](element-hq/synapse#17294))
- `register_new_matrix_user` now supports a --exists-ok flag to allow registration of users that already exist in the database.
  This is useful for scripts that bootstrap user accounts with initial passwords. ([\#17304](element-hq/synapse#17304))
- Add support for via query parameter from [MSC4156](matrix-org/matrix-spec-proposals#4156). ([\#17322](element-hq/synapse#17322))
- Add `is_invite` filtering to experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17335](element-hq/synapse#17335))
- Support [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3916-authentication-for-media.md) by adding a federation /download endpoint. ([\#17350](element-hq/synapse#17350))

### Bugfixes

- Fix searching for users with their exact localpart whose ID includes a hyphen. ([\#17254](element-hq/synapse#17254))
- Fix wrong retention policy being used when filtering events. ([\#17272](element-hq/synapse#17272))
- Fix bug where OTKs were not always included in `/sync` response when using workers. ([\#17275](element-hq/synapse#17275))
- Fix a long-standing bug where an invalid 'from' parameter to [`/notifications`](https://spec.matrix.org/v1.10/client-server-api/#get_matrixclientv3notifications) would result in an Internal Server Error. ([\#17283](element-hq/synapse#17283))
- Fix edge case in `/sync` returning the wrong the state when using sharded event persisters. ([\#17295](element-hq/synapse#17295))
- Add initial implementation of an experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync `/sync` endpoint. ([\#17301](element-hq/synapse#17301))
- Fix email notification subject when invited to a space. ([\#17336](element-hq/synapse#17336))

### Improved Documentation

- Add missing quotes for example for `exclude_rooms_from_sync`. ([\#17308](element-hq/synapse#17308))
- Update header in the README to visually fix the the auto-generated table of contents. ([\#17329](element-hq/synapse#17329))
- Fix stale references to the Foundation's Security Disclosure Policy. ([\#17341](element-hq/synapse#17341))
- Add default values for `rc_invites.per_issuer` to docs. ([\#17347](element-hq/synapse#17347))
- Fix an error in the docs for `search_all_users` parameter under `user_directory`. ([\#17348](element-hq/synapse#17348))

### Internal Changes

- Remove unused `expire_access_token` option in the Synapse Docker config file. Contributed by @AaronDewes. ([\#17198](element-hq/synapse#17198))
- Use fully-qualified `PersistedEventPosition` when returning `RoomsForUser` to facilitate proper comparisons and `RoomStreamToken` generation. ([\#17265](element-hq/synapse#17265))
- Add debug logging for when room keys are uploaded, including whether they are replacing other room keys. ([\#17266](element-hq/synapse#17266))
- Handle OTK uploads off master. ([\#17271](element-hq/synapse#17271))
- Don't try and resync devices for remote users whose servers are marked as down. ([\#17273](element-hq/synapse#17273))
- Re-organize Pydantic models and types used in handlers. ([\#17279](element-hq/synapse#17279))
- Expose the worker instance that persisted the event on `event.internal_metadata.instance_name`. ([\#17300](element-hq/synapse#17300))
- Update the README with Element branding, improve headers and fix the #synapse:matrix.org support room link rendering. ([\#17324](element-hq/synapse#17324))
- Change path of the experimental [MSC3575](matrix-org/matrix-spec-proposals#3575) Sliding Sync implementation to `/org.matrix.simplified_msc3575/sync` since our simplified API is slightly incompatible with what's in the current MSC. ([\#17331](element-hq/synapse#17331))
- Handle device lists notifications for large accounts more efficiently in worker mode. ([\#17333](element-hq/synapse#17333), [\#17358](element-hq/synapse#17358))
- Do not block event sending/receiving while calculating large event auth chains. ([\#17338](element-hq/synapse#17338))
- Tidy up `parse_integer` docs and call sites to reflect the fact that they require non-negative integers by default, and bring `parse_integer_from_args` default in alignment. Contributed by Denis Kasak (@dkasak). ([\#17339](element-hq/synapse#17339))



### Updates to locked dependencies

* Bump authlib from 1.3.0 to 1.3.1. ([\#17343](element-hq/synapse#17343))
* Bump dawidd6/action-download-artifact from 3.1.4 to 5. ([\#17289](element-hq/synapse#17289))
* Bump dawidd6/action-download-artifact from 5 to 6. ([\#17313](element-hq/synapse#17313))
* Bump docker/build-push-action from 5 to 6. ([\#17312](element-hq/synapse#17312))
* Bump jinja2 from 3.1.3 to 3.1.4. ([\#17287](element-hq/synapse#17287))
* Bump lazy_static from 1.4.0 to 1.5.0. ([\#17355](element-hq/synapse#17355))
* Bump msgpack from 1.0.7 to 1.0.8. ([\#17317](element-hq/synapse#17317))
* Bump netaddr from 1.2.1 to 1.3.0. ([\#17353](element-hq/synapse#17353))
* Bump packaging from 24.0 to 24.1. ([\#17352](element-hq/synapse#17352))
* Bump phonenumbers from 8.13.37 to 8.13.39. ([\#17315](element-hq/synapse#17315))
* Bump regex from 1.10.4 to 1.10.5. ([\#17290](element-hq/synapse#17290))
* Bump requests from 2.31.0 to 2.32.2. ([\#17345](element-hq/synapse#17345))
* Bump sentry-sdk from 2.1.1 to 2.3.1. ([\#17263](element-hq/synapse#17263))
* Bump sentry-sdk from 2.3.1 to 2.6.0. ([\#17351](element-hq/synapse#17351))
* Bump tornado from 6.4 to 6.4.1. ([\#17344](element-hq/synapse#17344))
* Bump mypy from 1.8.0 to 1.9.0. ([\#17297](element-hq/synapse#17297))
* Bump types-jsonschema from 4.21.0.20240311 to 4.22.0.20240610. ([\#17288](element-hq/synapse#17288))
* Bump types-netaddr from 1.2.0.20240219 to 1.3.0.20240530. ([\#17314](element-hq/synapse#17314))
* Bump types-pillow from 10.2.0.20240423 to 10.2.0.20240520. ([\#17285](element-hq/synapse#17285))
* Bump types-pyyaml from 6.0.12.12 to 6.0.12.20240311. ([\#17316](element-hq/synapse#17316))
* Bump typing-extensions from 4.11.0 to 4.12.2. ([\#17354](element-hq/synapse#17354))
* Bump urllib3 from 2.0.7 to 2.2.2. ([\#17346](element-hq/synapse#17346))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants