fix: make provisioning checks opt-in (default false)

Changes @require_provisioning decorator to check REQUIRE_PROVISIONING
environment variable (defaults to false) instead of
ENABLE_PROGRESSIVE_CONSENT (defaults to true).

This makes provisioning checks opt-in rather than required by default:
- BasicAuth mode: Always skips (no change)
- OAuth mode: Skips by default, requires REQUIRE_PROVISIONING=true to enforce
- Progressive Consent Flow 2: Enable via REQUIRE_PROVISIONING=true

Fixes OAuth smoke test failures where tools were checking for provisioning
even though Flow 2 hadn't been completed.

Testing:
- All 5 smoke tests passing (including OAuth)
- All 36 unit tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2025-11-03 19:50:57 +01:00
parent 71e77e95bc
commit 6a0f537d66
@@ -63,7 +63,20 @@ def require_provisioning(func: Callable) -> Callable:
logger.debug("BasicAuth mode detected - skipping provisioning check")
return await func(*args, **kwargs)
# OAuth mode - check provisioning
# Check if provisioning is required (opt-in, defaults to false)
# Provisioning is only needed when using Progressive Consent with Flow 2
import os
require_provisioning = (
os.getenv("REQUIRE_PROVISIONING", "false").lower() == "true"
)
if not require_provisioning:
logger.debug(
"Provisioning not required (REQUIRE_PROVISIONING=false) - skipping check"
)
return await func(*args, **kwargs)
# OAuth mode with provisioning required - check provisioning status
# Get user_id from authorization token
user_id = None
if hasattr(ctx, "authorization") and ctx.authorization: