Skip to content

fix(config): ipinfo_* deprecation no longer warns on a None value (v3.2.1)#32

Closed
rennf93 wants to merge 2 commits into
masterfrom
fix/ipinfo-deprecation-skip-none
Closed

fix(config): ipinfo_* deprecation no longer warns on a None value (v3.2.1)#32
rennf93 wants to merge 2 commits into
masterfrom
fix/ipinfo-deprecation-skip-none

Conversation

@rennf93

@rennf93 rennf93 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Warning

PARKED — do not merge. Hold this until someone actually complains about the spurious warning. Ready to go when needed.

Summary

The ipinfo_token / ipinfo_db_path DeprecationWarning introduced in 3.2.0 keyed only on model_fields_set (was the field passed to the constructor), so a caller forwarding an optional setting — SecurityConfig(ipinfo_token=settings.ipinfo_token) where the setting may be None — got a spurious deprecation warning even when ipinfo was not in use.

Surfaced by guard-core-app's SaaS backend (security.py:43 passes ipinfo_token=app_config.ipinfo_token unconditionally) — it warns at startup even when ipinfo is unconfigured.

Fix

warn_deprecated_fields now skips fields whose value is None, so the warning fires only when the deprecated field is actually in use:

for name in sorted({"ipinfo_token", "ipinfo_db_path"} & self.model_fields_set):
    if getattr(self, name) is None:
        continue
    warnings.warn(...)

Bumps 3.2.0 → 3.2.1 (pyproject, .mike.yml, versions.json; CHANGELOG + release-notes entry).

Verification

  • New test: SecurityConfig(ipinfo_token=None, ipinfo_db_path=None) emits no deprecation (covers the new continue branch); existing real-value tests still assert it warns.
  • check-sync OK · ruff + ruff-format + mypy + vulture + xenon + deptry: clean · bandit: exit 0
  • Full suite: 3714 passed, 100% line + branch coverage (0 missed), zero warnings

….2.1)

The ipinfo_token / ipinfo_db_path DeprecationWarning added in 3.2.0 keyed
only on whether the field was passed to the constructor, so a caller that
forwards an optional setting — SecurityConfig(ipinfo_token=settings.token)
where the setting may be None — got a spurious warning even when ipinfo
was not in use. The warning now fires only when the value is non-None.

Bumps 3.2.0 -> 3.2.1.
@github-actions github-actions Bot added documentation Docs, README, CHANGELOG, governance files area: models Touches guard_core/models.py tests Test suite changes dependencies pyproject.toml or uv.lock labels Jun 23, 2026
@rennf93 rennf93 self-assigned this Jun 25, 2026
@rennf93 rennf93 closed this Jul 1, 2026
@rennf93
rennf93 deleted the fix/ipinfo-deprecation-skip-none branch July 15, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: models Touches guard_core/models.py dependencies pyproject.toml or uv.lock documentation Docs, README, CHANGELOG, governance files tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant