Skip to content

Conversation

@oriolgual
Copy link
Contributor

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.

Copy link

Copilot AI left a 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::Hookable and integrates it into BackfillRun and BackfillRunBatch to run before/around/after hooks around status transitions/actions.
  • Renames hook method conventions from on_* to after_*, and adds before_* / 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.

oriolgual and others added 3 commits February 6, 2026 12:34
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant