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

Pass the World to after hook even if Step has failed (#207) #209

Merged
merged 6 commits into from
Mar 25, 2022

Conversation

ilslv
Copy link
Member

@ilslv ilslv commented Mar 11, 2022

Resolves #207

Synopsis

For now after hook accepts mutable reference to the World instance, but only in case Step didn't fail.

Solution

Accept shared reference to the World instance (it's ok because it's not passed on either way) and pass it even in case Step has failed.

Checklist

  • Created PR:
    • In draft mode
    • Name contains Draft: prefix
    • Name contains issue reference
    • Has assignee
  • Documentation is updated (if required)
  • Tests are updated (if required)
  • Changes conform code style
  • CHANGELOG entry is added (if required)
  • FCM (final commit message) is posted
    • and approved
  • Review is completed and changes are approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • Draft: prefix is removed
    • All temporary labels are removed

@ilslv ilslv added the enhancement Improvement of existing features or bugfix label Mar 11, 2022
@ilslv ilslv added this to the 0.13.0 milestone Mar 11, 2022
@ilslv ilslv self-assigned this Mar 11, 2022
@ilslv
Copy link
Member Author

ilslv commented Mar 11, 2022

FCM

Pass `World` to After Hook even if step has failed (#209, #207)

@ilslv ilslv requested a review from tyranron March 11, 2022 06:27
Copy link
Member

@tyranron tyranron left a comment

Choose a reason for hiding this comment

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

Discussed to preserve &mut World in After Hook.

@tyranron tyranron modified the milestones: 0.13.0, 0.12.1 Mar 15, 2022
@ilslv ilslv modified the milestones: 0.12.1, 0.13.0 Mar 25, 2022
@ilslv
Copy link
Member Author

ilslv commented Mar 25, 2022

I've left changes in 0.13 release inside CHANGELOG.md, because despite stability of the API, behaviour of Hook::After have changed and theoretically can break user code (for example assertions about number of passed/failed hooks), but I'm not sure about this decision. semver doesn't specify what to do in this case.

@ilslv ilslv requested a review from tyranron March 25, 2022 11:11
@tyranron
Copy link
Member

@ilslv I'd opt for going with patch release for that.

// `HookType::After` is executed, so it can slightly mess up
// timing if `timestamps` feature is enabled. Fix it by
// passing here `event::Metadata` at the time
// `HookType::After` was started.
Copy link
Member

Choose a reason for hiding this comment

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

@ilslv I don't see why we should postpone this. Please, fix in a separate PR.

@tyranron tyranron merged commit a920fb1 into main Mar 25, 2022
@tyranron tyranron deleted the pass-world-to-after-hook branch March 25, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After hook is odd to work with
2 participants