23 Commits

Author SHA1 Message Date
Kegan Dougal
a25b2ee39d fix avatar updates; add e2e test for rejoining 2023-11-14 13:56:06 +00:00
Kegan Dougal
7e06813fe2 Fix #365: only return the last joined range
If we returned multiple distinct ranges, we always assumed that
the history visibility was "joined", so we would never return
events in the invite/shared state. This would be fine if the client
had a way to fetch those events sent before they were joined, but
they did not have a way as the prev_batch token would not be set
correctly. We now only return a single range of events and the prev
batch for /that/ range only, and defer to the upstream HS for
history visibility calculations.

Add end-to-end test to assert this new behaviour works.
2023-11-06 11:54:15 +00:00
Kegan Dougal
d1cb97663f Fixup tests 2023-10-11 17:14:49 +01:00
Kegan Dougal
37aa1469a5 WIP: use complement libraries 2023-10-11 12:23:46 +01:00
Till Faelligen
e265e3b220
Move "heroes" to RoomSubscription 2023-09-15 16:57:12 +02:00
David Robertson
f47267b574
WIP more tests 2023-09-11 20:16:23 +01:00
David Robertson
57d8c1deba
Expose Domain on CSAPI 2023-09-11 20:16:12 +01:00
David Robertson
956ef54d2d
creationContent -> reqBody
It is not the creation content (i.e. the content of the m.room.create event).
2023-09-07 18:34:08 +01:00
Kegan Dougal
b2c26b7e93 Redact events in the DB on m.room.redaction
Fixes #279
2023-08-31 17:06:44 +01:00
David Robertson
5ac3430486
Test helper for setting an avatar
Expose this on CSAPI for tests to use too.

Also update SlidingSyncUntilMembership to check the membership only.
Otherwise it would try to match an avatar. In 99% of cases this would be
fine, but things like per-room avatars (or indeed per-room displaynames)
would screw this up.
2023-07-18 10:47:01 +01:00
David Robertson
89b7aaa632
Fix an error in previous BumpEventTypes test 2023-05-25 18:13:49 +01:00
Kegan Dougal
ff8eb1e92f Add regression test for #66 2023-04-27 18:46:35 +01:00
David Robertson
419e1abeee
Update test case again 2023-04-17 12:31:21 +01:00
David Robertson
1d59167feb
E2E test case draft 2023-04-13 19:44:37 +01:00
David Robertson
3723b34f3d
Fix SlidingSyncUntilMembership for invites
Apparently invites have displaynames too
2023-04-11 13:10:53 +01:00
David Robertson
ba064b9771
SlidingSyncUntilMembership: check for non-joins
Don't actually use this here; this is a drive-by fix for our future selves
2023-04-11 12:45:57 +01:00
Kegan Dougal
aa28df161c Rename package -> github.com/matrix-org/sliding-sync 2022-12-15 11:08:50 +00:00
Kegan Dougal
be8543a21a add extensions for typing and receipts; bugfixes and additional perf improvements
Features:
 - Add `typing` extension.
 - Add `receipts` extension.
 - Add comprehensive prometheus `/metrics` activated via `SYNCV3_PROM`.
 - Add `SYNCV3_PPROF` support.
 - Add `by_notification_level` sort order.
 - Add `include_old_rooms` support.
 - Add support for `$ME` and `$LAZY`.
 - Add correct filtering when `*,*` is used as `required_state`.
 - Add `num_live` to each room response to indicate how many timeline entries are live.

Bug fixes:
 - Use a stricter comparison function on ranges: fixes an issue whereby UTs fail on go1.19 due to change in sorting algorithm.
 - Send back an `errcode` on HTTP errors (e.g expired sessions).
 - Remove `unsigned.txn_id` on insertion into the DB. Otherwise other users would see other users txn IDs :(
 - Improve range delta algorithm: previously it didn't handle cases like `[0,20] -> [20,30]` and would panic.
 - Send HTTP 400 for invalid range requests.
 - Don't publish no-op unread counts which just adds extra noise.
 - Fix leaking DB connections which could eventually consume all available connections.
 - Ensure we always unblock WaitUntilInitialSync even on invalid access tokens. Other code relies on WaitUntilInitialSync() actually returning at _some_ point e.g on startup we have N workers which bound the number of concurrent pollers made at any one time, we need to not just hog a worker forever.

Improvements:
 - Greatly improve startup times of sync3 handlers by improving `JoinedRoomsTracker`: a modest amount of data would take ~28s to create the handler, now it takes 4s.
 - Massively improve initial initial v3 sync times, by refactoring `JoinedRoomsTracker`, from ~47s to <1s.
 - Add `SlidingSyncUntil...` in tests to reduce races.
 - Tweak the API shape of JoinedUsersForRoom to reduce state block processing time for large rooms from 63s to 39s.
 - Add trace task for initial syncs.
 - Include the proxy version in UA strings.
 - HTTP errors now wait 1s before returning to stop clients tight-looping on error.
 - Pending event buffer is now 2000.
 - Index the room ID first to cull the most events when returning timeline entries. Speeds up `SelectLatestEventsBetween` by a factor of 8.
 - Remove cancelled `m.room_key_requests` from the to-device inbox. Cuts down the amount of events in the inbox by ~94% for very large (20k+) inboxes, ~50% for moderate sized (200 events) inboxes. Adds book-keeping to remember the unacked to-device position for each client.
2022-12-14 18:53:55 +00:00
Kegan Dougal
0656d79abe Add additional e2e test to check that accepting invites works correctly 2022-08-16 11:04:23 +01:00
Kegan Dougal
a40441e963 Migrate lists_test to end-to-end tests
Add more helper functions like `WithPos` and `MatchTimeline`.
2022-07-26 17:54:58 +01:00
Kegan Dougal
86570aaff4 Migrate membership transitions test to e2e tests; add README 2022-07-26 12:24:05 +01:00
Kegan Dougal
7133ee0c51 Migrate security tests to e2e tests 2022-07-26 11:39:19 +01:00
Kegan Dougal
1e8ca38f79 e2e tests: add prev_batch tests
Uses a client theived from Complement since it does exactly what I want.
2022-07-25 17:51:26 +01:00