From 91af65ec6f726746ec923782f49db4d824f5e2b1 Mon Sep 17 00:00:00 2001 From: Manas Srivastava Date: Tue, 2 Jun 2026 18:46:15 +0530 Subject: [PATCH] feat(deploy): carry app_url/app_name/env on deploy.healthy audit row The deploy.healthy audit metadata only had time_to_healthy_seconds, so the worker's new "your app is live at " email had no URL to render. Add app_url/app_name/env to both deploy.healthy emit sites (fresh deploy + in-place redeploy). Fresh path reads result.AppURL (the in-memory struct isn't stamped yet); redeploy reuses the loaded d.AppURL. Pairs with the worker PR wiring deploy.created/healthy into the email forwarder. Co-Authored-By: Claude Opus 4.8 (1M context) --- internal/handlers/deploy.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/handlers/deploy.go b/internal/handlers/deploy.go index 4e0de7e7..f06dfbdc 100644 --- a/internal/handlers/deploy.go +++ b/internal/handlers/deploy.go @@ -541,6 +541,13 @@ func (h *DeployHandler) runDeploy(d *models.Deployment, tarball []byte) { // entry; for k8s this includes the kaniko build + apply pipeline. emitDeployAudit(h.db, models.AuditKindDeployHealthy, d, map[string]any{ "time_to_healthy_seconds": int(time.Since(startedAt).Round(time.Second).Seconds()), + // app_url/app_name/env let the worker's deploy.healthy email render + // "your app is live at ". d.AppURL is not yet populated in-memory + // here (UpdateDeploymentProviderID only persisted it to the row), so + // read result.AppURL directly. + "app_url": result.AppURL, + "app_name": d.AppID, + "env": d.Env, }) } @@ -1607,8 +1614,14 @@ func (h *DeployHandler) runRedeployAsync(d *models.Deployment, tarball []byte) { return } _ = models.UpdateDeploymentStatus(ctx, h.db, d.ID, result.Status, "") + // In-place redeploy keeps the same URL — d.AppURL was loaded from the + // existing row. Carry it (plus app_name/env) so the deploy.healthy + // email renders identically to the fresh-deploy path. emitDeployAudit(h.db, models.AuditKindDeployHealthy, d, map[string]any{ "time_to_healthy_seconds": int(time.Since(startedAt).Round(time.Second).Seconds()), + "app_url": d.AppURL, + "app_name": d.AppID, + "env": d.Env, }) }) }