asf-tooling commented on issue #1226:
URL: 
https://github.com/apache/tooling-trusted-releases/issues/1226#issuecomment-4409655113

   <!-- gofannon-issue-triage-bot v2 -->
   
   **Automated triage** — analyzed at `main@2da7807a`
   
   **Type:** `new_feature`  •  **Classification:** `actionable`  •  
**Confidence:** `medium`
   **Application domain(s):** `voting`
   
   ### Summary
   Issue #1226 requests automatic resolution of hybrid votes. Commit 2da7807a 
(current HEAD) already implements this for non-podling votes. The discussion 
between @sbp and @dave2wave concluded that for podlings, only the second round 
(general@incubator) should be automatically resolved, while the first round 
should remain manual. @sbp acknowledged this and committed to implementing it. 
The change requires modifying the podling check in 
`CommitteeParticipant.start()` and passing 
`automatic_resolve_when_finished=True` when starting the second-round vote from 
`resolve_release`.
   
   ### Where this lives in the code today
   
   #### `atr/storage/writers/vote.py` — `CommitteeMember.resolve_release` 
(lines 620-632)
   _needs modification_
   When the first round passes for a podling and the second round is started, 
`automatic_resolve_when_finished=True` should be passed to the `start()` call.
   
   ```python
       async def resolve_release(  # noqa: C901
           self,
           project_key: safe.ProjectKey,
           release: sql.Release,
           voting_round: int | None,
           vote_result: Literal["passed", "failed", "cancelled"],
           latest_vote_task: sql.Task,
           asf_fullname: str,
           resolution_body: str,
       ) -> tuple[sql.Release, int | None, str, str | None]:
           if (voting_round == 1) and (vote_result == "passed"):
               await self.__data.commit()
               await self.__data.begin_immediate()
   ```
   
   ### Proposed approach
   Two changes are needed:
   
   1. In `CommitteeParticipant.start()`, replace the blanket 
`committee.is_podling` block with a conditional that checks 
`release.podling_thread_id`. If `podling_thread_id is None`, it's the first 
round and automatic resolution should be blocked. If `podling_thread_id is not 
None`, it's the second round and automatic resolution should be allowed.
   
   2. In the section of `CommitteeMember.resolve_release()` that starts the 
second-round Incubator PMC vote (when `voting_round == 1` and `vote_result == 
'passed'`), pass `automatic_resolve_when_finished=True` to the 
`self.start(...)` call. The committee member permission check may also need 
adjustment since the second-round vote is initiated programmatically by the 
system on behalf of the user who resolved round one, who is a PPMC member but 
might not be an Incubator PMC member.
   
   Since @sbp is actively working on this (acknowledged in the discussion 0 
days ago), the diff below is illustrative of the approach rather than a 
finalized implementation.
   
   ### Suggested patches
   
   #### `atr/storage/writers/vote.py`
   Allow automatic resolution for podling second-round votes only, blocking 
first-round.
   
   ````diff
   --- a/atr/storage/writers/vote.py
   +++ b/atr/storage/writers/vote.py
   @@ -270,9 +270,11 @@
                if automatic_resolve_when_finished and (vote_mode != 
sql.VoteMode.TRUSTED):
                    raise storage.AccessError(
                        "Automatic vote resolution is only available in Trusted 
Vote mode", status=403
                    )
   -            if automatic_resolve_when_finished and committee.is_podling:
   -                raise storage.AccessError(
   -                    "Automatic vote resolution is not yet available for 
podling votes", status=403
   -                )
   +            if automatic_resolve_when_finished and committee.is_podling:
   +                # Allow automatic resolution for the second round 
(Incubator PMC vote)
   +                # but not for the first round (PPMC vote), so podlings 
learn the process
   +                if release.podling_thread_id is None:
   +                    raise storage.AccessError(
   +                        "Automatic vote resolution is not available for the 
first round of podling votes", status=403
   +                    )
                if automatic_resolve_when_finished and (self.__asf_uid not in 
committee.committee_members):
                    # TODO: Maybe we should modularise all of this?
                    # Then we could use the relevant permissions class
   ````
   
   ### Open questions
   - The `resolve_release` method is truncated in the source provided, so I 
cannot identify the exact line where `self.start(...)` is called for the 
second-round vote to confirm where `automatic_resolve_when_finished=True` 
should be added.
   - The committee member check (`self.__asf_uid not in 
committee.committee_members`) may need adjustment for the second round: the 
`committee` variable at that point would be the podling committee, but the vote 
is being sent to Incubator. Need to verify whether the committee variable is 
updated before the check when starting the second round programmatically.
   - Should the `automatic_resolve_when_finished` flag be inherited from the 
first-round task args, or should it always be True for the second round 
regardless of the first-round setting?
   
   ### Files examined
   - `atr/post/resolve.py`
   - `atr/shared/resolve.py`
   - `atr/tabulate.py`
   - `atr/get/resolve.py`
   - `atr/storage/writers/vote.py`
   - `atr/models/tabulate.py`
   - `atr/post/vote.py`
   - `atr/get/vote.py`
   
   ### Related issues
   This issue appears related to: #1216.
   
   _Both address improvements to Trusted Vote mode, with #1226 being a specific 
sub-task of #1216_
   
   ---
   *Draft from a triage agent. A human reviewer should validate before merging 
any change. The agent did not run tests or verify diffs apply.*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to