Skip to content
Snippets Groups Projects
  1. Jan 31, 2023
    • Sean Quah's avatar
      Make sqlite database migrations transactional again, part two (#14926) · 6d14fdc2
      Sean Quah authored
      
      #14910 fixed the regression introduced by #13873 where sqlite database
      migrations would no longer run inside a transaction. However, it
      committed the transaction before Synapse updated its bookkeeping of
      which migrations have been run, which means that migrations may be run
      again after they have completed successfully.
      
      Leave the transaction open at the end of `executescript`, to restore the
      old, correct behaviour. Also make the PostgreSQL behaviour consistent
      with SQLite.
      
      Fixes #14909.
      
      Signed-off-by: default avatarSean Quah <seanq@matrix.org>
      Unverified
      6d14fdc2
    • David Robertson's avatar
      Reject boolean power levels (#14944) · a134e626
      David Robertson authored
      * Better test for bad values in power levels events
      
      The previous test only checked that Synapse didn't raise an exception,
      but didn't check that we had correctly interpreted the value of the
      dodgy power level.
      
      It also conflated two things: bad room notification levels, and bad user
      levels. There _is_ logic for converting the latter to integers, but we
      should test it separately.
      
      * Check we ignore types that don't convert to int
      
      * Handle `None` values in `notifications.room`
      
      * Changelog
      
      * Also test that bad values are rejected by event auth
      
      * Docstring
      
      * linter scripttttttttt
      
      * Test boolean values in PL content
      
      * Reject boolean power levels
      
      * Changelog
      Unverified
      a134e626
    • David Robertson's avatar
      Prefer `type(x) is int` to `isinstance(x, int)` (#14945) · 796a4b74
      David Robertson authored
      * Perfer `type(x) is int` to `isinstance(x, int)`
      
      This covered all additional instances I could see where `x` was
      user-controlled.
      The remaining cases are
      
      ```
      $ rg -s 'isinstance.*[^_]int'
      tests/replication/_base.py
      576:        if isinstance(obj, int):
      
      synapse/util/caches/stream_change_cache.py
      136:        assert isinstance(stream_pos, int)
      214:        assert isinstance(stream_pos, int)
      246:        assert isinstance(stream_pos, int)
      267:        assert isinstance(stream_pos, int)
      
      synapse/replication/tcp/external_cache.py
      133:        if isinstance(result, int):
      
      synapse/metrics/__init__.py
      100:        if isinstance(calls, (int, float)):
      
      synapse/handlers/appservice.py
      262:        assert isinstance(new_token, int)
      
      synapse/config/_util.py
      62:        if isinstance(p, int):
      ```
      
      which cover metrics, logic related to `jsonschema`, and replication and
      data streams. AFAICS these are all internal to Synapse
      
      * Changelog
      Unverified
      796a4b74
  2. Jan 30, 2023
  3. Jan 27, 2023
  4. Jan 26, 2023
  5. Jan 25, 2023
  6. Jan 24, 2023
  7. Jan 23, 2023
Loading