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

🐛 [#4579] Ensure triggerFromStep uses the correct current_step #4967

Merged
merged 2 commits into from
Dec 27, 2024

Conversation

stevenbal
Copy link
Contributor

@stevenbal stevenbal commented Dec 23, 2024

previously the current step was inferred by looking at the last completed step and considering the step after that the current step. This does not work however if you complete a step and go back to the previous step, so instead we explicitly pass the current form step via the serializer context

Closes #4579

Changes

  • Ensure triggerFromStep uses the correct current_step

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

@stevenbal stevenbal marked this pull request as draft December 23, 2024 14:03
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.62%. Comparing base (b0b5055) to head (e7c4ef3).
Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4967   +/-   ##
=======================================
  Coverage   96.62%   96.62%           
=======================================
  Files         760      760           
  Lines       25838    25838           
  Branches     3386     3386           
=======================================
  Hits        24965    24965           
  Misses        608      608           
  Partials      265      265           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stevenbal stevenbal force-pushed the issue/4579-block-going-to-next-step-bug branch from 5bbd7ea to b837307 Compare December 24, 2024 08:29
@stevenbal stevenbal added the needs-backport Fix must be backported to stable release branch label Dec 24, 2024
previously the current step was inferred by looking at the last completed step and considering the step after that the current step. This does not work however if you complete a step and go back to the previous step, so instead we explicitly pass the current form step via the serializer context
@stevenbal stevenbal force-pushed the issue/4579-block-going-to-next-step-bug branch from 51886a3 to e7c4ef3 Compare December 24, 2024 08:47
@stevenbal stevenbal marked this pull request as ready for review December 24, 2024 08:51
@@ -198,7 +200,7 @@ def check_submission_logic(
if not submission_state.form_steps:
return

rules = get_rules_to_evaluate(submission)
rules = get_rules_to_evaluate(submission, current_step)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was surprised (and suspicious) about this fix, is there a reason why previously the current_step was inferred for this flow, instead of explicitly passed to get_rules_to_evaluate?

Copy link
Member

Choose a reason for hiding this comment

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

this function exists because the logic for the submission as a whole still needs to be evaluated during registration/processing after it's completed. In those contexts, there isn't a submission step, and it's also not relevant for the "trigger_from_step", because the assumption is that this only gets called for completed submissions that have gone through all the steps anyway.

Clearly this was a wrong assumption - as this does get called in the logic check serialization too which is in the context of a particular step. Nice find!

@sergei-maertens sergei-maertens merged commit 52d6c33 into master Dec 27, 2024
33 of 36 checks passed
@sergei-maertens sergei-maertens deleted the issue/4579-block-going-to-next-step-bug branch December 27, 2024 09:43
sergei-maertens pushed a commit that referenced this pull request Dec 27, 2024
previously the current step was inferred by looking at the last completed step and considering the step after that the current step. This does not work however if you complete a step and go back to the previous step, so instead we explicitly pass the current form step via the serializer context

Backport-of: #4967
sergei-maertens pushed a commit that referenced this pull request Dec 27, 2024
previously the current step was inferred by looking at the last completed step and considering the step after that the current step. This does not work however if you complete a step and go back to the previous step, so instead we explicitly pass the current form step via the serializer context

Backport-of: #4967
@sergei-maertens
Copy link
Member

Backports:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport Fix must be backported to stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block going to next step, also affects previous step?
2 participants