Implement Club Feature Enforcement Logic and Update Versioning
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Failing after 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m15s

- Introduced a new environment variable `CLUB_FEATURE_ENFORCE` to control club feature access, allowing values of 1, true, or yes for activation.
- Updated the backend logic to check for club feature enforcement, raising HTTP exceptions when access is denied without an active club context.
- Enhanced the admin rights router with a new endpoint to check the enforcement status of club features.
- Incremented application version to 0.8.202 to reflect these changes.
This commit is contained in:
Lars committed 2026-06-07 15:47:49 +02:00
1 parent 4130a63dfe
commit a9a6153ed5
12 files changed
+81 -7

No files matched your search

+16
View File
@@ -204,6 +204,22 @@ def test_consume_with_usage_returns_snapshot(monkeypatch):
assert usage["ai_calls"]["used"] == 4
def test_probe_blocks_no_club_context_when_enforce(monkeypatch):
monkeypatch.setenv("CLUB_FEATURE_ENFORCE", "1")
monkeypatch.setattr("club_feature_logger.log_club_feature_usage", lambda **kwargs: None)
with pytest.raises(HTTPException) as exc:
probe_club_feature_access(
feature_id="ai_calls",
action="suggest",
club_id=None,
profile_id=3,
endpoint="POST /exercises/ai/suggest",
)
assert exc.value.status_code == 403
assert "Vereinskontext" in str(exc.value.detail)
def test_club_feature_enforcement_env_default_off(monkeypatch):
monkeypatch.delenv("CLUB_FEATURE_ENFORCE", raising=False)
assert club_feature_enforcement_enabled() is False