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/05/06 15:22:53 UTC

(tooling-trusted-releases) 01/02: Fix problems associated with manual vote mode

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

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

commit 300197d04bf8b3547c89417ad1bf40c0a6b255ee
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed May 6 15:46:30 2026 +0100

    Fix problems associated with manual vote mode
---
 atr/get/manual.py                  |  4 ++-
 atr/get/vote.py                    | 13 +++++++
 tests/unit/test_vote_rendering.py  | 74 ++++++++++++++++++++++++++++++++++++++
 tests/unit/test_vote_resolution.py |  4 +++
 4 files changed, 94 insertions(+), 1 deletion(-)

diff --git a/atr/get/manual.py b/atr/get/manual.py
index 63b2e8c3..0ec5d8bf 100644
--- a/atr/get/manual.py
+++ b/atr/get/manual.py
@@ -162,7 +162,9 @@ async def _render_resolve_page(release: sql.Release) -> htm.Element:
     page.p[
         "This is a manual vote resolution. "
         "Provide the vote thread URL and the URL of the thread where you posted the result. "
-        "For a cancellation, provide the URL of the thread where you sent the cancellation notice."
+        "For a cancellation, provide the URL of the thread where you sent the cancellation notice. "
+        "ATR uses these URLs only to verify that both threads belong to the same mailing list, "
+        "and does not store them."
     ]
 
     await form.render_block(
diff --git a/atr/get/vote.py b/atr/get/vote.py
index 34c4b280..ed0aa8c0 100644
--- a/atr/get/vote.py
+++ b/atr/get/vote.py
@@ -589,6 +589,10 @@ async def _render_section_vote(
     if release.committee is None:
         raise ValueError("Release has no committee")
 
+    if release.effective_vote_mode == sql.VoteMode.MANUAL:
+        _render_vote_manual(page)
+        return
+
     vote_recipient = _vote_recipient(release, latest_vote_task)
     if user_category == UserCategory.UNAUTHENTICATED:
         _render_vote_unauthenticated(page, release, archive_url, vote_recipient)
@@ -716,6 +720,15 @@ def _render_vote_delivery(
         page.p["Your vote will be sent to ", htpy.code[vote_recipient], "."]
 
 
+def _render_vote_manual(page: htm.Block) -> None:
+    page.div(".alert.alert-info", role="alert")[
+        htpy.i(".bi.bi-info-circle.me-2"),
+        "This release uses manual voting. The vote thread is hosted on the project mailing list, ",
+        "and ATR cannot record votes or display the thread for it. ",
+        "To participate, reply to the vote thread directly on the mailing list.",
+    ]
+
+
 def _render_vote_unauthenticated(
     page: htm.Block,
     release: sql.Release,
diff --git a/tests/unit/test_vote_rendering.py b/tests/unit/test_vote_rendering.py
index 87ade232..e0a5b09d 100644
--- a/tests/unit/test_vote_rendering.py
+++ b/tests/unit/test_vote_rendering.py
@@ -28,6 +28,7 @@ import sqlmodel
 
 import atr.db as db
 import atr.db.interaction as interaction
+import atr.get.projects as projects
 import atr.get.vote as vote
 import atr.htm as htm
 import atr.models.results as results
@@ -272,6 +273,55 @@ async def test_latest_ballot_for_voter_uses_highest_id_not_timestamp(sqlite_sess
     assert found.receipt_message_id == "highest-id@apache.org"
 
 
+@pytest.mark.asyncio
+async def test_manual_mode_authenticated_renders_notice_and_no_cast_form(
+    render_app: quart.Quart, monkeypatch: pytest.MonkeyPatch
+) -> None:
+    await _patch_render_dependencies(monkeypatch)
+
+    async with render_app.test_request_context("/vote/project/1.0.0"):
+        page = htm.Block()
+        await vote._render_section_vote(
+            page,
+            _release(sql.VoteMode.MANUAL),
+            _session(),
+            vote.UserCategory.PMC_MEMBER_RM,
+            None,
+            None,
+        )
+
+    html = str(page.collect())
+    assert "This release uses manual voting." in html
+    assert "reply to the vote thread directly" in html
+    assert "<textarea" not in html
+    assert 'name="vote_seq"' not in html
+    assert 'name="decision"' not in html
+    assert "Submit vote" not in html
+
+
+@pytest.mark.asyncio
+async def test_manual_mode_unauthenticated_renders_notice_without_archive_message(
+    render_app: quart.Quart, monkeypatch: pytest.MonkeyPatch
+) -> None:
+    await _patch_render_dependencies(monkeypatch)
+
+    async with render_app.test_request_context("/vote/project/1.0.0"):
+        page = htm.Block()
+        await vote._render_section_vote(
+            page,
+            _release(sql.VoteMode.MANUAL),
+            None,
+            vote.UserCategory.UNAUTHENTICATED,
+            None,
+            None,
+        )
+
+    html = str(page.collect())
+    assert "This release uses manual voting." in html
+    assert "The vote thread archive is not yet available" not in html
+    assert "Log in to vote" not in html
+
+
 def test_message_id_source_archive_url_encodes_message_id_and_listid() -> None:
     url = shared.vote.message_id_source_archive_url(
         "CAA9ykM+bMPNk=BOF@apache.org",
@@ -284,6 +334,30 @@ def test_message_id_source_archive_url_encodes_message_id_and_listid() -> None:
     )
 
 
+def test_non_podling_vote_mode_radios_includes_manual() -> None:
+    project = SimpleNamespace(
+        committee=SimpleNamespace(is_podling=False),
+        policy_vote_mode=sql.VoteMode.EMAIL,
+    )
+
+    html = str(projects._vote_mode_radios(project))
+
+    assert 'value="manual"' in html
+
+
+def test_podling_vote_mode_radios_omits_manual() -> None:
+    project = SimpleNamespace(
+        committee=SimpleNamespace(is_podling=True),
+        policy_vote_mode=sql.VoteMode.EMAIL,
+    )
+
+    html = str(projects._vote_mode_radios(project))
+
+    assert 'value="email"' in html
+    assert 'value="trusted"' in html
+    assert 'value="manual"' not in html
+
+
 @pytest.mark.asyncio
 async def test_trusted_rendering_with_current_vote_seq_none_does_not_query_ballots(
     render_app: quart.Quart, monkeypatch: pytest.MonkeyPatch
diff --git a/tests/unit/test_vote_resolution.py b/tests/unit/test_vote_resolution.py
index 21d3a1f9..a87a521d 100644
--- a/tests/unit/test_vote_resolution.py
+++ b/tests/unit/test_vote_resolution.py
@@ -308,6 +308,9 @@ async def test_manual_passed_creates_preview_revision() -> None:
     assert release.vote_resolved is not None
     assert success == "Vote marked as passed"
     write_as.revision.create_revision_with_quarantine.assert_awaited_once()
+    revision_call = write_as.revision.create_revision_with_quarantine.await_args
+    assert revision_call is not None
+    assert revision_call.kwargs["allowed_phases"] == frozenset({sql.ReleasePhase.RELEASE_PREVIEW})
 
 
 @pytest.mark.asyncio
@@ -339,6 +342,7 @@ async def test_manual_resolve_page_explains_cancellation_notice_url(
     assert "manual vote resolution" in html
     assert "where you posted the result" in html
     assert "cancellation notice" in html
+    assert "does not store them" in html
 
 
 @pytest.mark.asyncio


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