Skip to content

refactor(exports): single-source __all__ from guard_core (O3)#93

Open
rennf93 wants to merge 1 commit into
feat/agent-init-clarityfrom
refactor/export-ssot
Open

refactor(exports): single-source __all__ from guard_core (O3)#93
rennf93 wants to merge 1 commit into
feat/agent-init-clarityfrom
refactor/export-ssot

Conversation

@rennf93

@rennf93 rennf93 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Design-partner feedback O3 (fastapi-guard half). The guard-core side ships the API-surface audit + ipinfo_* deprecation (guard-core PR for O3). This is the consumer-side wiring.

Note

Stacked on #92 (the guard-core 3.2.0 adoption). Review/merge #92 first; GitHub will retarget this to master. The diff here is only the export + filter change.

Export single source of truth

guard.__all__ previously hand-duplicated the 22 names re-exported from guard_core, so the two lists could silently drift. Now __all__ is derived from guard_core.__all__ plus fastapi-guard's two locals (SecurityMiddleware, __version__):

__all__ = ["__version__", "SecurityMiddleware", *guard_core.__all__]
  • Re-exports use the explicit X as X typed-re-export form (no # noqa, no F401); combine-as-imports keeps the block tidy.
  • A test asserts __all__ equals guard_core's surface plus the locals; the existing test_all_exports_importable already asserts every name is importable — together they make a missing downstream re-export a loud test failure, not silent drift.

Deprecation filter

guard-core 3.2.0 adds a runtime DeprecationWarning when the deprecated ipinfo_token / ipinfo_db_path are set. fastapi-guard's fixtures set ipinfo_db_path, so the suite filters that specific warning (the deprecation itself is documented and tested on the guard-core side).

Verification

  • ruff + ruff-format + mypy + vulture + xenon + deptry + bandit: clean
  • Full suite: 243 passed, 100% line + branch coverage (0 missed), zero warnings

Part of the coordinated guard-core 3.2.0 release.

…ter (O3)

Derive guard.__all__ from guard_core.__all__ plus the two fastapi-guard
locals (SecurityMiddleware, __version__) instead of hand-duplicating the
22 re-exported names, so the lists can't silently drift. Re-exports use the
explicit `X as X` form (typed re-export, no F401); combine-as-imports keeps
the block tidy. A test asserts __all__ equals guard_core's surface plus the
locals; the existing test already asserts every name is importable.

Also filter guard-core 3.2.0's new ipinfo_* DeprecationWarning in the test
suite (fixtures set ipinfo_db_path); the guard-core side documents the
deprecation path.
@github-actions github-actions Bot added dependencies pyproject.toml or uv.lock area: integrations Touches public re-exports or framework wiring (guard/__init__.py) tests Test suite changes labels Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: integrations Touches public re-exports or framework wiring (guard/__init__.py) dependencies pyproject.toml or uv.lock tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant