Skip to content

Fix Registry debug log leakage into root logger output#381

Merged
vik-rant merged 1 commit intodevfrom
fix/issue-380-registry-propagate
Feb 27, 2026
Merged

Fix Registry debug log leakage into root logger output#381
vik-rant merged 1 commit intodevfrom
fix/issue-380-registry-propagate

Conversation

@AgentDosaku
Copy link
Collaborator

Summary

Fix noisy Registry debug output leaking to console when root/global logging is configured by ZenML.

This change makes Registry a better library citizen by default:

  • Sets propagate=False by default in Registry.__init__ (while preserving opt-in override via kwargs)
  • Adds a regression test that reproduces root-handler leakage and asserts Registry backend debug logs do not propagate to root

Root Cause

Registry emits debug logs in backend code (expected), but those records propagated to root logger handlers installed by ZenML at import time, causing unexpected CLI/debug spam.

Changes

  • mindtrace/registry/mindtrace/registry/core/registry.py
    • kwargs.setdefault("propagate", False) before super().__init__(**kwargs)
  • tests/unit/mindtrace/registry/core/test_registry_logging.py
    • New test: test_registry_debug_logs_do_not_propagate_to_root_logger
  • tests/unit/mindtrace/registry/core/test_registry.py
    • Updated one caplog-based warning test to explicitly opt-in to propagation for that capture scenario

Validation

  • Added regression test fails before fix and passes after
  • Full unit suite passes:
    • ds test --unit
    • Result: 4174 passed, 68 skipped

Fixes #380

@AgentDosaku
Copy link
Collaborator Author

Added repro samples here for clarity.

Sample 1 — default local Registry save/load

from mindtrace.registry import Registry

registry = Registry()
registry.save("a:shareditem", 1)
print(registry.load("a:shareditem"))

Before this PR (in environments where ZenML/root logging is initialized):
console could include backend debug lines like:

  • Loading metadata from: ...
  • Loaded metadata: ...
  • Downloading directory from ...
  • Download complete. Contents: ...

With this PR:
no backend debug leakage to root console by default.


Sample 2 — explicit root DEBUG handler (minimal leakage repro)

import io
import logging
from tempfile import TemporaryDirectory
from mindtrace.registry import Registry

stream = io.StringIO()
handler = logging.StreamHandler(stream)
handler.setLevel(logging.DEBUG)

root = logging.getLogger()
root.addHandler(handler)
root.setLevel(logging.DEBUG)

with TemporaryDirectory() as d:
    r = Registry(backend=d, version_objects=True)
    r.save("a:shareditem", 1)
    _ = r.load("a:shareditem")

print(stream.getvalue())

Before this PR: captured output contained Registry backend debug statements.

With this PR: captured output does not contain those Registry backend debug statements (unless user explicitly opts in with propagate=True).


Reference regression test added in this PR:

  • tests/unit/mindtrace/registry/core/test_registry_logging.py::test_registry_debug_logs_do_not_propagate_to_root_logger

@vik-rant vik-rant merged commit 22886f4 into dev Feb 27, 2026
3 checks passed
@vik-rant vik-rant deleted the fix/issue-380-registry-propagate branch February 27, 2026 13:38
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.

Registry debug logs leak to console via ZenML root logger initialization

2 participants