Skip to content

Don't require end on /messages#1265

Merged
S7evinK merged 4 commits intodevelopfrom
s7evink/spec-messages
Jun 30, 2022
Merged

Don't require end on /messages#1265
S7evinK merged 4 commits intodevelopfrom
s7evink/spec-messages

Conversation

@S7evinK
Copy link
Copy Markdown
Contributor

@S7evinK S7evinK commented Jun 28, 2022

As per the spec, the end key is not required if there are no more events for the user.

If no further events are available (either because we have reached the start of the timeline, or because the user does not have permission to see any more events), this property is omitted from the response.

@S7evinK S7evinK requested a review from a team as a code owner June 28, 2022 10:40
@DMRobertson
Copy link
Copy Markdown
Contributor

I think the spec's wording is actually stricter here: I think it's saying that end must be omitted if there are no more messages to retrieve.

Should we be asserting that end is not present in the json body?

@S7evinK
Copy link
Copy Markdown
Contributor Author

S7evinK commented Jun 28, 2022

Makes sense, yea.
Just tested that locally, Synapse isn't yet happy with that, though.

@richvdh
Copy link
Copy Markdown
Member

richvdh commented Jun 28, 2022

I thought that recently got fixed in synapse.

@DMRobertson
Copy link
Copy Markdown
Contributor

I thought that recently got fixed in synapse.

matrix-org/synapse#12903

@S7evinK
Copy link
Copy Markdown
Contributor Author

S7evinK commented Jun 28, 2022

Hm, what happens if the returned chunk count is less than the requested limit? Shouldn't that also result in end being omitted?
Or would that be this?

If so, we probably can't assert that end is actually missing in these tests, without extending the tests.

Copy link
Copy Markdown
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm otherwise

scalar @{ $body->{chunk} } > 0 or
die "Expected some messages but got none at all\n";
})->then( sub {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +174 to +175

# With no params this does "forwards from END"; i.e. nothing useful
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this needs repeating here

Suggested change
# With no params this does "forwards from END"; i.e. nothing useful

die "Expected some messages but got none at all\n";
})->then( sub {

# Do another call to /messages, this time we don't expect to receive a "end" key
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# Do another call to /messages, this time we don't expect to receive a "end" key
# Do another call to /messages. This time we don't expect to receive a "end" key

})->then( sub {
my ( $body ) = @_;

# We should still get events and a "end" key, check it is actually there
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# We should still get events and a "end" key, check it is actually there
# We should still get events and a "end" key: check they are actually there

log_if_fail "Body", $body;


# We should still get events and a "end" key, check it is actually there
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# We should still get events and a "end" key, check it is actually there
# We should still get events and a "end" key: check they are actually there

die "Expected some messages but got none at all\n";

})->then( sub {
# Do another call to /messages, this time we don't expect to receive a "end" key
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# Do another call to /messages, this time we don't expect to receive a "end" key
# Do another call to /messages. This time we don't expect to receive a "end" key

Comment on lines +241 to +242

# With no params this does "forwards from END"; i.e. nothing useful
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# With no params this does "forwards from END"; i.e. nothing useful

@S7evinK S7evinK merged commit a94cd1d into develop Jun 30, 2022
@S7evinK S7evinK deleted the s7evink/spec-messages branch June 30, 2022 10:15
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.

3 participants