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

   <!-- gofannon-issue-triage-bot v2 -->
   
   **Automated triage** — analyzed at `main@2da7807a`
   
   **Type:** `discussion`  •  **Classification:** `no_action`  •  
**Confidence:** `high`
   **Application domain(s):** `voting`, `web_api_infrastructure`
   
   ### Summary
   This issue requests retry logic for failed vote email deliveries. The team 
has been actively discussing the design direction. @sbp noted (2025-12-03) that 
this depends on broader email architecture decisions (#209), and the 'current 
implementation is a simple send direct to the relay, and this code will go 
away.' @dave2wave noted it actually depends on #452. Most recently 
(2026-04-20), @sbp stated the team is 'erring on the side of failing and 
telling the user immediately' rather than silently queuing/retrying. The 
current code has a behavioral issue where email send failures are swallowed as 
warnings rather than surfaced to the user, which contradicts the stated design 
direction.
   
   ### Where this lives in the code today
   
   #### `atr/mail.py` — `_send_many` (lines 157-169)
   _currently does this_
   Low-level send catches all exceptions and returns them as error strings 
rather than propagating failures, enabling the silent-failure pattern upstream.
   
   ```python
   async def _send_many(from_addr: str, to_addrs: list[str], msg_text: str) -> 
list[str]:
       """Send an email to multiple recipients."""
       message_bytes = bytes(msg_text, "utf-8")
   
       errors = []
       for addr in to_addrs:
           try:
               await _send_via_relay(from_addr, addr, message_bytes)
           except Exception as e:
               log.exception(f"Failed to send to {addr}:")
               errors.append(f"failed to send to {addr}: {e}")
   
       return errors
   ```
   
   #### `atr/storage/writers/mail.py` — `FoundationCommitter.send` (lines 64-85)
   _currently does this_
   Storage-layer send wrapper returns errors as list[str] without raising, 
propagating the silent-failure pattern to all callers.
   
   ```python
       async def send(self, message: mail.Message, category: 
mail.MailFooterCategory) -> tuple[str, list[str]]:
           models_mail.message_id_validate(message.message_id)
           is_dev = config.is_dev_environment()
   
           if is_dev:
               log.info(f"Dev environment detected, not sending email to 
{message.email_to}")
               mid = message.message_id if (message.message_id is not None) 
else util.DEV_TEST_MID
               await _dev_email_log_append(message, category, mid)
               errors: list[str] = []
           else:
               mid, errors = await mail.send(message, category)
   
           self.__write_as.append_to_audit_log(
               sent=not is_dev,
               email_sender=message.email_sender,
               email_to=message.email_to,
               subject=message.subject,
               mid=mid,
               in_reply_to=message.in_reply_to,
           )
   
           return mid, errors
   ```
   
   ### Proposed approach
   The team has explicitly decided (per @sbp's latest comment) to 'err on the 
side of failing and telling the user immediately' rather than implementing 
silent background retries. This issue is blocked by broader email architecture 
decisions (#209 per @sbp, #452 per @dave2wave). Once those are resolved, the 
implementation would likely involve either: (1) making the vote initiation task 
raise an exception when email sending fails (so the task shows as FAILED and 
the user can see it), combined with a manual retry button in the UI; or (2) 
restructuring so the email is sent synchronously in the request handler rather 
than in a background task, giving immediate feedback. Given @sbp's statement 
that 'this code will go away,' the team expects a more substantial redesign 
rather than incremental patching.
   
   No diff is proposed because the team is still in design discussion mode, has 
identified blockers on other issues, and @sbp indicated the current mail code 
will be replaced.
   
   ### Open questions
   - What is the status of #209 and #452 (the blocking issues)?
   - Should the vote initiation task raise an exception when mail_errors is 
non-empty (immediate fix for the current silent-failure behavior)?
   - Will the email architecture redesign move sending out of background tasks 
into the request handler, or keep it as a task with better error surfacing?
   - Should there be a UI affordance for manual retry (e.g., a 'Resend vote 
email' button on the vote page when sending failed)?
   
   _The agent reviewed this issue and is not proposing patches in this run. 
Review the existing-code citations and open questions above before deciding 
next steps._
   
   ### Files examined
   - `atr/mail.py`
   - `atr/tasks/message.py`
   - `atr/post/voting.py`
   - `atr/tasks/vote.py`
   - `atr/post/resolve.py`
   - `atr/storage/writers/mail.py`
   - `atr/get/voting.py`
   - `atr/worker.py`
   
   ---
   *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