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/13 19:38:12 UTC
(tooling-trusted-releases) branch sbp updated (f62697a7 -> 4c1f99d1)
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a change to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
from f62697a7 Use templates by default in the API for announcement messages
add d37c5694 Adjust downloads menu target (#1394)
new 4c1f99d1 Use the policy vote duration in the API by default
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
atr/api/__init__.py | 19 ++++++++++++++-----
atr/models/api.py | 2 +-
atr/templates/includes/topnav.html | 9 ++-------
tests/unit/test_api_vote_start.py | 7 +++----
4 files changed, 20 insertions(+), 17 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 01/01: Use the policy vote duration in the API by default
Posted by sb...@apache.org.
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 4c1f99d11c5ccc4060f197268b90d74bc83564fc
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Mon Jul 13 20:37:44 2026 +0100
Use the policy vote duration in the API by default
---
atr/api/__init__.py | 19 ++++++++++++++-----
atr/models/api.py | 2 +-
tests/unit/test_api_vote_start.py | 7 +++----
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/atr/api/__init__.py b/atr/api/__init__.py
index d2c7eef3..a1c00e09 100644
--- a/atr/api/__init__.py
+++ b/atr/api/__init__.py
@@ -1978,16 +1978,21 @@ async def vote_start(
if data.email_to not in permitted_recipients:
raise exceptions.Forbidden("Invalid mailing list choice")
util.validate_email_recipients(data)
- util.validate_vote_duration(data.vote_duration)
+ vote_duration = data.vote_duration
+ if vote_duration is None:
+ vote_duration = release.project.policy_min_hours
+ util.validate_vote_duration(vote_duration)
- subject, body, fullname = await _vote_start_subject_and_body(data, release, asf_uid, scanned_revision)
+ subject, body, fullname = await _vote_start_subject_and_body(
+ data, release, asf_uid, scanned_revision, vote_duration
+ )
async with storage.write_as_project_release_manager(data.project, asf_uid) as warm:
task = await warm.vote.start(
data.email_to,
data.project,
data.version,
- data.vote_duration,
+ vote_duration,
subject,
body,
fullname,
@@ -2311,7 +2316,11 @@ async def _resolve_signing_key_from_signature(
async def _vote_start_subject_and_body(
- data: models.api.VoteStartArgs, release: sql.Release, asf_uid: str, revision_number: safe.RevisionNumber
+ data: models.api.VoteStartArgs,
+ release: sql.Release,
+ asf_uid: str,
+ revision_number: safe.RevisionNumber,
+ vote_duration: int,
) -> tuple[str, str, str]:
fullname = await _ldap_fullname(asf_uid)
if (data.subject is not None) and (data.body is not None):
@@ -2331,7 +2340,7 @@ async def _vote_start_subject_and_body(
project_key=data.project,
version_key=data.version,
revision_number=revision_number,
- vote_duration=(0 if release.expedited else data.vote_duration),
+ vote_duration=(0 if release.expedited else vote_duration),
)
subject, body = await construct.start_vote_subject_and_body(subject_template, body_template, options)
if data.subject is not None:
diff --git a/atr/models/api.py b/atr/models/api.py
index 770210b2..42de59fc 100644
--- a/atr/models/api.py
+++ b/atr/models/api.py
@@ -901,7 +901,7 @@ class VoteStartArgs(schema.Strict):
email_to: str = schema.example("dev@example.apache.org")
email_cc: list[str] = schema.default_example([], ["dev@example.apache.org"])
email_bcc: list[str] = schema.default_example([], ["dev@example.apache.org"])
- vote_duration: int = schema.example(72)
+ vote_duration: int | None = schema.default_example(None, 72)
subject: str | None = schema.default_example(None, "[VOTE] Apache Example 0.0.1 release")
body: str | None = schema.default_example(
None, "The Apache Example team is pleased to announce the release of Example 0.0.1..."
diff --git a/tests/unit/test_api_vote_start.py b/tests/unit/test_api_vote_start.py
index e8875137..1ab1fb00 100644
--- a/tests/unit/test_api_vote_start.py
+++ b/tests/unit/test_api_vote_start.py
@@ -30,7 +30,7 @@ async def test_vote_start_expedited_release_uses_expedited_template(monkeypatch)
calls = _patch_rendering(monkeypatch)
subject, body, fullname = await api._vote_start_subject_and_body(
- _args(subject="Custom subject"), _release(expedited=True), "user", safe.RevisionNumber("00001")
+ _args(subject="Custom subject"), _release(expedited=True), "user", safe.RevisionNumber("00001"), 72
)
assert (subject, body, fullname) == ("Custom subject", "RENDERED BODY", "Example User")
@@ -44,7 +44,7 @@ async def test_vote_start_omitted_subject_and_body_render_policy_templates(monke
calls = _patch_rendering(monkeypatch)
subject, body, fullname = await api._vote_start_subject_and_body(
- _args(), _release(), "user", safe.RevisionNumber("00001")
+ _args(), _release(), "user", safe.RevisionNumber("00001"), 72
)
assert (subject, body, fullname) == ("RENDERED SUBJECT", "RENDERED BODY", "Example User")
@@ -60,7 +60,7 @@ async def test_vote_start_supplied_subject_and_body_pass_through(monkeypatch) ->
calls = _patch_rendering(monkeypatch)
subject, body, fullname = await api._vote_start_subject_and_body(
- _args(subject="Custom subject", body="Custom body"), _release(), "user", safe.RevisionNumber("00001")
+ _args(subject="Custom subject", body="Custom body"), _release(), "user", safe.RevisionNumber("00001"), 72
)
assert (subject, body, fullname) == ("Custom subject", "Custom body", "Example User")
@@ -72,7 +72,6 @@ def _args(subject: str | None = None, body: str | None = None) -> models.api.Vot
project=safe.ProjectKey("example"),
version=safe.VersionKey("1.0.0"),
email_to="dev@example.apache.org",
- vote_duration=72,
subject=subject,
body=body,
)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org