You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/07/27 13:16:16 UTC

(tooling-trusted-releases) 01/01: Allow vote durations of up to 168 hours

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git

commit 1fc148ffd9ace8a2b254136d5066869ad06a0463
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Mon Jul 27 14:15:38 2026 +0100

    Allow vote durations of up to 168 hours
---
 atr/models/validation.py              | 4 ++--
 atr/shared/projects.py                | 4 ++--
 atr/shared/voting.py                  | 2 +-
 atr/util.py                           | 4 ++--
 tests/unit/test_policy_update_args.py | 4 ++--
 tests/unit/test_vote_duration_zero.py | 4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/atr/models/validation.py b/atr/models/validation.py
index 0edfa0da..5581aaf0 100644
--- a/atr/models/validation.py
+++ b/atr/models/validation.py
@@ -124,8 +124,8 @@ def validate_ignore_pattern(pattern: str) -> None:
 
 
 def validate_policy_min_hours(min_hours: int) -> None:
-    if (min_hours != 0) and ((min_hours < 72) or (min_hours > 144)):
-        raise ValueError("Minimum voting period must be 0 or between 72 and 144 hours inclusive.")
+    if (min_hours != 0) and ((min_hours < 72) or (min_hours > 168)):
+        raise ValueError("Minimum voting period must be 0 or between 72 and 168 hours inclusive.")
 
 
 def validate_security_contact(committee_key: str, security_contact: str | None) -> None:
diff --git a/atr/shared/projects.py b/atr/shared/projects.py
index 147c3ed3..7b079bd9 100644
--- a/atr/shared/projects.py
+++ b/atr/shared/projects.py
@@ -193,7 +193,7 @@ class VotePolicyForm(form.Form):
     )
     min_hours: form.Int = form.label(
         "Minimum voting period",
-        "The minimum time to run the vote, in hours. Must be between 72 and 144 inclusive.",
+        "The minimum time to run the vote, in hours. Must be between 72 and 168 inclusive.",
         default=72,
     )
     release_checklist: str = form.label(
@@ -243,7 +243,7 @@ class VotePolicyForm(form.Form):
     def validate_vote_fields(self) -> VotePolicyForm:
         validation.validate_policy_min_hours(self.min_hours)
         if (self.min_hours == 0) and config.is_production_mode():
-            raise ValueError("Minimum voting period must be between 72 and 144 hours inclusive.")
+            raise ValueError("Minimum voting period must be between 72 and 168 hours inclusive.")
         return self
 
 
diff --git a/atr/shared/voting.py b/atr/shared/voting.py
index ff8af251..a92a2e98 100644
--- a/atr/shared/voting.py
+++ b/atr/shared/voting.py
@@ -74,7 +74,7 @@ class StartVotingForm(form.Form):
     def validate_vote_duration(cls, field):
         util.validate_vote_duration(field)
         if (field == 0) and config.is_production_mode():
-            raise ValueError("Minimum vote duration must be between 72 and 144 hours inclusive.")
+            raise ValueError("Minimum vote duration must be between 72 and 168 hours inclusive.")
         return field
 
     @pydantic.model_validator(mode="after")
diff --git a/atr/util.py b/atr/util.py
index 2eb27879..03c8555a 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -1647,8 +1647,8 @@ def validate_vote_duration(duration: int):
     if duration == 0:
         return
     if duration > 0:
-        if (duration < 72) or (duration > 144):
-            raise ValueError("Vote duration must be 0 or between 72 and 144 hours inclusive.")
+        if (duration < 72) or (duration > 168):
+            raise ValueError("Vote duration must be 0 or between 72 and 168 hours inclusive.")
 
 
 # TODO: AM put these rules into safe.versionkey
diff --git a/tests/unit/test_policy_update_args.py b/tests/unit/test_policy_update_args.py
index 810ffcaf..67eeacbb 100644
--- a/tests/unit/test_policy_update_args.py
+++ b/tests/unit/test_policy_update_args.py
@@ -25,14 +25,14 @@ def _policy_update(**kwargs: object) -> api.PolicyUpdateArgs:
     return api.PolicyUpdateArgs.model_validate({"project": "tooling", **kwargs})
 
 
-@pytest.mark.parametrize("min_hours", [0, 72, 144])
+@pytest.mark.parametrize("min_hours", [0, 72, 168])
 def test_policy_update_args_accepts_valid_min_hours(min_hours: int) -> None:
     args = _policy_update(min_hours=min_hours)
 
     assert args.min_hours == min_hours
 
 
-@pytest.mark.parametrize("min_hours", [-1, 1, 71, 145])
+@pytest.mark.parametrize("min_hours", [-1, 1, 71, 169])
 def test_policy_update_args_rejects_invalid_min_hours(min_hours: int) -> None:
     with pytest.raises(pydantic.ValidationError, match="Minimum voting period"):
         _policy_update(min_hours=min_hours)
diff --git a/tests/unit/test_vote_duration_zero.py b/tests/unit/test_vote_duration_zero.py
index 00121dc2..ffa85d23 100644
--- a/tests/unit/test_vote_duration_zero.py
+++ b/tests/unit/test_vote_duration_zero.py
@@ -51,7 +51,7 @@ _VOTING_BASE = {
 
 def test_policy_form_rejects_zero_min_hours_in_production(monkeypatch) -> None:
     monkeypatch.setattr(config, "is_production_mode", lambda: True)
-    with pytest.raises(pydantic.ValidationError, match="between 72 and 144"):
+    with pytest.raises(pydantic.ValidationError, match="between 72 and 168"):
         projects.VotePolicyForm.model_validate(_POLICY_BASE)
 
     monkeypatch.setattr(config, "is_production_mode", lambda: False)
@@ -60,7 +60,7 @@ def test_policy_form_rejects_zero_min_hours_in_production(monkeypatch) -> None:
 
 def test_voting_form_rejects_zero_vote_duration_in_production(monkeypatch) -> None:
     monkeypatch.setattr(config, "is_production_mode", lambda: True)
-    with pytest.raises(pydantic.ValidationError, match="between 72 and 144"):
+    with pytest.raises(pydantic.ValidationError, match="between 72 and 168"):
         voting.StartVotingForm.model_validate(_VOTING_BASE)
 
     monkeypatch.setattr(config, "is_production_mode", lambda: False)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org