Skip to content
Snippets Groups Projects
  1. Dec 28, 2022
  2. Dec 16, 2022
  3. Dec 13, 2022
    • David Robertson's avatar
      Allow selecting "prejoin" events by state keys (#14642) · e2a1adbf
      David Robertson authored
      * Declare new config
      
      * Parse new config
      
      * Read new config
      
      * Don't use trial/our TestCase where it's not needed
      
      Before:
      
      ```
      $ time trial tests/events/test_utils.py > /dev/null
      
      real	0m2.277s
      user	0m2.186s
      sys	0m0.083s
      ```
      
      After:
      ```
      $ time trial tests/events/test_utils.py > /dev/null
      
      real	0m0.566s
      user	0m0.508s
      sys	0m0.056s
      ```
      
      * Helper to upsert to event fields
      
      without exceeding size limits.
      
      * Use helper when adding invite/knock state
      
      Now that we allow admins to include events in prejoin room state with
      arbitrary state keys, be a good Matrix citizen and ensure they don't
      accidentally create an oversized event.
      
      * Changelog
      
      * Move StateFilter tests
      
      should have done this in #14668
      
      * Add extra methods to StateFilter
      
      * Use StateFilter
      
      * Ensure test file enforces typed defs; alphabetise
      
      * Workaround surprising get_current_state_ids
      
      * Whoops, fix mypy
      e2a1adbf
  4. Dec 12, 2022
  5. Dec 09, 2022
  6. Dec 02, 2022
  7. Nov 25, 2022
  8. Nov 22, 2022
  9. Nov 17, 2022
  10. Nov 16, 2022
  11. Oct 31, 2022
  12. Oct 06, 2022
  13. Sep 06, 2022
  14. Aug 15, 2022
  15. Jul 21, 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 30, 2022
  19. Jun 28, 2022
  20. Jun 15, 2022
  21. Jun 09, 2022
  22. May 23, 2022
  23. May 19, 2022
  24. May 18, 2022
  25. May 17, 2022
  26. May 16, 2022
  27. May 13, 2022
  28. May 12, 2022
  29. May 04, 2022
  30. May 03, 2022
  31. Apr 27, 2022
    • David Robertson's avatar
      Make `scripts-dev` pass `mypy --disallow-untyped-defs` (#12356) · 30c8e7e4
      David Robertson authored
      Not enforced in config yet. One day.
      30c8e7e4
    • David Robertson's avatar
      Remove unused `# type: ignore`s (#12531) · 64632443
      David Robertson authored
      Over time we've begun to use newer versions of mypy, typeshed, stub
      packages---and of course we've improved our own annotations. This makes
      some type ignore comments no longer necessary. I have removed them.
      
      There was one exception: a module that imports `select.epoll`. The
      ignore is redundant on Linux, but I've kept it ignored for those of us
      who work on the source tree using not-Linux. (#11771)
      
      I'm more interested in the config line which enforces this. I want
      unused ignores to be reported, because I think it's useful feedback when
      annotating to know when you've fixed a problem you had to previously
      ignore.
      
      * Installing extras before typechecking
      
      Lacking an easy way to install all extras generically, let's bite the bullet and
      make install the hand-maintained `all` extra before typechecking.
      
      Now that https://github.com/matrix-org/backend-meta/pull/6 is merged to
      the release/v1 branch.
      64632443
  32. Apr 20, 2022
  33. Apr 11, 2022
    • Patrick Cloke's avatar
      4586119f
    • David Robertson's avatar
      Disallow untyped defs in synapse._scripts (#12422) · 961ee75a
      David Robertson authored
      Of note: 
      
      * No untyped defs in `register_new_matrix_user`
      
      This one might be contraversial. `request_registration` has three
      dependency-injection arguments used for testing. I'm removing the
      injection of the `requests` module and using `unitest.mock.patch` in the
      test cases instead.
      
      Doing `reveal_type(requests)` and `reveal_type(requests.get)` before the
      change:
      
      ```
      synapse/_scripts/register_new_matrix_user.py:45: note: Revealed type is "Any"
      synapse/_scripts/register_new_matrix_user.py:46: note: Revealed type is "Any"
      ```
      
      And after:
      
      ```
      synapse/_scripts/register_new_matrix_user.py:44: note: Revealed type is "types.ModuleType"
      synapse/_scripts/register_new_matrix_user.py:45: note: Revealed type is "def (url: Union[builtins.str, builtins.bytes], params: Union[Union[_typeshed.SupportsItems[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]], Tuple[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]], typing.Iterable[Tuple[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]]], builtins.str, builtins.bytes], None] =, data: Union[Any, None] =, headers: Union[Any, None] =, cookies: Union[Any, None] =, files: Union[Any, None] =, auth: Union[Any, None] =, timeout: Union[Any, None] =, allow_redirects: builtins.bool =, proxies: Union[Any, None] =, hooks: Union[Any, None] =, stream: Union[Any, None] =, verify: Union[Any, None] =, cert: Union[Any, None] =, json: Union[Any, None] =) -> requests.models.Response"
      ```
      
      * Drive-by comment in `synapse.storage.types`
      
      * No untyped defs in `synapse_port_db`
      
      This was by far the most painful. I'm happy to break this up into
      smaller pieces for review if it's not managable as-is.
      961ee75a
  34. Apr 08, 2022
Loading