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 abe2b3b Move the manual vote resolution code to the vote writer
abe2b3b is described below
commit abe2b3bc19f67f28843b149f2188c4c1247a642e
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Sep 11 18:33:03 2025 +0100
Move the manual vote resolution code to the vote writer
---
atr/routes/resolve.py | 23 ++---------------------
atr/storage/writers/vote.py | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/atr/routes/resolve.py b/atr/routes/resolve.py
index 12f4999..c50d635 100644
--- a/atr/routes/resolve.py
+++ b/atr/routes/resolve.py
@@ -19,10 +19,8 @@
import quart
import werkzeug.wrappers.response as response
-import atr.db as db
import atr.forms as forms
import atr.models.sql as sql
-import atr.revision as revision
import atr.routes as routes
import atr.routes.compose as compose
import atr.routes.finish as finish
@@ -112,25 +110,8 @@ async def manual_selected_post(
vote_result_url = util.unwrap(resolve_form.vote_result_url.data)
await _committees_check(vote_thread_url, vote_result_url)
- # TODO: Move this to the storage interface
- async with db.session() as data:
- release = await data.merge(release)
- if vote_result == "passed":
- release.phase = sql.ReleasePhase.RELEASE_PREVIEW
- await data.commit()
- await data.refresh(release)
- success_message = "Vote marked as passed"
-
- description = "Create a preview revision from the last candidate
draft"
- async with revision.create_and_manage(
- project_name, release.version, session.uid,
description=description
- ) as _creating:
- pass
- else:
- release.phase = sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT
- await data.commit()
- await data.refresh(release)
- success_message = "Vote marked as failed"
+ async with storage.write_as_project_committee_member(project_name) as wacm:
+ success_message = await wacm.vote.resolve_manually(project_name,
release, vote_result)
if vote_result == "passed":
destination = finish.selected
else:
diff --git a/atr/storage/writers/vote.py b/atr/storage/writers/vote.py
index 0d4a14a..416f343 100644
--- a/atr/storage/writers/vote.py
+++ b/atr/storage/writers/vote.py
@@ -135,6 +135,34 @@ class CommitteeMember(CommitteeParticipant):
resolution_body,
)
+ async def resolve_manually(
+ self,
+ project_name: str,
+ release: sql.Release,
+ vote_result: Literal["passed", "failed"],
+ ) -> str:
+ # Attach the existing release to the session
+ release = await self.__data.merge(release)
+
+ if vote_result == "passed":
+ release.phase = sql.ReleasePhase.RELEASE_PREVIEW
+ await self.__data.commit()
+ await self.__data.refresh(release)
+ success_message = "Vote marked as passed"
+
+ description = "Create a preview revision from the last candidate
draft"
+ async with revision.create_and_manage(
+ project_name, release.version, self.__asf_uid,
description=description
+ ) as _creating:
+ pass
+ else:
+ release.phase = sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT
+ await self.__data.commit()
+ await self.__data.refresh(release)
+ success_message = "Vote marked as failed"
+
+ return success_message
+
async def resolve_release(
self,
project_name: str,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]