Skip to content
Snippets Groups Projects
  1. Jan 24, 2025
  2. Mar 14, 2024
  3. Mar 13, 2024
  4. Jan 23, 2024
  5. Nov 23, 2023
  6. Nov 21, 2023
  7. Nov 09, 2023
  8. Apr 20, 2023
    • Patrick Cloke's avatar
      Modify StoreKeyFetcher to read from server_keys_json. (#15417) · 5e024a06
      Patrick Cloke authored
      Before this change:
      
      * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`.
      * `PerspectivesKeyFetcher` also writes to `server_signature_keys`.
      * `StoreKeyFetcher` reads from `server_signature_keys`.
      
      After this change:
      
      * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`.
      * `PerspectivesKeyFetcher` also writes to `server_signature_keys`.
      * `StoreKeyFetcher` reads from `server_keys_json`.
      
      This results in `StoreKeyFetcher` now using the results from `ServerKeyFetcher`
      in addition to those from `PerspectivesKeyFetcher`, i.e. keys which are directly
      fetched from a server will now be pulled from the database instead of refetched.
      
      An additional minor change is included to avoid creating a `PerspectivesKeyFetcher`
      (and checking it) if no `trusted_key_servers` are configured.
      
      The overall impact of this should be better usage of cached results:
      
      * If a server has no trusted key servers configured then it should reduce how often keys
        are fetched.
      * if a server's trusted key server does not have a requested server's keys cached then it
        should reduce how often keys are directly fetched.
      5e024a06
  9. Feb 16, 2023
    • 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
      ffc2ee52
  10. Feb 09, 2023
    • Shay's avatar
      Add a class UnpersistedEventContext to allow for the batching up of storing state groups (#14675) · 03bccd54
      Shay authored
      
      * add class UnpersistedEventContext
      
      * modify create new client event to create unpersistedeventcontexts
      
      * persist event contexts after creation
      
      * fix tests to persist unpersisted event contexts
      
      * cleanup
      
      * misc lints + cleanup
      
      * changelog + fix comments
      
      * lints
      
      * fix batch insertion?
      
      * reduce redundant calculation
      
      * add unpersisted event classes
      
      * rework compute_event_context, split into function that returns unpersisted event context and then persists it
      
      * use calculate_context_info to create unpersisted event contexts
      
      * update typing
      
      * $%#^&*
      
      * black
      
      * fix comments and consolidate classes, use attr.s for class
      
      * requested changes
      
      * lint
      
      * requested changes
      
      * requested changes
      
      * refactor to be stupidly explicit
      
      * clearer renaming and flow
      
      * make partial state non-optional
      
      * update docstrings
      
      ---------
      
      Co-authored-by: default avatarErik Johnston <erik@matrix.org>
      03bccd54
  11. Dec 01, 2022
  12. Sep 30, 2022
  13. Sep 06, 2022
  14. Aug 15, 2022
  15. Jul 19, 2022
  16. Jul 05, 2022
    • David Robertson's avatar
      Type `tests.utils` (#13028) · 6ba732fe
      David Robertson authored
      * Cast to postgres types when handling postgres db
      
      * Remove unused method
      
      * Easy annotations
      
      * Annotate create_room
      
      * Use `ParamSpec` to annotate looping_call
      
      * Annotate `default_config`
      
      * Track `now` as a float
      
      `time_ms` returns an int like the proper Synapse `Clock`
      
      * Introduce a `Timer` dataclass
      
      * Introduce a Looper type
      
      * Suppress checking of a mock
      
      * tests.utils is typed
      
      * Changelog
      
      * Whoops, import ParamSpec from typing_extensions
      
      * ditch the psycopg2 casts
      6ba732fe
  17. Jul 04, 2022
  18. Jun 15, 2022
  19. May 31, 2022
  20. Apr 05, 2022
  21. Mar 24, 2022
  22. Feb 23, 2022
  23. Jan 07, 2022
    • David Robertson's avatar
      Optionally use an on-disk sqlite db in tests (#11702) · d3cf0730
      David Robertson authored
      
      * Optionally use an on-disk sqlite db in tests
      
      When debugging a test it is sometimes useful to inspect the state of the
      DB. This is not easy when the db is in-memory: one cannot attach the
      sqlite CLI to another process's DB.
      
      With this change, if SYNAPSE_TEST_PERSIST_SQLITE_DB is set, we use
       `_trial_temp/test.db` as our sqlite database. One can then use 
      `sqlite3 _trial_temp/test.db` and query to your heart's content.
      
      The DB is destroyed and recreated between different test cases.
      
      Co-authored-by: default avatarPatrick Cloke <clokep@users.noreply.github.com>
      d3cf0730
  24. Dec 21, 2021
  25. Dec 03, 2021
  26. Nov 23, 2021
    • Shay's avatar
      Remove code invalidated by deprecated config flag... · 7cebaf96
      Shay authored
      Remove code invalidated by deprecated config flag 'trust_identity_servers_for_password_resets' (#11395)
      
      * remove background update code related to deprecated config flag
      
      * changelog entry
      
      * update changelog
      
      * Delete 11394.removal
      
      Duplicate, wrong number
      
      * add no-op background update and change newfragment so it will be consolidated with associated work
      
      * remove unused code
      
      * Remove code associated with deprecated flag from legacy docker dynamic config file
      
      Co-authored-by: default avatarreivilibre <oliverw@matrix.org>
      7cebaf96
  27. Sep 23, 2021
  28. Aug 02, 2021
  29. Apr 23, 2021
  30. Apr 20, 2021
  31. Apr 14, 2021
  32. Apr 13, 2021
  33. Apr 09, 2021
  34. Mar 30, 2021
  35. Feb 22, 2021
  36. Feb 16, 2021
Loading