Skip to content

Boyscout: Accept 'None' in __safe_log#1968

Open
oliv3r wants to merge 1 commit intoretrospect-addon:masterfrom
oliv3r:safe_log
Open

Boyscout: Accept 'None' in __safe_log#1968
oliv3r wants to merge 1 commit intoretrospect-addon:masterfrom
oliv3r:safe_log

Conversation

@oliv3r
Copy link
Copy Markdown
Contributor

@oliv3r oliv3r commented May 3, 2026

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

Functional description

Reasoning

Technical description

Tasks & Activities

  • Activity 1
  • Activity 2

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>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 3, 2026

@basrieter
Copy link
Copy Markdown
Collaborator

Could you rebase this on master. I fixed the unit tests for SVT Play.

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