Capture and surface registration call-site labels for Implementations (debug mode)#8
Merged
Code0x58 merged 2 commits intoMay 9, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Implementationwas registered so errors andrepr(...)output can disambiguate which implementation instance is involved.README.mdto make the debug information discoverable.Description
label: str | Nonefield toImplementationand populate it frommaybe_get_caller_path()when implementations are created or duplicated viaAlternatives.add.__post_init__fallback to capture the caller path if the label was not supplied, and updateImplementation.__repr__to include the label when present.Alternativesconstructor andaddpath pass caller-derived labels into newImplementationobjects and include the label in some debug messages.README.mdto mention thatImplementationcaptures a registration call-site label in debug mode, and add two tests totest_alternative.pythat verify label population and the safe fallback when caller info is unavailable.Testing
test_implementation_label_populated_in_debugwhich verifies labels include caller metadata whenDEBUGis enabled, and it succeeded.test_implementation_label_safe_when_caller_unavailablewhich verifies the fallback label is used when caller info cannot be resolved, and it succeeded.Codex Task