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

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


The following commit(s) were added to refs/heads/main by this push:
     new bac2b66  Disallow starting a vote until all checks have completed
bac2b66 is described below

commit bac2b66f8fe3122406122cf362eec6e41c4194ef
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri May 30 17:26:29 2025 +0100

    Disallow starting a vote until all checks have completed
---
 atr/routes/voting.py | 12 ++++++++++++
 atr/tasks/vote.py    |  8 ++++++++
 2 files changed, 20 insertions(+)

diff --git a/atr/routes/voting.py b/atr/routes/voting.py
index 52ec680..f24ee9e 100644
--- a/atr/routes/voting.py
+++ b/atr/routes/voting.py
@@ -26,6 +26,7 @@ import wtforms
 
 import atr.construct as construct
 import atr.db as db
+import atr.db.interaction as interaction
 import atr.db.models as models
 import atr.routes as routes
 import atr.routes.compose as compose
@@ -126,6 +127,17 @@ async def selected_revision(
                 # This will be checked again by tasks/vote.py for extra safety
                 raise base.ASFQuartException("Invalid mailing list choice", 
errorcode=400)
 
+            # Check for ongoing tasks
+            ongoing_tasks = await interaction.tasks_ongoing(project_name, 
version_name, selected_revision_number)
+            if ongoing_tasks > 0:
+                return await session.redirect(
+                    selected_revision,
+                    project_name=project_name,
+                    version_name=version_name,
+                    revision=selected_revision_number,
+                    error="All checks must be completed before starting a 
vote.",
+                )
+
             # This sets the phase to RELEASE_CANDIDATE
             error = await _promote(data, release.name, 
selected_revision_number)
             if error:
diff --git a/atr/tasks/vote.py b/atr/tasks/vote.py
index cb3cd0a..68742f5 100644
--- a/atr/tasks/vote.py
+++ b/atr/tasks/vote.py
@@ -22,6 +22,7 @@ from typing import Any, Final
 
 import atr.construct as construct
 import atr.db as db
+import atr.db.interaction as interaction
 import atr.mail as mail
 import atr.schema as schema
 import atr.tasks.checks as checks
@@ -75,6 +76,13 @@ async def _initiate_core_logic(args: Initiate) -> dict[str, 
Any]:
         release = await data.release(name=args.release_name, _project=True, 
_committee=True).demand(
             VoteInitiationError(f"Release {args.release_name} not found")
         )
+        latest_revision_number = release.latest_revision_number
+        if latest_revision_number is None:
+            raise VoteInitiationError(f"No revisions found for release 
{args.release_name}")
+
+        ongoing_tasks = await interaction.tasks_ongoing(release.project.name, 
release.version, latest_revision_number)
+        if ongoing_tasks > 0:
+            raise VoteInitiationError(f"Cannot start vote for 
{args.release_name} as {ongoing_tasks} are not complete")
 
     # Calculate vote end date
     vote_duration_hours = args.vote_duration


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to