1
0
Files
synapse/docker/complement
Eric Eastwood c3af44339c Fix /sync missing membership in state_after (re-introduce) (#19460)
*This PR was originally only to enable
[MSC4222](https://github.com/matrix-org/matrix-spec-proposals/pull/4222)
Complement tests (`/sync` `state_after`) but after merging the [fix
PR](https://github.com/element-hq/synapse/pull/19463), we discovered
that while the tests pass locally, [fail in
CI](https://github.com/element-hq/synapse/pull/19460#discussion_r2818080879).
To unblock the RC, we decided to revert the fix PR (see
https://github.com/element-hq/synapse/pull/19474#discussion_r2818061001
for more info). To better ensure tests actually pass in CI, we're
re-introducing the fix here in the same PR that we enable the tests in.*

---

Fix `/sync` missing membership in `state_after`.

This applies to any scenario where the first membership has a different
`sender` compared to the `state_key` and then the second membership has
the same `sender`/`state_key`. Like someone inviting another person and
then them joining. Or someone being kicked and then they leave.

This bug has been present since the MSC4222 implementation was
introduced into the codebase
(https://github.com/element-hq/synapse/pull/17888).

---

Fix https://github.com/element-hq/synapse/issues/19455
Fix https://github.com/element-hq/customer-success/issues/656

I have a feeling, this might also fix these issues (will close and see
how people report back):

Fix https://github.com/element-hq/synapse/issues/18182
Fix https://github.com/element-hq/synapse/issues/19478

 ### Testing strategy

Complement tests: https://github.com/matrix-org/complement/pull/842

We will need https://github.com/element-hq/synapse/pull/19460 to merge
in order to enable the Complement tests in Synapse but this PR should be
merged first so they pass in the first place. I've tested locally that
the Complement tests pass with this fix.




### Dev notes


[MSC4222](https://github.com/matrix-org/matrix-spec-proposals/pull/4222)
has already been merged into the spec and is already part of Matrix
v1.16 but we haven't [stabilized support in Synapse
yet](https://github.com/element-hq/synapse/issues/19414).

---

In the same ballpark:

 - https://github.com/element-hq/synapse/issues/19455
 - https://github.com/element-hq/synapse/issues/17050
 - https://github.com/element-hq/synapse/issues/17430
 - https://github.com/element-hq/synapse/issues/16940
 - https://github.com/element-hq/synapse/issues/18182
 - https://github.com/element-hq/synapse/issues/18793
 - https://github.com/element-hq/synapse/issues/19478

---

Docker builds preferring remote image over the local image we just
built,
https://github.com/element-hq/synapse/pull/19460#discussion_r2818080879

`containerd` image store (storage driver, driver type)

-> https://github.com/element-hq/synapse/pull/19475


### Todo

- [x] Wait for https://github.com/element-hq/synapse/pull/19463 to merge
so the Complement tests all pass
- [x] Wait for https://github.com/element-hq/synapse/pull/19475 to merge

### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
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.
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

---------

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
2026-03-03 15:13:59 +01:00
..
2024-02-20 17:14:50 +00:00

Unified Complement image for Synapse

This is an image for testing Synapse with the Complement integration test suite. It contains some insecure defaults that are only suitable for testing purposes, so please don't use this image for a production server.

This multi-purpose image is built on top of Dockerfile-workers in the parent directory and can be switched using environment variables between the following configurations:

  • Monolithic Synapse with SQLite (default, or SYNAPSE_COMPLEMENT_DATABASE=sqlite)
  • Monolithic Synapse with Postgres (SYNAPSE_COMPLEMENT_DATABASE=postgres)
  • Workerised Synapse with Postgres (SYNAPSE_COMPLEMENT_DATABASE=postgres and SYNAPSE_COMPLEMENT_USE_WORKERS=true)

The image is self-contained; it contains an integrated Postgres, Redis and Nginx.

How to get Complement to pass the environment variables through

To pass these environment variables, use Complement's COMPLEMENT_SHARE_ENV_PREFIX variable to configure an environment prefix to pass through, then prefix the above options with that prefix.

Example:

COMPLEMENT_SHARE_ENV_PREFIX=PASS_ PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres

Consult scripts-dev/complement.sh in the repository root for a real example.

How to modify homeserver.yaml for Complement tests

It's common for MSCs to be gated behind a feature flag like this:

experimental_features:
  faster_joins: true

To modify this for the Complement image, modify ./conf/workers-shared-extra.yaml.j2. Despite the name, this will affect non-worker mode as well. Remember to rebuild the image (so don't use -e if using complement.sh).