Skip to content

Conversation

@dbnk0
Copy link
Collaborator

@dbnk0 dbnk0 commented Jan 13, 2026

Adds register_correlation_hook_with_master_record hook - identical to existing register_correlation_hook, but with an additional master record parameter sent to the callback. Some modules need access to the master record and since it's already loaded during correlation process (snapshot creation), providing it doesn't incur any additional overhead. One such example is the new TS last activity module in the NERD2 system.

For backwards compatibility, the new hook type was created instead of modifying the register_correlation_hook. Internally, they both share the same implementation.

Copy link
Contributor

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 adds a new hook registration method register_correlation_hook_with_master_record that allows correlation hooks to access the master record during snapshot creation. The change maintains backward compatibility by keeping the existing register_correlation_hook method and wrapping it internally to ignore the master record parameter.

Changes:

  • Added register_correlation_hook_with_master_record method in CallbackRegistrar for hooks needing access to master records
  • Modified internal snapshot hook infrastructure to pass master records to all correlation hooks
  • Updated test fixtures to accommodate the new hook signature with an additional master record parameter

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
dp3/common/callback_registrar.py Added new register_correlation_hook_with_master_record method and modified existing register_correlation_hook to wrap hooks with lambda that ignores master record
dp3/snapshots/snapshot_hooks.py Updated SnapshotCorrelationHookContainer.register() and run() methods to accept and pass master records to hooks, added optional hook_name parameter
dp3/snapshots/snapshooter.py Modified register_correlation_hook() to accept master records and optional hook name, updated make_snapshot() and make_linkless_snapshot() to collect and pass master records
tests/test_common/test_snapshots.py Updated test hook signatures and test calls to include master record parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Adds `register_correlation_hook_with_master_record` hook - identical
to existing `register_correlation_hook`, but with an additional
master record parameter sent to the callback. Some modules need
access to the master record and since it's already loaded during
correlation process (snapshot creation), providing it doesn't incur
any additional overhead. One such example is the new TS last activity
module in the NERD2 system.

For backwards compatibility, the new hook type was created instead of
modifying the `register_correlation_hook`. Internally, they both
share the same implementation.
@dbnk0 dbnk0 force-pushed the correlation_hook_with_master_record branch from 33bb0d3 to 55bebab Compare January 13, 2026 16:59
Copy link
Contributor

Copilot AI commented Jan 13, 2026

@dbnk0 I've opened a new pull request, #33, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits January 13, 2026 18:33
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Dávid Benko <[email protected]>
Test added by Copilot wasn't working. The issue was a conflict between
the new and existing correlation hooks. Solved by adding new separate
attributes.
Adds information about `register_correlation_hook_with_master_record`
hook to the Modules section.
Copy link
Contributor

Copilot AI commented Jan 14, 2026

@xsedla1o I've opened a new pull request, #34, to work on those changes. Once the pull request is ready, I'll request review from you.

@xsedla1o xsedla1o force-pushed the correlation_hook_with_master_record branch from 9cf3431 to 738790b Compare January 14, 2026 10:08
Copy link
Collaborator

@xsedla1o xsedla1o left a comment

Choose a reason for hiding this comment

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

Good changes, just a tiny suggestion to improve.

Replaces `lambda` with `functools.wraps` in `CallbackRegistrar`, making
`hook_name` argument in `SnapshotCorrelationHookContainer.register`
redundant.
Copy link
Collaborator

@xsedla1o xsedla1o left a comment

Choose a reason for hiding this comment

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

LGTM

@dbnk0 dbnk0 merged commit 7cb1ca0 into master Jan 14, 2026
4 checks passed
@dbnk0 dbnk0 deleted the correlation_hook_with_master_record branch January 14, 2026 12:14
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.

3 participants