Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add support for MSC2716 marker events (federation) #10498

Merged
merged 63 commits into from
Aug 4, 2021

Commits on Jun 24, 2021

  1. Configuration menu
    Copy the full SHA
    d2e2aa7 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2021

  1. Configuration menu
    Copy the full SHA
    2d942ec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    38bcf13 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2021

  1. Fix messages from multiple senders in historical chunk

    Follow-up to #9247
    
    Part of MSC2716: matrix-org/matrix-spec-proposals#2716
    
    ---
    
    Previously, Synapse would throw a 403,
    `Cannot force another user to join.`,
    because we were trying to use `?user_id` from a single virtual user
    which did not match with messages from other users in the chunk.
    MadLittleMods committed Jul 7, 2021
    Configuration menu
    Copy the full SHA
    e405a23 View commit details
    Browse the repository at this point in the history
  2. Remove debug lines

    MadLittleMods committed Jul 7, 2021
    Configuration menu
    Copy the full SHA
    36f1565 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    05d6c51 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'develop' into madlittlemods/2716-backfill-historical-ev…

    …ents-for-federation
    
    Conflicts:
    	scripts-dev/complement.sh
    MadLittleMods committed Jul 7, 2021
    Configuration menu
    Copy the full SHA
    defc536 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    dfad8a8 View commit details
    Browse the repository at this point in the history

Commits on Jul 8, 2021

  1. Configuration menu
    Copy the full SHA
    7d850db View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    164dee4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    04b1f7e View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2021

  1. Make base insertion event float off on its own

    See #10250 (comment)
    
    Conflicts:
    	synapse/rest/client/v1/room.py
    MadLittleMods committed Jul 9, 2021
    Configuration menu
    Copy the full SHA
    b703962 View commit details
    Browse the repository at this point in the history
  2. Validate that the app service can actually control the given user

    See #10276 (comment)
    
    Conflicts:
    	synapse/rest/client/v1/room.py
    MadLittleMods committed Jul 9, 2021
    Configuration menu
    Copy the full SHA
    8c205e5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7b8b2d1 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'develop' into madlittlemods/2716-backfill-historical-ev…

    …ents-for-federation
    
    Conflicts:
    	synapse/rest/client/v1/room.py
    MadLittleMods committed Jul 9, 2021
    Configuration menu
    Copy the full SHA
    281588f View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2021

  1. Continue debugging

    MadLittleMods committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    4226165 View commit details
    Browse the repository at this point in the history
  2. Share validation logic

    MadLittleMods committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    baae5d8 View commit details
    Browse the repository at this point in the history

Commits on Jul 13, 2021

  1. Configuration menu
    Copy the full SHA
    c05e43b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    02b1bea View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    66cf5be View commit details
    Browse the repository at this point in the history

