Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sliding sync returns initial: false for a first response #17754

Closed
Hywan opened this issue Sep 24, 2024 · 1 comment
Closed

Sliding sync returns initial: false for a first response #17754

Hywan opened this issue Sep 24, 2024 · 1 comment

Comments

@Hywan
Copy link
Member

Hywan commented Sep 24, 2024

Description

Sliding sync returns the first response with initial: false. Not only it's incorrect, but if initial is not true, other data won't be attached, like joined_count or invite_count (and maybe others).

Steps to reproduce

  • git clone https://github.com/matrix-org/matrix-rust-sdk
  • remove #[ignore] in testing/matrix-sdk-integration-testing/src/tests/sliding_sync/notification_client.rs on top of the test_notification method,
  • run cd testing/matrix-sdk-integration-testing/ && docker compose -f assets/docker-compose.yml up -d && cd -
  • run cargo nextest run --retries 0 --fail-fast -p matrix-sdk-integration-testing -- sliding_sync::notification_client

Homeserver

local, synapse v1.114

Synapse Version

1.114

Installation Method

Docker (matrixdotorg/synapse)

Database

postgresql I suppose

Workers

I don't know

Platform

container on macOS

Configuration

No response

Relevant log output

Rust sends the following request:


Request {
    pos: None,
    conn_id: Some(
        "notifications",
    ),
    txn_id: Some(
        "3454cbd235af4fc2884c189df99df1b1",
    ),
    timeout: Some(
        1s,
    ),
    lists: {
        "invites": List {
            ranges: [
                (
                    0,
                    16,
                ),
            ],
            room_details: RoomDetails {
                required_state: [
                    (
                        "m.room.encryption",
                        "",
                    ),
                    (
                        "m.room.member",
                        "$LAZY",
                    ),
                    (
                        "m.room.member",
                        "$ME",
                    ),
                    (
                        "m.room.canonical_alias",
                        "",
                    ),
                    (
                        "m.room.name",
                        "",
                    ),
                    (
                        "m.room.power_levels",
                        "",
                    ),
                ],
                timeline_limit: Some(
                    8,
                ),
            },
            include_heroes: None,
            filters: Some(
                ListFilters {
                    is_invite: Some(
                        true,
                    ),
                    not_room_types: [
                        Space,
                    ],
                },
            ),
        },
    },
    room_subscriptions: {
        "!kJhFVgLmSwHmoFDgDv:matrix-sdk.rs": RoomSubscription {
            required_state: [
                (
                    "m.room.encryption",
                    "",
                ),
                (
                    "m.room.member",
                    "$LAZY",
                ),
                (
                    "m.room.member",
                    "$ME",
                ),
                (
                    "m.room.canonical_alias",
                    "",
                ),
                (
                    "m.room.name",
                    "",
                ),
                (
                    "m.room.power_levels",
                    "",
                ),
            ],
            timeline_limit: Some(
                16,
            ),
            include_heroes: None,
        },
    },
    extensions: Extensions {
        to_device: ToDevice {
            enabled: None,
            limit: None,
            since: None,
            lists: None,
            rooms: None,
        },
        e2ee: E2EE {
            enabled: None,
        },
        account_data: AccountData {
            enabled: Some(
                true,
            ),
            lists: None,
            rooms: None,
        },
        receipts: Receipts {
            enabled: None,
            lists: None,
            rooms: None,
        },
        typing: Typing {
            enabled: None,
            lists: None,
            rooms: None,
        },
        other: {},
    },
}


Rust receives the following response:

