Boyscout: Accept 'None' in __safe_log#1968
Open
oliv3r wants to merge 1 commit intoretrospect-addon:masterfrom
Open
Boyscout: Accept 'None' in __safe_log#1968oliv3r wants to merge 1 commit intoretrospect-addon:masterfrom
oliv3r wants to merge 1 commit intoretrospect-addon:masterfrom
Conversation
The masking helper was typed strictly as str -> str, but log call sites in upcoming refactors will pass Optional[str] (e.g. usernames retrieved from session checks before the not-None guard). Widen the signature to Optional[str] -> Optional[str] and collapse any falsy input to None, so callers can drop their `if x else None` fallbacks at the call site. Empty strings collapse to None as well: the helper produces a redacted display string for logs, and an empty string isn't a redacted display of anything -- it's an absence. One sentinel beats two. Add tests pinning the masking format and the None / empty-string collapse behavior. The helper had no test coverage before. Assisted-by: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
|
Collaborator
|
Could you rebase this on |
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.



The masking helper was typed strictly as str -> str, but log call sites in upcoming refactors will pass Optional[str] (e.g. usernames retrieved from session checks before the not-None guard). Widen the signature to Optional[str] -> Optional[str] and collapse any falsy input to None, so callers can drop their
if x else Nonefallbacks at the call site.Empty strings collapse to None as well: the helper produces a redacted display string for logs, and an empty string isn't a redacted display of anything -- it's an absence. One sentinel beats two.
Add tests pinning the masking format and the None / empty-string collapse behavior. The helper had no test coverage before.
Assisted-by: Claude Opus 4.7 noreply@anthropic.com
Functional description
Reasoning
Technical description
Tasks & Activities