Commits on Jul 14, 2021

  1. Configuration menu
    Copy the full SHA
    ab8011b View commit details
    Browse the repository at this point in the history
  2. Clean up PR

    MadLittleMods committed Jul 14, 2021
    Configuration menu
    Copy the full SHA
    f20ba02 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    64aeb73 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ea7c30d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9a6fd3f View commit details
    Browse the repository at this point in the history
  6. Add changelog

    MadLittleMods committed Jul 14, 2021
    Configuration menu
    Copy the full SHA
    0f6179f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5970e3f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    bc13396 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    669da52 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9a86e05 View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2021

  1. Configuration menu
    Copy the full SHA
    8999567 View commit details
    Browse the repository at this point in the history
  2. Remove debug changes

    MadLittleMods committed Jul 15, 2021
    Configuration menu
    Copy the full SHA
    35a4569 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2021

  1. Configuration menu
    Copy the full SHA
    164e32b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    435f074 View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2021

  1. Configuration menu
    Copy the full SHA
    e0e1bd0 View commit details
    Browse the repository at this point in the history
  2. hs2 to better ask for insertion event extremity

    But running into the `sqlite3.IntegrityError: NOT NULL constraint failed: event_to_state_groups.state_group`
    error
    MadLittleMods committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    d63c34c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2196ba5 View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2021

  1. Switch to chunk events so we can auth via power_levels

    Previously, we were using `content.chunk_id` to connect one
    chunk to another. But these events can be from any `sender`
    and we can't tell who should be able to send historical events.
    We know we only want the application service to do it but these
    events have the sender of a real historical message, not the
    application service user ID as the sender. Other federated homeservers
    also have no indicator which senders are an application service on
    the originating homeserver.
    
    So we want to auth all of the MSC2716 events via power_levels
    and have them be sent by the application service with proper
    PL levels in the room.
    MadLittleMods committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    b2be8ce View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    04a29fe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    258fa57 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'madlittlemods/2716-backfill-historical-events-for-feder…

    …ation' into madlittlemods/2716-marker-events
    
    Conflicts:
    	synapse/storage/databases/main/events.py
    MadLittleMods committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    8ebbc5f View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2021

  1. Messy: Fix undefined state_group for federated historical events

    ```
    2021-07-13 02:27:57,810 - synapse.handlers.federation - 1248 - ERROR - GET-4 - Failed to backfill from hs1 because NOT NULL constraint failed: event_to_state_groups.state_group
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 1216, in try_backfill
        await self.backfill(
      File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 1035, in backfill
        await self._auth_and_persist_event(dest, event, context, backfilled=True)
      File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 2222, in _auth_and_persist_event
        await self._run_push_actions_and_persist_event(event, context, backfilled)
      File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 2244, in _run_push_actions_and_persist_event
        await self.persist_events_and_notify(
      File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 3290, in persist_events_and_notify
        events, max_stream_token = await self.storage.persistence.persist_events(
      File "/usr/local/lib/python3.8/site-packages/synapse/logging/opentracing.py", line 774, in _trace_inner
        return await func(*args, **kwargs)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 320, in persist_events
        ret_vals = await yieldable_gather_results(enqueue, partitioned.items())
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 237, in handle_queue_loop
        ret = await self._per_item_callback(
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 577, in _persist_event_batch
        await self.persist_events_store._persist_events_and_state_updates(
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 176, in _persist_events_and_state_updates
        await self.db_pool.runInteraction(
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 681, in runInteraction
        result = await self.runWithConnection(
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 770, in runWithConnection
        return await make_deferred_yieldable(
      File "/usr/local/lib/python3.8/site-packages/twisted/python/threadpool.py", line 238, in inContext
        result = inContext.theWork()  # type: ignore[attr-defined]
      File "/usr/local/lib/python3.8/site-packages/twisted/python/threadpool.py", line 254, in <lambda>
        inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
      File "/usr/local/lib/python3.8/site-packages/twisted/python/context.py", line 118, in callWithContext
        return self.currentContext().callWithContext(ctx, func, *args, **kw)
      File "/usr/local/lib/python3.8/site-packages/twisted/python/context.py", line 83, in callWithContext
        return func(*args, **kw)
      File "/usr/local/lib/python3.8/site-packages/twisted/enterprise/adbapi.py", line 293, in _runWithConnection
        compat.reraise(excValue, excTraceback)
      File "/usr/local/lib/python3.8/site-packages/twisted/python/deprecate.py", line 298, in deprecatedFunction
        return function(*args, **kwargs)
      File "/usr/local/lib/python3.8/site-packages/twisted/python/compat.py", line 403, in reraise
        raise exception.with_traceback(traceback)
      File "/usr/local/lib/python3.8/site-packages/twisted/enterprise/adbapi.py", line 284, in _runWithConnection
        result = func(conn, *args, **kw)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 765, in inner_func
        return func(db_conn, *args, **kwargs)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 549, in new_transaction
        r = func(cursor, *args, **kwargs)
      File "/usr/local/lib/python3.8/site-packages/synapse/logging/utils.py", line 69, in wrapped
        return f(*args, **kwargs)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 385, in _persist_events_txn
        self._store_event_state_mappings_txn(txn, events_and_contexts)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 2065, in _store_event_state_mappings_txn
        self.db_pool.simple_insert_many_txn(
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 923, in simple_insert_many_txn
        txn.execute_batch(sql, vals)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 280, in execute_batch
        self.executemany(sql, args)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 300, in executemany
        self._do_execute(self.txn.executemany, sql, *args)
      File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 330, in _do_execute
        return func(sql, *args)
    sqlite3.IntegrityError: NOT NULL constraint failed: event_to_state_groups.state_group
    ```
    MadLittleMods committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    187ab28 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9d70e95 View commit details
    Browse the repository at this point in the history
  3. Fix federated events being rejected for no state_groups

    Add fix from #10439
    until it merges.
    MadLittleMods committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    9352635 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'develop' into madlittlemods/2716-backfill-historical-ev…

    …ents-for-federation
    
    Conflicts:
    	synapse/handlers/room.py
    MadLittleMods committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    5c454b7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e881cff View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2021

  1. Configuration menu
    Copy the full SHA
    c9330ec View commit details
    Browse the repository at this point in the history
  2. Merge branch 'madlittlemods/2716-backfill-historical-events-for-feder…

    …ation' into madlittlemods/2716-marker-events
    
    Conflicts:
    	scripts-dev/complement.sh
    	synapse/storage/databases/main/events.py
    MadLittleMods committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    347a3e1 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2021

  1. Merge branch 'develop' into madlittlemods/2716-marker-events

    Conflicts:
    	scripts-dev/complement.sh
    	synapse/event_auth.py
    	synapse/storage/databases/main/event_federation.py
    	synapse/storage/databases/main/events.py
    	synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql
    MadLittleMods committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    97fb158 View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2021

  1. Configuration menu
    Copy the full SHA
    f115aec View commit details
    Browse the repository at this point in the history
  2. Some log cleanup

    MadLittleMods committed Jul 29, 2021
    Configuration menu
    Copy the full SHA
    b55315f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    088c3ef View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8072170 View commit details
    Browse the repository at this point in the history
  5. Add changelog

    MadLittleMods committed Jul 29, 2021
    Configuration menu
    Copy the full SHA
    44b883c View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2021

  1. Ignore rejected events

    MadLittleMods committed Aug 3, 2021
    Configuration menu
    Copy the full SHA
    5268749 View commit details
    Browse the repository at this point in the history
  2. Use simplified upsert

    MadLittleMods committed Aug 3, 2021
    Configuration menu
    Copy the full SHA
    71c2f05 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b832264 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2021

  1. Configuration menu
    Copy the full SHA
    1dc0996 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    32af944 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1b7e627 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e6e48ed View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    23bc5e5 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    92dd985 View commit details
    Browse the repository at this point in the history