Skip to content

feat(cloud): rename custom sandbox env images#3617

Merged
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/rename-custom-env-images
Jul 21, 2026
Merged

feat(cloud): rename custom sandbox env images#3617
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/rename-custom-env-images

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

Custom sandbox base images in cloud environments could be created and deleted but never renamed.

@trunk-io

trunk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 9e05615.

@tatoalo tatoalo self-assigned this Jul 21, 2026
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 21, 2026
@tatoalo
tatoalo marked this pull request as ready for review July 21, 2026 12:03

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New feature touching API contracts and UI behavioral logic with zero reviews, authored outside any owning team — needs a human reviewer familiar with the sandbox custom images area before it can be auto-approved.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 21, 2026
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx:480-481
**Failed Rename Rejects Unhandled**

When the PATCH fails because of a network, authentication, or backend error, `mutateAsync` rejects and both callers discard that promise with `void`. The mutation callback shows a toast but does not consume the rejection, so the application also emits an unhandled promise rejection.

```suggestion
    try {
      await updateImageMutation.mutateAsync({ id: renameImage.id, name });
      setRenameImage(null);
    } catch {
      // The mutation's onError callback displays the failure.
    }
```

### Issue 2 of 3
packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx:1154-1159
**Enter Bypasses Pending Guard**

The Enter handler invokes the rename callback even while the first request is pending, unlike the loading Save button. Holding or quickly pressing Enter twice can therefore start concurrent PATCH requests and display duplicate mutation feedback.

```suggestion
                  onKeyDown={(e) => {
                    if (e.key === "Enter") {
                      e.preventDefault();
                      if (!updateImageMutation.isPending) {
                        void handleRenameImage();
                      }
                    }
                  }}
```

### Issue 3 of 3
packages/ui/src/features/settings/sections/environments/useSandboxCustomImages.ts:160
**Partial Response Replaces Detail Cache**

If the PATCH endpoint returns only the updated fields, as the new client test permits, this call replaces the complete detail-cache object with `{ id, name }`. An open build-log view can then lose fields such as status and build output because this path invalidates only the list cache, not the detail entry.

Reviews (1): Last reviewed commit: "feat(cloud): rename custom sandbox env i..." | Re-trigger Greptile

Comment thread packages/ui/src/features/settings/sections/environments/useSandboxCustomImages.ts Outdated
Add a rename action to the custom sandbox image list so users can update
an image's display name without deleting and rebuilding it. Wired through
a new updateSandboxCustomImage API client method that PATCHes the
existing custom-image detail endpoint, plus an updateMutation hook and a
rename AlertDialog mirroring the existing delete confirmation flow.

The rename handler swallows the mutation rejection (onError shows the
toast), the Enter key respects the pending guard, and the update mutation
invalidates the detail cache rather than overwriting it with the PATCH
response, so a partial response cannot drop cached fields.
@tatoalo
tatoalo force-pushed the posthog-code/rename-custom-env-images branch from c0e6726 to 9e05615 Compare July 21, 2026 12:19
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 21, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code quality is solid and the bot-flagged P1/P2 issues were addressed, but the author is outside the owning team and this PR adds a new API contract method plus behavioral UI logic in the sandbox environments area, which requires a human reviewer familiar with that area before auto-approval.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 21, 2026
@tatoalo
tatoalo requested a review from a team July 21, 2026 13:37
@tatoalo
tatoalo enabled auto-merge (squash) July 21, 2026 13:41
@trunk-io
trunk-io Bot merged commit 97f151a into main Jul 21, 2026
37 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/rename-custom-env-images branch July 21, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants