Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'matrix-org:develop' into henry/github_action_docker
Browse files Browse the repository at this point in the history
  • Loading branch information
henryclw committed May 3, 2022
2 parents ce28168 + 96e0cdb commit 57f4421
Show file tree
Hide file tree
Showing 29 changed files with 212 additions and 136 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/latest_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ jobs:
with:
python-version: "3.x"
poetry-version: "1.2.0b1"
extras: "all"
# Dump installed versions for debugging.
- run: poetry run pip list > before.txt
# Upgrade all runtime dependencies only. This is intended to mimic a fresh
# `pip install matrix-synapse[all]` as closely as possible.
- run: poetry update --no-dev
- run: poetry run pip list > after.txt && (diff -u before.txt after.txt || true)
- name: Remove warn_unused_ignores from mypy config
run: sed '/warn_unused_ignores = True/d' -i mypy.ini
- run: poetry run mypy
trial:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/twisted_trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
poetry remove twisted
poetry add --extras tls git+https://github.com/twisted/twisted.git#trunk
poetry install --no-interaction --extras "all test"
- name: Remove warn_unused_ignores from mypy config
run: sed '/warn_unused_ignores = True/d' -i mypy.ini
- run: poetry run mypy

trial:
Expand Down
10 changes: 8 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Synapse 1.58.0 (2022-05-03)
===========================

