Skip to content

Commit

Permalink
Fix invite test for all environments; bump SS to v0.99.12
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Nov 9, 2023
1 parent 01cbc28 commit 30ee8e8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ TODO: consider checking in working builds so you can git clone and run. Git LFS
There is an exhaustive set of tests that this repository aims to exercise which are below:

Membership ACLs:
- [x] Happy case Alice <-> Bob encrypted room can send/recv messages.
- [x] Bob can see messages when he was invited but not joined to the room.
- [ ] New user Charlie does not see previous messages when he joins the room. TODO: can he see messages sent after he was invited?. Assert this either way.
- [ ] Subsequent messages are decryptable by all 3 users.
- [x] Happy case Alice and Bob in an encrypted room can send and receive encrypted messages, and decrypt them all.
- [x] Bob can see messages when he was invited but not joined to the room. Subsequent messages are also decryptable.
- [ ] In a public, `shared` history visibility room, a new user Charlie cannot decrypt earlier messages prior to his join, despite being able to see the events. Subsequent messages are decryptable.
- [ ] Bob leaves the room. Some messages are sent. Bob rejoins and cannot decrypt the messages sent whilst he was gone (ensuring we cycle keys). Repeat this again with a device instead of a user (so 2x device, 1 remains always in the room, 1 then logs out -> messages sent -> logs in again).
- [ ] Having A invite B, having B then change device, then B join, see if B can see A's message.
- [ ] Alice invites Bob, Bob changes their device, then Bob joins. Bob should be able to see Alice's message.

Key backups:
- [ ] New device for Alice cannot decrypt previous messages.
Expand Down Expand Up @@ -80,6 +79,8 @@ This repo has a self-hosted copy of `matrix-js-sdk` which it will run in a headl

In order to regenerate the JS SDK, run `./rebuild_js_sdk.sh` with an appropriate version.

TODO: Dockerify this so developers don't _need_ an active npm install?

### Regenerate FFI Bindings

Prerequisites:
Expand Down
8 changes: 4 additions & 4 deletions internal/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func RunNewDeployment(t *testing.T) *SlidingSyncDeployment {
ssContainer, err := testcontainers.GenericContainer(ctx,
testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
Image: "ghcr.io/matrix-org/sliding-sync:v0.99.11",
Image: "ghcr.io/matrix-org/sliding-sync:v0.99.12",
ExposedPorts: []string{ssExposedPort},
Env: map[string]string{
"SYNCV3_SECRET": "secret",
Expand All @@ -103,9 +103,9 @@ func RunNewDeployment(t *testing.T) *SlidingSyncDeployment {

// log for debugging purposes
t.Logf("SlidingSyncDeployment created (network=%s):", networkName)
t.Logf(" NAME INT / EXT")
t.Logf(" sliding sync: ssproxy / %s", ssURL)
t.Logf(" synapse: hs1 / %s", csapi.BaseURL)
t.Logf(" NAME INT EXT")
t.Logf(" sliding sync: ssproxy %s", ssURL)
t.Logf(" synapse: hs1 %s", csapi.BaseURL)
t.Logf(" postgres: postgres")
return &SlidingSyncDeployment{
Deployment: deployment,
Expand Down
4 changes: 3 additions & 1 deletion rust/matrix_sdk_ffi/matrix_sdk_ffi.go
Original file line number Diff line number Diff line change
Expand Up @@ -16499,7 +16499,7 @@ type concurrentHandleMap[T any] struct {
leftMap map[uint64]*T
rightMap map[*T]uint64
currentHandle uint64
lock sync.Mutex
lock sync.RWMutex
}

func newConcurrentHandleMap[T any]() *concurrentHandleMap[T] {
Expand Down Expand Up @@ -16532,6 +16532,8 @@ func (cm *concurrentHandleMap[T]) remove(handle uint64) bool {
}

func (cm *concurrentHandleMap[T]) tryGet(handle uint64) (*T, bool) {
cm.lock.RLock()
defer cm.lock.RUnlock()
val, ok := cm.leftMap[handle]
return val, ok
}
Expand Down
7 changes: 2 additions & 5 deletions tests/invite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ func TestCanDecryptMessagesAfterInviteButBeforeJoin(t *testing.T) {
}

func testCanDecryptMessagesAfterInviteButBeforeJoin(t *testing.T, clientTypeA, clientTypeB api.ClientType) {
if clientTypeA == api.ClientTypeRust && clientTypeB == api.ClientTypeRust {
t.Skip("Skipping rust/rust as SS proxy sends invite/join in timeline, omitting the invite msg")
}
// Setup Code
// ----------
deployment := Deploy(t)
Expand Down Expand Up @@ -93,7 +90,8 @@ func testCanDecryptMessagesAfterInviteButBeforeJoin(t *testing.T, clientTypeA, c
must.Equal(t, isEncrypted, true, "room is not encrypted")
t.Logf("bob room encrypted = %v", isEncrypted)

// send a sentinel message and wait for it to ensure we are joined and syncing
// send a sentinel message and wait for it to ensure we are joined and syncing.
// This also checks that subsequent messages are decryptable.
sentinelBody := "Sentinel"
waiter := bob.WaitUntilEventInRoom(t, roomID, sentinelBody)
alice.SendMessage(t, roomID, sentinelBody)
Expand All @@ -106,5 +104,4 @@ func testCanDecryptMessagesAfterInviteButBeforeJoin(t *testing.T, clientTypeA, c
waiter = bob.WaitUntilEventInRoom(t, roomID, wantMsgBody)
bob.MustBackpaginate(t, roomID, 5) // number is arbitrary, just needs to be >=2
waiter.Wait(t, 5*time.Second)
// time.Sleep(time.Hour)
}

0 comments on commit 30ee8e8

Please sign in to comment.