From 104009ca27ae3d0c740b2e53faaa6b06691beb10 Mon Sep 17 00:00:00 2001 From: Yaniv Michael Kaul Date: Mon, 29 Jun 2026 23:32:46 +0300 Subject: [PATCH] fix: add missing scope validation in Session.wait_for_schema_agreement The docstring and test promised ValueError for invalid scope values (e.g. 'planet'), but the validation was never implemented in the method body. Add an explicit check against the three SchemaAgreementScope members. Introduced in commit 0d215f45b (cluster: add Session.wait_for_schema_agreement). --- cassandra/cluster.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cassandra/cluster.py b/cassandra/cluster.py index 1181c6f686..db9eedf212 100644 --- a/cassandra/cluster.py +++ b/cassandra/cluster.py @@ -3482,6 +3482,11 @@ def wait_for_schema_agreement(self, wait_time: Optional[float] = None, if wait_time is not None and wait_time <= 0: raise ValueError("wait_time must be greater than 0") + if scope not in (SchemaAgreementScope.RACK, SchemaAgreementScope.DC, SchemaAgreementScope.CLUSTER): + raise ValueError( + "scope must be SchemaAgreementScope.RACK, .DC, or .CLUSTER" + ) + total_timeout = wait_time if wait_time is not None else self.cluster.max_schema_agreement_wait if total_timeout <= 0: raise ValueError("total_timeout must be greater than 0")