7.2.0
- Added — Clear, actionable agent-setup errors + opt-in strict mode. When
enable_agent=Truebut theguard-agentpackage is missing, the middleware now surfacespip install fastapi-guard[agent]instead of the misleading "invalid config / checkagent_api_key" path — it catchesAgentPackageNotInstalledErrorfrom guard-core 3.2.0. Agent-init failures degrade gracefully by default (they log, setagent_degraded— exposed viaagent_stats— and fire theon_error(stage="agent_init")hook), while the newSecurityConfig.agent_strict=Truere-raises for fail-fast deployments. - Added —
fastapi-guard[agent]optional-dependency extra that installsguard-agent, so the agent is opt-in rather than a hidden requirement. - Changed —
guard.__all__is now single-sourced fromguard_core.__all__plus fastapi-guard's two locals (SecurityMiddleware,__version__) instead of being hand-duplicated, so the two export lists can no longer silently drift; a test enforces it. - Docs — New "Passive to Active" migration guide: a reversible observe → preview → verify → enforce → rollback path for turning enforcement on, including a read-only "would-block preview" to size the blast radius before flipping
passive_mode. - Docs — Behavioral decorators now document the required wiring step. The behavioral tutorial and the
simple_appexample includeapp.state.guard_decorator = guard_deco— the step that makes decorator rules actually fire — plus how to verify violations (decorator_violationevent) and trial safely withpassive_mode. - Compatibility — Requires guard-core 3.2.0 or newer (the agent-setup clarity relies on
AgentPackageNotInstalledError, introduced there). The test suite filters guard-core's newipinfo_*DeprecationWarning.
What's Changed
- Bump actions/checkout from 6 to 7 by @dependabot[bot] in #90
- docs: correct API & config reference to match source by @rennf93 in #91
- feat(agent): clear missing-package error, opt-in strict, on_error hook (O1/O2) by @rennf93 in #92
- refactor(exports): single-source all from guard_core (O3) by @rennf93 in #96
- docs(security): add Passive to Active migration guide (O7) by @rennf93 in #94
- docs(behavioral): document the required decorator wiring step (O8) by @rennf93 in #95
- ci(docs): serialize docs deploys to prevent gh-pages races by @rennf93 in #97
- release: v7.2.0 — agent-setup clarity, single-source exports, adoption docs by @rennf93 in #98
Full Changelog: 7.1.1...7.2.0