```rust
Response {
    initial: false,
    txn_id: None,
    pos: "70/s1235_228_0_1_91_1_67_333_0_1",
    lists: {
        "invites": List {
            count: 1,
        },
    },
    rooms: {
        "!kJhFVgLmSwHmoFDgDv:matrix-sdk.rs": Room {
            name: Some(
                "Kingdom of Integration Testing",
            ),
            avatar: Undefined,
            initial: Some(
                true,
            ),
            is_dm: None,
            invite_state: Some(
                [
                    Raw::<ruma_events::enums::AnyStrippedStateEvent> {
                        json: RawValue(
                            {"type":"m.room.join_rules","state_key":"","content":{"join_rule":"invite"},"sender":"@alice336083335834587528043410278571228479798:matrix-sdk.rs"},
                        ),
                    },
                    Raw::<ruma_events::enums::AnyStrippedStateEvent> {
                        json: RawValue(
                            {"type":"m.room.create","state_key":"","content":{"room_version":"10","creator":"@alice336083335834587528043410278571228479798:matrix-sdk.rs"},"sender":"@alice3360833358345
                        ),
                    },
                    Raw::<ruma_events::enums::AnyStrippedStateEvent> {
                        json: RawValue(
                            {"type":"m.room.member","state_key":"@alice336083335834587528043410278571228479798:matrix-sdk.rs","content":{"displayname":"Alice, Queen of Cryptography","membership":"join
                        ),
                    },
                    Raw::<ruma_events::enums::AnyStrippedStateEvent> {
                        json: RawValue(
                            {"type":"m.room.member","state_key":"@bob130057355307418395329784277089848882443:matrix-sdk.rs","content":{"is_direct":true,"displayname":"bob130057355307418395329784277089
                        ),
                    },
                ],
            ),
            unread_notifications: UnreadNotificationsCount {
                highlight_count: Some(
                    0,
                ),
                notification_count: Some(
                    0,
                ),
            },
            timeline: [],
            required_state: [],
            prev_batch: None,
            limited: false,
            joined_count: None,
            invited_count: None,
            num_live: None,
            bump_stamp: Some(
                1234,
            ),
            heroes: None,
        },
    },
    extensions: Extensions {
        to_device: None,
        e2ee: E2EE {
            device_lists: DeviceLists {
                changed: [],
                left: [],
            },
            device_one_time_keys_count: {},
            device_unused_fallback_key_types: None,
        },
        account_data: AccountData {
            global: [
                Raw::<ruma_events::enums::AnyGlobalAccountDataEvent> {
                    json: RawValue(
                        {"type":"m.push_rules","content":{"global":{"underride":[{"conditions":[{"kind":"event_match","key":"type","pattern":"m.call.invite"}],"actions":["notify",{"set_tweak":"sound",_tweak":"highlight","value":false}],"rule_id":".m.rule.encrypted","default":true,"enabled":true},{"conditions":[{"kind":"event_match","key":"type","pattern":"im.vector.modular.widgets"},{"kind":"event_match","key":"content.type","pattern":"jitsi"},{"kind":"event_match","key":"state_key","pattern":"*"}],"actions":["notify",{"set_tweak":"highlight","value":false}],"rule_id":".im.vector.jitsi","default":true,"enabled":true}],"sender":[],"room":[],"content":[{"actions":["notify",{"set_tweak":"highlight"},{"set_tweak":"sound","value":"default"}],"rule_id":".m.rule.contains_user_name","default":true,"pattern":"bob130057355307418395329784277089848882443","enabled":true}],"override":[{"conditions":[],"actions":[],"rule_id":".m.rule.master","default":true,"enabled":false},{"conditions":[{"kind":"event_match","key":"content.msgtype","pattern":"m.notice"}],"actions":[],"rule_id":".m.rule.suppress_notices","default":true,"enabled":true},{"conditions":[{"kind":"event_match","key":"type","pattern":"m.room.member"},{"kind":"event_match","key":"content.membership","pattern":"invite"},{"kind":"event_match","key":"state_key","pattern":"@bob130057355307418395329784277089848882443:matrix-sdk.rs"}],"actions":["notify",{"set_tweak":"highlight","value":false},{"set_tweak":"sound","value":"default"}],"rule_id":".m.rule.invite_for_me","default":true,"enabled":true},{"conditions":[{"kind":"event_match","key":"type","pattern":"m.room.member"}],"actions":[],"rule_id":".m.rule.member_event","default":true,"enabled":true},{"conditions":[{"kind":"event_property_contains","key":"content.m\\.mentions.user_ids","value":"@bob130057355307418395329784277089848882443:matrix-sdk.rs"}],"actions":["notify",{"set_tweak":"highlight"},{"set_tweak":"sound","value":"default"}],"rule_id":".m.rule.is_user_mention","default":true,"enabled":true},{"conditions":[{"kind":"contains_display_name"}],"actions":["notify",{"set_tweak":"highlight"},{"set_tweak":"sound","value":"default"}],"rule_id":".m.rule.contains_display_name","default":true,"enabled":true},{"conditions":[{"kind":"event_property_is","key":"content.m\\.mentions.room","value":true},{"kind":"sender_notification_permission","key":"room"}],"actions":["notify",{"set_tweak":"highlight"}],"rule_id":".m.rule.is_room_mention","default":true,"enabled":true},{"conditions":[{"kind":"sender_notification_permission","key":"room"},{"kind":"event_match","key":"content.body","pattern":"@room"}],"actions":["notify",{"set_tweak":"highlight"}],"rule_id":".m.rule.roomnotif","default":true,"enabled":true},{"conditions":[{"kind":"event_match","key":"type","pattern":"m.room.tombstone"},{"kind":"event_match","key":"state_key","pattern":""}],"actions":["notify",{"set_tweak":"highlight"}],"rule_id":".m.rule.tombstone","default":true,"enabled":true},{"conditions":[{"kind":"event_match","key":"type","pattern":"m.reaction"}],"actions":[],"rule_id":".m.rule.reaction","default":true,"enabled":true},{"conditions":[{"kind":"event_match","key":"type","pattern":"m.room.server_acl"},{"kind":"event_match","key":"state_key","pattern":""}],"actions":[],"rule_id":".m.rule.room.server_acl","default":true,"enabled":true},{"conditions":[{"kind":"event_property_is","key":"content.m\\.relates_to.rel_type","value":"m.replace"}],"actions":[],"rule_id":".m.rule.suppress_edits","default":true,"enabled":true}]}}},
                    ),
                },
            ],
            rooms: {},
        },
        receipts: Receipts {
            rooms: {},
        },
        typing: Typing {
            rooms: {},
        },
    },
}


### Anything else that would be useful to know?

_No response_
@Hywan
Copy link
Member Author

Hywan commented Sep 25, 2024

There is an error from the client stack. The top-level initial value doesn't exist in the MSC4186, but is expected on the client side, which defaults to false if absent.

The joined_count is missing because the server doesn't want to leak too much data about non-joined rooms. I've commented the MSC accordingly. We can update our test suite on the Matrix Rust SDK side.

Closing this issue.

@Hywan Hywan closed this as completed Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant