Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

The new register_correlation_hook_with_master_record method lacked test coverage demonstrating that hooks receive the master record parameter correctly.

Changes

  • New test hook (use_master_record in tests/modules/test_module.py): Copies a value from master record to snapshot with "from_master" suffix. Only activates when source attribute starts with "master" to avoid test interference.

  • Test registration: Registered hook via register_correlation_hook_with_master_record for entity type A.

  • Test data: Added entity A-423 with data1="master_test" and data2="placeholder".

  • Integration test (test_master_record_hook in tests/test_api/test_snapshots.py): Verifies snapshot contains data2="master_test_from_master", confirming the master record parameter was received and used.

Example

def use_master_record(
    _: str, record: dict, master_record: dict, target_attr: str, source_attr: str
):
    if source_attr in master_record:
        master_value = master_record[source_attr].get("v", None)
        if master_value is not None and str(master_value).startswith("master_"):
            record[target_attr] = f"{master_value}_from_master"

registrar.register_correlation_hook_with_master_record(
    update_wrapper(
        partial(use_master_record, target_attr="data2", source_attr="data1"),
        use_master_record,
    ),
    "A",
    depends_on=[],
    may_change=[["data2"]],
)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copilot AI changed the title [WIP] Address feedback on correlation hook implementation in CallbackRegistrar Add test coverage for register_correlation_hook_with_master_record Jan 13, 2026
Copilot AI requested a review from dbnk0 January 13, 2026 17:21
Copy link
Collaborator

@dbnk0 dbnk0 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 marked this pull request as ready for review January 13, 2026 17:32
@dbnk0 dbnk0 merged commit 8840e94 into correlation_hook_with_master_record Jan 13, 2026
@dbnk0 dbnk0 deleted the copilot/sub-pr-32 branch January 13, 2026 17:33
dbnk0 added a commit that referenced this pull request Jan 14, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Dávid Benko <[email protected]>
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.

2 participants