Skip to content

Add and use SyncStateAfterHas(...) for TestDelayedEvents#874

Merged
MadLittleMods merged 1 commit into
mainfrom
madlittlemods/SyncStateAfterHas
May 15, 2026
Merged

Add and use SyncStateAfterHas(...) for TestDelayedEvents#874
MadLittleMods merged 1 commit into
mainfrom
madlittlemods/SyncStateAfterHas

Conversation

@MadLittleMods
Copy link
Copy Markdown
Collaborator

@MadLittleMods MadLittleMods commented May 13, 2026

Add and use SyncStateAfterHas(...) for TestDelayedEvents

Follow-up to #869 (comment)

Dev notes

UseStateAfter was introduced in #842

Other previous notes on using state_after for membership checks, #813 (comment)


logrus.WithFields(logrus.Fields{
	"json": string(topLevelSyncJSON.Raw),
}).Error("asdf")

Pull Request Checklist

Comment on lines -33 to -41
// A filter for `/sync` that excludes timeline events.
//
// This is useful if you want to see `state` in the `/sync` response without the pesky
// de-duplication with `timeline` that traditional `/sync` does.
const NoTimelineSyncFilter = `{
"room": {
"timeline": { "limit": 0 }
}
}`
Copy link
Copy Markdown
Collaborator Author

@MadLittleMods MadLittleMods May 13, 2026

Choose a reason for hiding this comment

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

Adding the new standard SyncStateAfterHas(...) check allows us to remove this custom filter and tribal knowledge around how it works.

Comment thread client/sync.go
//
// Note that the `state_after` section of a sync response will not contain the entire
// state of the room for incremental or `lazy_load_members` syncs.
func SyncStateAfterHas(roomID string, check func(gjson.Result) bool) SyncCheckOpt {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I considered updating SyncStateHas(...) to include checking for state_after but perhaps someone explicitly wants to check state vs state_after for some specific tests.

@MadLittleMods MadLittleMods marked this pull request as ready for review May 13, 2026 17:19
@MadLittleMods MadLittleMods requested review from a team as code owners May 13, 2026 17:19
Copy link
Copy Markdown
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Much clearer indeed. Nice cleanup, thank you!

@MadLittleMods MadLittleMods merged commit c86bf66 into main May 15, 2026
4 checks passed
@MadLittleMods MadLittleMods deleted the madlittlemods/SyncStateAfterHas branch May 15, 2026 17:04
@MadLittleMods
Copy link
Copy Markdown
Collaborator Author

Thanks for the review @anoadragon453 🦘

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