synapse-product/synapse
Eric Eastwood 860fdd9098
Fix @tag_args being off-by-one (ahead) (#13452)
Fix @tag_args being off-by-one (ahead)

Example:

```
argspec.args=[
  'self',
  'room_id'
]

args=(
  <synapse.storage.databases.main.DataStore object at 0x10d0b8d00>,
  '!HBehERstyQBxyJDLfR:my.synapse.server'
)
```

---

The previous logic was also flawed and we can end up in a situation like this:

```
argspec.args=['self', 'dest', 'room_id', 'limit', 'extremities']

args=(<synapse.federation.federation_client.FederationClient object at 0x7f1651c18160>, 'hs1', '!jAEHKIubyIfuLOdfpY:hs1')
```

From this source:
```py
async def backfill(
    self, dest: str, room_id: str, limit: int, extremities: Collection[str]
) -> Optional[List[EventBase]]:
```

And this usage:
```py
events = await self._federation_client.backfill(
    dest, room_id, limit=limit, extremities=extremities
)
```

which would previously cause this error:
```
synapse_main | 2022-08-04 06:13:12,051 - synapse.handlers.federation - 424 - ERROR - GET-5 - Failed to backfill from hs1 because tuple index out of range
synapse_main | Traceback (most recent call last):
synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation.py", line 392, in try_backfill
synapse_main |     await self._federation_event_handler.backfill(
synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 828, in _wrapper
synapse_main |     return await func(*args, **kwargs)
synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation_event.py", line 593, in backfill
synapse_main |     events = await self._federation_client.backfill(
synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 828, in _wrapper
synapse_main |     return await func(*args, **kwargs)
synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 827, in _wrapper
synapse_main |     with wrapping_logic(func, *args, **kwargs):
synapse_main |   File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
synapse_main |     return next(self.gen)
synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 922, in _wrapping_logic
synapse_main |     set_attribute("ARG_" + arg, str(args[i + 1]))  # type: ignore[index]
synapse_main | IndexError: tuple index out of range
```
2022-08-04 14:29:41 -05:00
..
_scripts Merge branch 'master' into develop 2022-07-19 16:14:02 +02:00
api Instrument /messages for understandable traces in Jaeger (#13368) 2022-08-03 10:57:38 -05:00
app Revert "Drop support for delegating email validation (#13192)" (#13406) 2022-07-29 10:29:23 +00:00
appservice Add prometheus counters for content types other than events (#13175) 2022-07-13 15:18:20 +01:00
config Rename RateLimitConfig to RatelimitSettings (#13442) 2022-08-03 10:40:20 +01:00
crypto Bump black and click versions (#12320) 2022-04-05 11:04:28 +01:00
events Update type of EventContext.rejected (#13460) 2022-08-04 17:45:01 +01:00
federation Faster Room Joins: prevent Synapse from answering federated join requests for a room which it has not fully joined yet. (#13416) 2022-08-04 16:27:04 +01:00
handlers Faster Room Joins: prevent Synapse from answering federated join requests for a room which it has not fully joined yet. (#13416) 2022-08-04 16:27:04 +01:00
http Implement MSC3848: Introduce errcodes for specific event sending failures (#13343) 2022-07-27 13:44:40 +01:00
logging Fix @tag_args being off-by-one (ahead) (#13452) 2022-08-04 14:29:41 -05:00
metrics Add missing types to opentracing. (#13345) 2022-07-21 12:01:52 +00:00
module_api Add module API method to create a room (#13429) 2022-08-04 09:34:05 +00:00
push Merge remote-tracking branch 'origin/master' into develop 2022-07-20 14:59:43 +01:00
replication Remove old empty/redundant slaved stores. (#13349) 2022-07-21 17:56:45 +00:00
res Disable autocorrect and autocaptialisation when entering username for SSO registration. (#13350) 2022-07-26 08:08:20 +00:00
rest Rename RateLimitConfig to RatelimitSettings (#13442) 2022-08-03 10:40:20 +01:00
server_notices Decouple synapse.api.auth_blocking.AuthBlocking from synapse.api.auth.Auth. (#13021) 2022-06-14 09:51:15 +01:00
spam_checker_api Fix import in module_api module and docs on the new check_event_for_spam signature (#12918) 2022-05-31 12:04:53 +02:00
state Refactor _resolve_state_at_missing_prevs to return an EventContext (#13404) 2022-08-01 13:53:56 +01:00
static Display an error page during failure of fallback UIA. (#10561) 2021-08-18 08:13:35 -04:00
storage Improve comments (& avoid a duplicate query) in push actions processing. (#13455) 2022-08-04 19:24:44 +00:00
streams Instrument /messages for understandable traces in Jaeger (#13368) 2022-08-03 10:57:38 -05:00
util Optimise async get event lookups (#13435) 2022-08-04 15:49:55 +01:00
__init__.py Fix Synapse git info missing in version strings (#12973) 2022-06-07 15:24:11 +01:00
event_auth.py Implement MSC3848: Introduce errcodes for specific event sending failures (#13343) 2022-07-27 13:44:40 +01:00
notifier.py Notifier: accept callbacks to fire on room joins (#13254) 2022-07-13 19:48:24 +01:00
py.typed Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) 2021-10-13 08:42:41 +01:00
server.py Move the "email unsubscribe" resource, refactor the macaroon generator & simplify the access token verification logic. (#12986) 2022-06-14 09:12:08 -04:00
types.py Fix destination_is errors seen in sentry. (#13041) 2022-06-14 18:28:26 +01:00
visibility.py Instrument /messages for understandable traces in Jaeger (#13368) 2022-08-03 10:57:38 -05:00