-
Notifications
You must be signed in to change notification settings - Fork 1
Add before and around hooks #7
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
base: main
Are you sure you want to change the base?
Conversation
b332c96 to
1d7bc59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR expands DataDrip’s lifecycle hook system to support before_* and around_* hooks for status transitions (in addition to renaming the existing hooks to after_* to clarify timing), and refactors run/batch models to centralize hook execution via a new Hookable concern.
Changes:
- Introduces
DataDrip::Hookableand integrates it intoBackfillRunandBackfillRunBatchto runbefore/around/afterhooks around status transitions/actions. - Renames hook method conventions from
on_*toafter_*, and addsbefore_*/around_*variants in docs and test fixtures. - Updates specs and documentation to reflect new hook timing and ordering expectations.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/test_app/app/services/hook_handler.rb | Updates test hook handler to implement before/around/after hook methods and record execution sequence. |
| spec/test_app/app/backfills/add_role_to_employee.rb | Updates test backfill to implement before/around/after hooks and record execution sequence. |
| spec/lib/data_drip/hook_handler_spec.rb | Updates expectations to after_* naming and adds ordering tests for before/around/after hooks. |
| spec/backfills/add_role_to_employee_spec.rb | Updates hook naming and asserts before/around/after ordering in sequences. |
| app/models/data_drip/backfill_run_batch.rb | Includes Hookable, wraps enum bang methods + enqueue/run! actions with hook execution, and refactors hook targeting. |
| app/models/data_drip/backfill_run.rb | Includes Hookable, wraps enum bang methods + enqueue action with hook execution, adds with_run_hooks, refactors hook targeting. |
| app/models/concerns/data_drip/hookable.rb | New concern implementing shared hook execution for status changes and action wrappers. |
| app/jobs/data_drip/dripper.rb | Wraps “running” execution in with_run_hooks(:running) so hooks can wrap the job action. |
| README.md | Updates hook documentation and examples to the new before/around/after naming and semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Improves the hook system by adding before and around hooks for all status changes and update the naming so it's clear the existing ones run after the status change.