From 6774036bda1508ee753106a3918ef6ee403e689b Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 22 Apr 2026 15:55:57 -0700 Subject: [PATCH 1/2] feat: dry run commit check links back to individual plan result --- .../deploymentplanresult/github_check.go | 21 +++++++++++-------- .../deploymentplanresult/github_check_test.go | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go b/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go index c193fba76..8df4ed96a 100644 --- a/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go +++ b/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go @@ -43,16 +43,17 @@ func checkRunName(environmentName, resourceName string) string { return fmt.Sprintf("ctrlplane / %s / %s", environmentName, resourceName) } -// targetDetailsURL returns the ctrlplane UI link for a specific target -// within a plan (used as the check's "Details" link). -func targetDetailsURL(ctx targetContext) string { +// targetDetailsURL returns the ctrlplane UI link for a specific result +// within a plan (used as the check's "Details" link). The URL opens the +// diff dialog for that result on page load. +func targetDetailsURL(ctx targetContext, resultID uuid.UUID) string { return fmt.Sprintf( - "%s/%s/deployments/%s/plans/%s?target=%s", + "%s/%s/deployments/%s/plans/%s?resultId=%s", strings.TrimRight(config.Global.BaseURL, "/"), ctx.WorkspaceSlug, ctx.DeploymentID, ctx.PlanID, - ctx.TargetID, + resultID, ) } @@ -309,6 +310,7 @@ func truncateText(s string, maxBytes int) string { // from the target's current state and all its agents' results. func buildCheckOutput( tc targetContext, + resultID uuid.UUID, results []agentResult, agg aggregate, ) *github.CheckRunOutput { @@ -316,7 +318,7 @@ func buildCheckOutput( var summary strings.Builder fmt.Fprintf(&summary, "**Version:** `%s`\n\n", tc.VersionTag) - fmt.Fprintf(&summary, "[View full plan →](%s)\n", targetDetailsURL(tc)) + fmt.Fprintf(&summary, "[View full plan →](%s)\n", targetDetailsURL(tc, resultID)) var text strings.Builder for i, r := range results { @@ -369,12 +371,13 @@ func upsertCheckRun( ctx context.Context, client *github.Client, tc targetContext, + resultID uuid.UUID, agg aggregate, output *github.CheckRunOutput, ) error { name := checkRunName(tc.EnvironmentName, tc.ResourceName) status := agg.checkStatus() - detailsURL := targetDetailsURL(tc) + detailsURL := targetDetailsURL(tc, resultID) existing, err := findCheckRunByName(ctx, client, tc.Owner, tc.Repo, tc.SHA, name) if err != nil { @@ -491,9 +494,9 @@ func MaybeUpdateTargetCheck( } agg := aggregateResults(results) - output := buildCheckOutput(tc, results, agg) + output := buildCheckOutput(tc, resultID, results, agg) - if err := upsertCheckRun(ghCtx, client, tc, agg, output); err != nil { + if err := upsertCheckRun(ghCtx, client, tc, resultID, agg, output); err != nil { span.RecordError(err) span.SetStatus(codes.Error, "upsert check run") return err diff --git a/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check_test.go b/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check_test.go index e48edf38f..371982a1c 100644 --- a/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check_test.go +++ b/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check_test.go @@ -268,7 +268,7 @@ func TestBuildCheckOutput_IncludesAllSections(t *testing.T) { } agg := aggregateResults(results) - out := buildCheckOutput(tc, results, agg) + out := buildCheckOutput(tc, uuid.New(), results, agg) require.NotNil(t, out) require.NotNil(t, out.Title) From 871f7074c12088b84fbe2cb0326494bfedf25747 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 22 Apr 2026 16:01:44 -0700 Subject: [PATCH 2/2] cleanup --- .../controllers/deploymentplanresult/github_check.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go b/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go index 8df4ed96a..bc822ce24 100644 --- a/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go +++ b/apps/workspace-engine/svc/controllers/deploymentplanresult/github_check.go @@ -43,10 +43,10 @@ func checkRunName(environmentName, resourceName string) string { return fmt.Sprintf("ctrlplane / %s / %s", environmentName, resourceName) } -// targetDetailsURL returns the ctrlplane UI link for a specific result -// within a plan (used as the check's "Details" link). The URL opens the -// diff dialog for that result on page load. -func targetDetailsURL(ctx targetContext, resultID uuid.UUID) string { +// resultDetailsURL returns the ctrlplane UI link for a specific plan +// result (used as the check's "Details" link). The URL opens the diff +// dialog for that result on page load. +func resultDetailsURL(ctx targetContext, resultID uuid.UUID) string { return fmt.Sprintf( "%s/%s/deployments/%s/plans/%s?resultId=%s", strings.TrimRight(config.Global.BaseURL, "/"), @@ -318,7 +318,7 @@ func buildCheckOutput( var summary strings.Builder fmt.Fprintf(&summary, "**Version:** `%s`\n\n", tc.VersionTag) - fmt.Fprintf(&summary, "[View full plan →](%s)\n", targetDetailsURL(tc, resultID)) + fmt.Fprintf(&summary, "[View diff →](%s)\n", resultDetailsURL(tc, resultID)) var text strings.Builder for i, r := range results { @@ -377,7 +377,7 @@ func upsertCheckRun( ) error { name := checkRunName(tc.EnvironmentName, tc.ResourceName) status := agg.checkStatus() - detailsURL := targetDetailsURL(tc, resultID) + detailsURL := resultDetailsURL(tc, resultID) existing, err := findCheckRunByName(ctx, client, tc.Owner, tc.Repo, tc.SHA, name) if err != nil {