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

Update the soft-fail tests to work with recent room versions #1149

Merged
merged 6 commits into from
Oct 6, 2021

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Oct 6, 2021

We have some tests in tests/50federation/52soft-fail.pl which test soft-failing, but which have never been updated to work with room versions other than v1.

For the most part, this is just a matter of updating them to use utility functions instead of making assumptions about the shapes of the events, but it turns out that there is another wrinkle, which is that they were making some assumptions about the state-resolution algorithm which are not true in subsequent room versions. More info in the commit comments.

Reviewable commit-by-commit.

Rather than manually building the (event_id, event_hash) prev_event structures,
use `$room->make_event_refs` to do this, which means it will also work on later
room verions.

This means we need access to the events themselves rather than just the IDs, so
needs a bit of tweaking for that.
When we create an event with prev_events which put that event on a historical
branch, we also need to use the auth_events corresponding to that point on the
DAG. Otherwise, the server can end up pulling in the state from the main branch
anyway, and rejecting, rather than soft-failing, the relevant events.

(Exactly whether the state gets pulled in from the auth_events depends on the
state resolution algorithm in use, hence on the room version).
Copy link
Member

@clokep clokep left a comment

Choose a reason for hiding this comment

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

Pretty sure all this makes sense!

Is this the sort of test that would benefit from running over multiple room versions?

@richvdh
Copy link
Member Author

richvdh commented Oct 6, 2021

Is this the sort of test that would benefit from running over multiple room versions?

No more so than much of the rest of Sytest, I'd say. We have the --room-version argument for Sytest to try to solve that problem, but don't make a lot of use of it.

@richvdh richvdh merged commit 32129d9 into develop Oct 6, 2021
@richvdh richvdh deleted the rav/soft_fail_room_version branch October 6, 2021 20:10
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