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

Improve callback API #6

Closed
rkolesnev-vineti opened this issue Apr 22, 2020 · 2 comments · Fixed by #8
Closed

Improve callback API #6

rkolesnev-vineti opened this issue Apr 22, 2020 · 2 comments · Fixed by #8
Labels
enhancement New feature or request

Comments

@rkolesnev-vineti
Copy link
Contributor

rkolesnev-vineti commented Apr 22, 2020

The work to be done:

  • split SCP context into explicit :data and :meta parts.
  • vanilla SCP must left meta in context and results empty
    • with exception for :last_step meta-field for (at least) failure results of SCP
  • signatures for callbacks must be:
    • before_all(klass, data, meta) -> void
    • after_all(klass, result, data, meta) -> new_result
    • before_each(klass, step_name, data, meta) -> void
    • after_each(klass, step_name, result, data, meta) -> new_result
  • data and meta are mutable hashes
  • after_each is executed before result data merged to the pipeline context
@ffloyd
Copy link
Owner

ffloyd commented Apr 22, 2020

After some thoughts, I've decided to not make after_each be able to substitute the step's result:

  • it has bad compatibility with mutation steps
  • it's a bad idea to change result returned by a business code - it can lead to implicit unexpected behaviour

@ffloyd
Copy link
Owner

ffloyd commented Apr 22, 2020

So, new spec for after_each:

  • after_each(klass, step_name, result, data, meta) -> void
  • after_each is executed after result data merged to the pipeline context

ffloyd added a commit that referenced this issue Apr 22, 2020
ffloyd added a commit that referenced this issue Apr 22, 2020
@ffloyd ffloyd closed this as completed in #8 Apr 22, 2020
ffloyd added a commit that referenced this issue Apr 22, 2020
* docs(readme): add section about GitHub flow

* docs(readme): update CI badge

* feat!: change SCP before_all callback #6

* feat!: change SCP after_all callback #6

* feat!: change SCP before_each callback #6

* feat!: change SCP after_each callback #6

* docs: update CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants