Skip to content

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Oct 1, 2025

Synapse PR: element-hq/synapse#18968

MSC4354

Pull Request Checklist

if e.StateKey != nil {
paths = []string{"_matrix", "client", "v3", "rooms", roomID, "state", e.Type, *e.StateKey}
}
qps := url.Values{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this stand for? query parameter xxx (string? strings?)

An LLM said "query parameters" which is probably the right answer ⏩

Maybe too opaque

"lists": map[string]any{
"any-key": map[string]any{
"timeline_limit": 10,
"required_state": [][]string{{"*", "*"}},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well request no state since it's never used

Suggested change
"required_state": [][]string{{"*", "*"}},
"required_state": [][]string{},

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this is because we actually create sticky state events (see makeStickyEvent(...)) but we don't ever look for it in required_state so we can still get rid of this.

},
},
}
qps := url.Values{"timeout": []string{"5000"}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could align with the same timeout we use for normal /sync

"timeout": []string{"1000"},

Suggested change
qps := url.Values{"timeout": []string{"5000"}}
qps := url.Values{"timeout": []string{"1000"}}

return respBody, newPos
}

// standardised response format for /sync and SSS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// standardised response format for /sync and SSS
// Normalized response format for /sync and SSS

🤷

resp, nextSince = cli.MustSync(t, client.SyncReq{Since: since})
timeline = resp.Get("rooms.join." + client.GjsonEscape(roomID) + ".timeline.events").Array()
sticky = resp.Get("rooms.join." + client.GjsonEscape(roomID) + ".msc4354_sticky.events").Array()
// t.Logf("%s\b", resp.Raw)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover debug log

Fine to leave it if you want

if hasStickyEvent(syncResp.timelineEvents) {
ct.Fatalf(t, "timeline had the sticky event, is delayed events supported?")
}
must.Equal(t, len(syncResp.stickyEvents), 0, "events were in sticky events when they shouldn't have been")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
must.Equal(t, len(syncResp.stickyEvents), 0, "events were in sticky events when they shouldn't have been")
must.Equal(t, len(syncResp.stickyEvents), 0, "events were listed in sticky events, is delayed events supported?")

// wait for the sticky event to send
time.Sleep(4 * time.Second)

for i := 0; i < 25; i++ {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(explain why 25, related to discussion above)

}
}

func TestUnsignedTTL(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test description would be nice

We're just checking that unsigned.msc4354_sticky_duration_ttl_ms shows up. Useful for clients because ...


syncResp := gatherSyncResults(t, bob, useSimplifiedSlidingSync, roomID, stopEventID)
mustHaveStickyEventID(t, stickyEventIDNotInTimeline, syncResp.stickyEvents)
mustHaveStickyEventID(t, stickyEventIDInTimeline, syncResp.stickyEvents)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own understanding, this is more like stickyEventIDThatWouldBeInTimelineIfHistoryVisibilityWasBroken

Or perhaps, stickyEventIDInTimeline actually shows up in the timeline not just in the sticky list 🤔 - I'm guessing it's this.

Comment on lines +339 to +341
// Test that newly joined users to history_visibility: joined rooms correctly see sticky events
// in the `sticky` section.
func TestStickyEventsIgnoreHistoryVisibility(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to be missing some tests for some expired sticky events and whether they should show up

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

Successfully merging this pull request may close these issues.

2 participants