Skip to content
Snippets Groups Projects
  1. Feb 21, 2023
  2. Feb 20, 2023
  3. Feb 17, 2023
    • Patrick Cloke's avatar
      Fix-up type hints in tests/server.py. (#15084) · c9b91436
      Patrick Cloke authored
      This file was being ignored by mypy, we remove that
      and add the missing type hints & deal with any fallout.
      Unverified
      c9b91436
    • Dirk Klimpel's avatar
      Add account data to export command (#14969) · 61bfcd66
      Dirk Klimpel authored
      * Add account data to to export command
      
      * newsfile
      
      * remove not needed function
      
      * update newsfile
      
      * adopt #14973
      Unverified
      61bfcd66
    • Sean Quah's avatar
      Mitigate a race where /make_join could 403 for restricted rooms (#15080) · 4f4f27e5
      Sean Quah authored
      
      Previously, when creating a join event in /make_join, we would decide
      whether to include additional fields to satisfy restricted room checks
      based on the current state of the room. Then, when building the event,
      we would capture the forward extremities of the room to use as prev
      events.
      
      This is subject to race conditions. For example, when leaving and
      rejoining a room, the following sequence of events leads to a misleading
      403 response:
      1. /make_join reads the current state of the room and sees that the user
         is still in the room. It decides to omit the field required for
         restricted room joins.
      2. The leave event is persisted and the room's forward extremities are
         updated.
      3. /make_join builds the event, using the post-leave forward extremities.
         The event then fails the restricted room checks.
      
      To mitigate the race, we move the read of the forward extremities closer
      to the read of the current state. Ideally, we would compute the state
      based off the chosen prev events, but that can involve state resolution,
      which is expensive.
      
      Signed-off-by: default avatarSean Quah <seanq@matrix.org>
      Unverified
      4f4f27e5
  4. Feb 16, 2023
    • ZAID BIN TARIQ's avatar
      Document how to start Synapse with Poetry (#14892) · ad1f3fa8
      ZAID BIN TARIQ authored
      
      * Add Start Synapse with Poetry
      
      * Create 14892.doc
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarSean Quah <8349537+squahtx@users.noreply.github.com>
      
      * Update docs/workers.md
      
      ---------
      
      Co-authored-by: default avatarDavid Robertson <david.m.robertson1@gmail.com>
      Co-authored-by: default avatarSean Quah <8349537+squahtx@users.noreply.github.com>
      Unverified
      ad1f3fa8
    • David Robertson's avatar
      Use mypy 1.0 (#15052) · ffc2ee52
      David Robertson authored
      * Update mypy and mypy-zope
      * Remove unused ignores
      
      These used to suppress
      
      ```
      synapse/storage/engines/__init__.py:28: error: "__new__" must return a
      class instance (got "NoReturn")  [misc]
      ```
      
      and
      
      ```
      synapse/http/matrixfederationclient.py:1270: error: "BaseException" has no attribute "reasons"  [attr-defined]
      ```
      
      (note that we check `hasattr(e, "reasons")` above)
      
      * Avoid empty body warnings, sometimes by marking methods as abstract
      
      E.g.
      
      ```
      tests/handlers/test_register.py:58: error: Missing return statement  [empty-body]
      tests/handlers/test_register.py:108: error: Missing return statement  [empty-body]
      ```
      
      * Suppress false positive about `JaegerConfig`
      
      Complaint was
      
      ```
      synapse/logging/opentracing.py:450: error: Function "Type[Config]" could always be true in boolean context  [truthy-function]
      ```
      
      * Fix not calling `is_state()`
      
      Oops!
      
      ```
      tests/rest/client/test_third_party_rules.py:428: error: Function "Callable[[], bool]" could always be true in boolean context  [truthy-function]
      ```
      
      * Suppress false positives from ParamSpecs
      
      ````
      synapse/logging/opentracing.py:971: error: Argument 2 to "_custom_sync_async_decorator" has incompatible type "Callable[[Arg(Callable[P, R], 'func'), **P], _GeneratorContextManager[None]]"; expected "Callable[[Callable[P, R], **P], _GeneratorContextManager[None]]"  [arg-type]
      synapse/logging/opentracing.py:1017: error: Argument 2 to "_custom_sync_async_decorator" has incompatible type "Callable[[Arg(Callable[P, R], 'func'), **P], _GeneratorContextManager[None]]"; expected "Callable[[Callable[P, R], **P], _GeneratorContextManager[None]]"  [arg-type]
      ````
      
      * Drive-by improvement to `wrapping_logic` annotation
      
      * Workaround false "unreachable" positives
      
      See https://github.com/Shoobx/mypy-zope/issues/91
      
      ```
      tests/http/test_proxyagent.py:626: error: Statement is unreachable  [unreachable]
      tests/http/test_proxyagent.py:762: error: Statement is unreachable  [unreachable]
      tests/http/test_proxyagent.py:826: error: Statement is unreachable  [unreachable]
      tests/http/test_proxyagent.py:838: error: Statement is unreachable  [unreachable]
      tests/http/test_proxyagent.py:845: error: Statement is unreachable  [unreachable]
      tests/http/federation/test_matrix_federation_agent.py:151: error: Statement is unreachable  [unreachable]
      tests/http/federation/test_matrix_federation_agent.py:452: error: Statement is unreachable  [unreachable]
      tests/logging/test_remote_handler.py:60: error: Statement is unreachable  [unreachable]
      tests/logging/test_remote_handler.py:93: error: Statement is unreachable  [unreachable]
      tests/logging/test_remote_handler.py:127: error: Statement is unreachable  [unreachable]
      tests/logging/test_remote_handler.py:152: error: Statement is unreachable  [unreachable]
      ```
      
      * Changelog
      
      * Tweak DBAPI2 Protocol to be accepted by mypy 1.0
      
      Some extra context in:
      - https://github.com/matrix-org/python-canonicaljson/pull/57
      - https://github.com/python/mypy/issues/6002
      - https://mypy.readthedocs.io/en/latest/common_issues.html#covariant-subtyping-of-mutable-protocol-members-is-rejected
      
      * Pull in updated canonicaljson lib
      
      so the protocol check just works
      
      * Improve comments in opentracing
      
      I tried to workaround the ignores but found it too much trouble.
      
      I think the corresponding issue is
      https://github.com/python/mypy/issues/12909. The mypy repo has a PR
      claiming to fix this (https://github.com/python/mypy/pull/14677) which
      might mean this gets resolved soon?
      
      * Better annotation for INTERACTIVE_AUTH_CHECKERS
      
      * Drive-by AUTH_TYPE annotation, to remove an ignore
      Unverified
      ffc2ee52
    • Patrick Cloke's avatar
      Update intentional mentions (MSC3952) to depend on `exact_event_match` (MSC3758). (#15037) · 979f237b
      Patrick Cloke authored
      This replaces the specific `is_room_mention` push rule condition
      used in MSC3952 with the generic `exact_event_match` push rule
      condition from MSC3758.
      
      No functionality changes due to this.
      Unverified
      979f237b
  5. Feb 15, 2023
  6. Feb 14, 2023
  7. Feb 13, 2023
Loading