matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

CI run against Twisted trunk is failing #16289

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

See https://github.com/matrix-org/synapse/actions/runs/6637463573

clokep commented 1 year ago

Looks like there some new typing errors:

synapse/util/file_consumer.py:82: error: Argument 1 to "run_in_background" has incompatible type "Callable[[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P], Deferred[_R]]"; expected "Callable[[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P], Awaitable[None]]"  [arg-type]
synapse/util/file_consumer.py:83: error: Argument 2 to "run_in_background" has incompatible type "ISynapseReactor"; expected "[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P.args]"  [arg-type]
synapse/util/file_consumer.py:84: error: Argument 3 to "run_in_background" has incompatible type "ThreadPool"; expected "[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P.args]"  [arg-type]
synapse/util/file_consumer.py:85: error: Argument 4 to "run_in_background" has incompatible type "Callable[[], None]"; expected "[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P.args]"  [arg-type]
tests/http/server/_base.py:338: error: Access to generic instance variables via class is ambiguous  [misc]
Found 5 errors in 2 files (checked 851 source files)
clokep commented 1 year ago

Seem to be due to twisted/twisted#11947 / deferToThreadPool getting types added.

clokep commented 1 year ago

This has gotten "worse":

synapse/util/file_consumer.py:82: error: Argument 1 to "run_in_background" has incompatible type "Callable[[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P], Deferred[_R]]"; expected "Callable[[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P], Awaitable[None]]"  [arg-type]
synapse/util/file_consumer.py:83: error: Argument 2 to "run_in_background" has incompatible type "ISynapseReactor"; expected "[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P.args]"  [arg-type]
synapse/util/file_consumer.py:84: error: Argument 3 to "run_in_background" has incompatible type "ThreadPool"; expected "[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P.args]"  [arg-type]
synapse/util/file_consumer.py:85: error: Argument 4 to "run_in_background" has incompatible type "Callable[[], None]"; expected "[IReactorFromThreads, ThreadPool, Callable[_P, _R], **_P.args]"  [arg-type]
tests/state/test_v2.py:679: error: Argument 2 to "assert_dict" of "TestCase" has incompatible type "Mapping[Tuple[str, str], str]"; expected "Dict[Any, Any]"  [arg-type]
tests/http/server/_base.py:338: error: Access to generic instance variables via class is ambiguous  [misc]
tests/handlers/test_appservice.py:163: error: Item "None" of "Optional[RoomAliasMapping]" has no attribute "room_id"  [union-attr]
tests/handlers/test_appservice.py:164: error: Item "None" of "Optional[RoomAliasMapping]" has no attribute "servers"  [union-attr]
tests/http/test_matrixfederationclient.py:86: error: Incompatible types in "yield" (actual type "Deferred[Dict[str, Any]]", expected type "Deferred[object]")  [misc]

Additionally, unit tests are now failing:

https://github.com/matrix-org/synapse/actions/runs/6571619244/job/17851137720

clokep commented 1 year ago

Additionally, unit tests are now failing:

matrix-org/synapse/actions/runs/6571619244/job/17851137720

This is due to twisted/twisted#11996.

clokep commented 1 year ago

I have the unit tests mostly sorted too.

clokep commented 1 year ago

This should be fixed; if not we'll handle it in the follow-up ticket.