Skip to content

Capture and surface registration call-site labels for Implementations (debug mode)#8

Merged
Code0x58 merged 2 commits into
masterfrom
codex/extend-implementation-dataclass-with-label
May 9, 2026
Merged

Capture and surface registration call-site labels for Implementations (debug mode)#8
Code0x58 merged 2 commits into
masterfrom
codex/extend-implementation-dataclass-with-label

Conversation

@Code0x58
Copy link
Copy Markdown
Owner

@Code0x58 Code0x58 commented May 9, 2026

Motivation

  • Improve diagnostics when debug mode is enabled by recording where each Implementation was registered so errors and repr(...) output can disambiguate which implementation instance is involved.
  • Document the new label behavior in the README.md to make the debug information discoverable.

Description

  • Add a label: str | None field to Implementation and populate it from maybe_get_caller_path() when implementations are created or duplicated via Alternatives.add.
  • Provide a __post_init__ fallback to capture the caller path if the label was not supplied, and update Implementation.__repr__ to include the label when present.
  • Ensure the Alternatives constructor and add path pass caller-derived labels into new Implementation objects and include the label in some debug messages.
  • Update README.md to mention that Implementation captures a registration call-site label in debug mode, and add two tests to test_alternative.py that verify label population and the safe fallback when caller info is unavailable.

Testing

  • Added and ran test_implementation_label_populated_in_debug which verifies labels include caller metadata when DEBUG is enabled, and it succeeded.
  • Added and ran test_implementation_label_safe_when_caller_unavailable which verifies the fallback label is used when caller info cannot be resolved, and it succeeded.
  • Ran the full pytest suite and the tests completed successfully.

Codex Task

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (868175b) to head (c1092eb).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##            master        #8   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          189       199   +10     
=========================================
+ Hits           189       199   +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Code0x58 Code0x58 merged commit 379a5d2 into master May 9, 2026
5 checks passed
@Code0x58 Code0x58 deleted the codex/extend-implementation-dataclass-with-label branch May 9, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant