Allow routing to work with multiple conditions#2069
Merged
lfdebrux merged 2 commits intoApr 28, 2026
Conversation
Change `id` and the `next_step_id` for the step being tested so that they're different from the step IDs for steps we're routing to; this makes it harder to write tests that pass with a false positive (for instance, if you expect `second_step_id`, before that could have been because the routing was returning the default route, instead of routing to the second step).
Update the logic in Step#next_step_slug_after_routing so that it will match a routing condition even if it isn't the first condition. This should allow forms-runner to support forms with multiple branches. Note that this still won't match a "default" condition (answer_value of `nil`) that isn't the first in the list of routing conditions; our plans for routing don't currently have a use case for a default condition on a selection question, so there shouldn't be a situation where there are multiple conditions and one of them is a default condition.
Contributor
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2069.submit.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
thomasiles
approved these changes
Apr 28, 2026
Contributor
thomasiles
left a comment
There was a problem hiding this comment.
looks really nice and clear 🏅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Trello card: https://trello.com/c/Ndp9ZPrn/3062-update-forms-runner-to-work-with-more-than-one-routing-condition-per-question
Update the logic in Step#next_step_slug_after_routing so that it will match a routing condition even if it isn't the first condition. This should allow forms-runner to support forms with multiple branches.
Note that this still won't match a "default" condition (answer_value of
nil) that isn't the first in the list of routing conditions; our plans for routing don't currently have a use case for a default condition on a selection question, so there shouldn't be a situation where there are multiple conditions and one of them is a default condition.Things to consider when reviewing