As of this release, the groups/communities feature in Synapse is now disabled by default. See [\#11584](https://github.com/matrix-org/synapse/issues/11584) for details. As mentioned in [the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1580), this feature will be removed in Synapse 1.61.

No significant changes since 1.58.0rc2.


Synapse 1.58.0rc2 (2022-04-26)
==============================

Expand All @@ -19,8 +27,6 @@ Internal Changes
Synapse 1.58.0rc1 (2022-04-26)
==============================

As of this release, the groups/communities feature in Synapse is now disabled by default. See [\#11584](https://github.com/matrix-org/synapse/issues/11584) for details. As mentioned in [the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1580), this feature will be removed in Synapse 1.61.

Features
--------

Expand Down
1 change: 1 addition & 0 deletions changelog.d/12556.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Release script: confirm the commit to be tagged before tagging.
1 change: 1 addition & 0 deletions changelog.d/12570.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.57 which could cause `Failed to calculate hosts in room` errors to be logged for outbound federation.
1 change: 1 addition & 0 deletions changelog.d/12576.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow unused `#type: ignore` comments in bleeding edge CI jobs.
1 change: 1 addition & 0 deletions changelog.d/12589.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove special-case for `twisted` logger from default log config.
1 change: 1 addition & 0 deletions changelog.d/12594.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix race when persisting an event and deleting a room that could lead to outbound federation breaking.
1 change: 1 addition & 0 deletions changelog.d/12596.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unstable identifiers from [MSC3069](https://github.com/matrix-org/matrix-doc/pull/3069).
1 change: 1 addition & 0 deletions changelog.d/12608.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove redundant lines of config from `mypy.ini`.
1 change: 1 addition & 0 deletions changelog.d/12612.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a typo in the announcement text generated by the Synapse release development script.
1 change: 1 addition & 0 deletions changelog.d/12613.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Synapse now requires at least Python 3.7.1 (up from 3.7.0), for compatibility with the latest Twisted trunk.
1 change: 1 addition & 0 deletions changelog.d/12614.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add extra debug logging to federation sender.
1 change: 1 addition & 0 deletions changelog.d/12620.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a consistency check on events which we read from the database.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
matrix-synapse-py3 (1.58.0) stable; urgency=medium

* New Synapse release 1.58.0.

-- Synapse Packaging team <packages@matrix.org> Tue, 03 May 2022 10:52:58 +0100

matrix-synapse-py3 (1.58.0~rc2) stable; urgency=medium

* New Synapse release 1.58.0rc2.
Expand Down
7 changes: 0 additions & 7 deletions docs/sample_log_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ loggers:
# information such as access tokens.
level: INFO

twisted:
# We send the twisted logging directly to the file handler,
# to work around https://github.com/matrix-org/synapse/issues/3471
# when using "buffer" logger. Use "console" to log to stderr instead.
handlers: [file]
propagate: false

root:
level: INFO

Expand Down
53 changes: 2 additions & 51 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -241,98 +241,49 @@ disallow_untyped_defs = True
[mypy-authlib.*]
ignore_missing_imports = True

[mypy-bcrypt]
ignore_missing_imports = True

[mypy-canonicaljson]
ignore_missing_imports = True

[mypy-constantly]
ignore_missing_imports = True

[mypy-daemonize]
ignore_missing_imports = True

[mypy-h11]
ignore_missing_imports = True

[mypy-hiredis]
ignore_missing_imports = True

[mypy-hyperlink]
ignore_missing_imports = True

[mypy-ijson.*]
ignore_missing_imports = True

[mypy-importlib_metadata.*]
ignore_missing_imports = True

[mypy-jaeger_client.*]
ignore_missing_imports = True

[mypy-josepy.*]
ignore_missing_imports = True

[mypy-jwt.*]
ignore_missing_imports = True

[mypy-lxml]
ignore_missing_imports = True

[mypy-msgpack]
ignore_missing_imports = True

[mypy-nacl.*]
ignore_missing_imports = True

# Note: WIP stubs available at
# https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
[mypy-netaddr]
ignore_missing_imports = True

[mypy-parameterized.*]
ignore_missing_imports = True

[mypy-phonenumbers.*]
ignore_missing_imports = True

[mypy-prometheus_client.*]
ignore_missing_imports = True

[mypy-pymacaroons.*]
ignore_missing_imports = True

[mypy-pympler.*]
ignore_missing_imports = True

[mypy-redbaron.*]
ignore_missing_imports = True

[mypy-rust_python_jaeger_reporter.*]
ignore_missing_imports = True

[mypy-saml2.*]
ignore_missing_imports = True

[mypy-sentry_sdk]
ignore_missing_imports = True

[mypy-service_identity.*]
ignore_missing_imports = True

[mypy-signedjson.*]
ignore_missing_imports = True

[mypy-srvlookup.*]
ignore_missing_imports = True

[mypy-treq.*]
ignore_missing_imports = True

[mypy-twisted.*]
ignore_missing_imports = True

[mypy-zope]
ignore_missing_imports = True

[mypy-incremental.*]
ignore_missing_imports = True
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ skip_gitignore = true

[tool.poetry]
name = "matrix-synapse"
version = "1.58.0rc2"
version = "1.58.0"
description = "Homeserver for the Matrix decentralised comms protocol"
authors = ["Matrix.org Team and Contributors <packages@matrix.org>"]
license = "Apache-2.0"
Expand Down Expand Up @@ -100,7 +100,7 @@ synapse_review_recent_signups = "synapse._scripts.review_recent_signups:main"
update_synapse_database = "synapse._scripts.update_synapse_database:main"

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.7.1"

# Mandatory Dependencies
# ----------------------
Expand Down
65 changes: 38 additions & 27 deletions scripts-dev/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ def prepare() -> None:
"""

# Make sure we're in a git repo.
try:
repo = git.Repo()
except git.InvalidGitRepositoryError:
raise click.ClickException("Not in Synapse repo.")

if repo.is_dirty():
raise click.ClickException("Uncommitted changes exist.")
repo = get_repo_and_check_clean_checkout()

click.secho("Updating git repo...")
repo.remote().fetch()
Expand Down Expand Up @@ -171,9 +165,7 @@ def prepare() -> None:
assert not parsed_new_version.is_devrelease
assert not parsed_new_version.is_postrelease

release_branch_name = (
f"release-v{parsed_new_version.major}.{parsed_new_version.minor}"
)
release_branch_name = get_release_branch_name(parsed_new_version)
release_branch = find_ref(repo, release_branch_name)
if release_branch:
if release_branch.is_remote():
Expand Down Expand Up @@ -274,13 +266,7 @@ def tag(gh_token: Optional[str]) -> None:
"""Tags the release and generates a draft GitHub release"""

# Make sure we're in a git repo.
try:
repo = git.Repo()
except git.InvalidGitRepositoryError:
raise click.ClickException("Not in Synapse repo.")

if repo.is_dirty():
raise click.ClickException("Uncommitted changes exist.")
repo = get_repo_and_check_clean_checkout()

click.secho("Updating git repo...")
repo.remote().fetch()
Expand All @@ -293,6 +279,15 @@ def tag(gh_token: Optional[str]) -> None:
if tag_name in repo.tags:
raise click.ClickException(f"Tag {tag_name} already exists!\n")

# Check we're on the right release branch
release_branch = get_release_branch_name(current_version)
if repo.active_branch.name != release_branch:
click.echo(
f"Need to be on the release branch ({release_branch}) before tagging. "
f"Currently on ({repo.active_branch.name})."
)
click.get_current_context().abort()

# Get the appropriate changelogs and tag.
changes = get_changes_for_version(current_version)

Expand Down Expand Up @@ -358,21 +353,15 @@ def tag(gh_token: Optional[str]) -> None:
@cli.command()
@click.option("--gh-token", envvar=["GH_TOKEN", "GITHUB_TOKEN"], required=True)
def publish(gh_token: str) -> None:
"""Publish release."""
"""Publish release on GitHub."""

# Make sure we're in a git repo.
try:
repo = git.Repo()
except git.InvalidGitRepositoryError:
raise click.ClickException("Not in Synapse repo.")

if repo.is_dirty():
raise click.ClickException("Uncommitted changes exist.")
get_repo_and_check_clean_checkout()

current_version = get_package_version()
tag_name = f"v{current_version}"

if not click.confirm(f"Publish {tag_name}?", default=True):
if not click.confirm(f"Publish release {tag_name} on GitHub?", default=True):
return

# Publish the draft release
Expand Down Expand Up @@ -406,6 +395,13 @@ def upload() -> None:
current_version = get_package_version()
tag_name = f"v{current_version}"

# Check we have the right tag checked out.
repo = get_repo_and_check_clean_checkout()
tag = repo.tag(f"refs/tags/{tag_name}")
if repo.head.commit != tag.commit:
click.echo("Tag {tag_name} (tag.commit) is not currently checked out!")
click.get_current_context().abort()

pypi_asset_names = [
f"matrix_synapse-{current_version}-py3-none-any.whl",
f"matrix-synapse-{current_version}.tar.gz",
Expand Down Expand Up @@ -438,7 +434,7 @@ def announce() -> None:
f"""
Hi everyone. Synapse {current_version} has just been released.
[notes](https://github.com/matrix-org/synapse/releases/tag/{tag_name}) |\
[notes](https://github.com/matrix-org/synapse/releases/tag/{tag_name}) | \
[docker](https://hub.docker.com/r/matrixdotorg/synapse/tags?name={tag_name}) | \
[debs](https://packages.matrix.org/debian/) | \
[pypi](https://pypi.org/project/matrix-synapse/{current_version}/)"""
Expand Down Expand Up @@ -469,6 +465,21 @@ def get_package_version() -> version.Version:
return version.Version(version_string)


def get_release_branch_name(version_number: version.Version) -> str:
return f"release-v{version_number.major}.{version_number.minor}"


def get_repo_and_check_clean_checkout() -> git.Repo:
"""Get the project repo and check it's not got any uncommitted changes."""
try:
repo = git.Repo()
except git.InvalidGitRepositoryError:
raise click.ClickException("Not in Synapse repo.")
if repo.is_dirty():
raise click.ClickException("Uncommitted changes exist.")
return repo


def find_ref(repo: git.Repo, ref_name: str) -> Optional[git.HEAD]:
"""Find the branch/ref, looking first locally then in the remote."""
if ref_name in repo.references:
Expand Down
7 changes: 0 additions & 7 deletions synapse/config/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@
# information such as access tokens.
level: INFO
twisted:
# We send the twisted logging directly to the file handler,
# to work around https://github.com/matrix-org/synapse/issues/3471
# when using "buffer" logger. Use "console" to log to stderr instead.
handlers: [file]
propagate: false
root:
level: INFO
Expand Down
15 changes: 11 additions & 4 deletions synapse/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,17 @@ def is_outlier(self) -> bool:
return self.outlier

def is_out_of_band_membership(self) -> bool:
"""Whether this is an out of band membership, like an invite or an invite
rejection. This is needed as those events are marked as outliers, but
they still need to be processed as if they're new events (e.g. updating
invite state in the database, relaying to clients, etc).
"""Whether this event is an out-of-band membership.
OOB memberships are a special case of outlier events: they are membership events
for federated rooms that we aren't full members of. Examples include invites
received over federation, and rejections for such invites.
The concept of an OOB membership is needed because these events need to be
processed as if they're new regular events (e.g. updating membership state in
the database, relaying to clients via /sync, etc) despite being outliers.
See also https://matrix-org.github.io/synapse/develop/development/room-dag-concepts.html#out-of-band-membership-events.
(Added in synapse 0.99.0, so may be unreliable for events received before that)
"""
Expand Down
Loading

0 comments on commit 57f4421

Please sign in to comment.