The GitHub Actions job "License Binary Checker" on texera.git/main has failed. Run started by GitHub user bobbai00 (triggered by bobbai00).
Head commit for run: 0a42fcdbc20732ada9614bc77a0cfedd05cf6074 / Meng Wang <[email protected]> fix: surface SMTP failures from gmail share endpoint to UI (#5164) ### What changes were proposed in this PR? `GmailResource.sendEmailRequest` discarded the `Either[String, Unit]` returned by `sendEmail`. The endpoint itself was typed `Unit`, so JAX-RS responded `204 No Content` regardless of outcome — any SMTP failure (invalid credentials, network error, etc.) was logged server-side but the HTTP layer reported success, and the frontend's `next:` callback fired a green "Email sent successfully" toast even though no mail was delivered. This PR closes that gap in two layers: **Backend (`GmailResource.scala`)** — pattern-match the `Either` and throw `WebApplicationException(error, Response.Status.BAD_GATEWAY)` on `Left`. JAX-RS converts the exception into an HTTP 502, which triggers Angular's `error:` callback on the frontend side. This matches the existing codebase convention in `AdminUserResource` (`Email already exists`, 409) and `UserResource` (`User not found`, 404). **Frontend (`gmail.service.ts`)** — the existing `error:` branch only `console.error`'d. Add a `notificationService.error(...)` call mirroring the existing `notifyUnauthorizedLogin` error handler in the same file (lines 56–61). The user-facing toast uses a generic message ("Failed to send email. Please try again or contact admin.") rather than the raw SMTP error, to avoid exposing protocol-level details like `535-5.7.8 Username and Password not accepted` to end users; the specific SMTP error continues to land in the backend log and the browser console for debugging. ### Any related issues, documentation, discussions? Closes #5161. ### How was this PR tested? Added `gmail.service.spec.ts` (Vitest + `HttpClientTestingModule`) covering both contracts: - HTTP 2xx → `notificationService.success("Email sent successfully")` fires - HTTP 502 → `notificationService.error("Failed to send email. ...")` fires No backend test added: `GmailResource` has no JAX-RS controller test harness, and building one would require refactoring `sendEmail` out of the companion object into an injectable dependency — disproportionate to a five-line fix. Verified locally: - `sbt "WorkflowExecutionService/scalafmtCheck" "WorkflowExecutionService/compile"` — clean. - `yarn test --include='**/gmail.service.spec.ts'` — 2 passed. - `yarn prettier --check src/app/common/service/gmail/gmail.service.spec.ts` — clean. Manual verification path (for reviewers reproducing the issue's repro): 1. Don't set `USER_SYS_GOOGLE_SMTP_GMAIL` / `USER_SYS_GOOGLE_SMTP_PASSWORD`. 2. Start amber backend + frontend. 3. Open the share dialog on any workflow/dataset/project, enter a real email, submit. 4. Frontend: red toast *"Failed to send email. Please try again or contact admin."*. 5. Backend log: `Failed to send email: 535-5.7.8 Username and Password not accepted...` (unchanged). 6. Browser console: `Send email error: ...` (the specific SMTP error). ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-7) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Report URL: https://github.com/apache/texera/actions/runs/26359933306 With regards, GitHub Actions via GitBox
