Skip to content

fix: use v2 template update endpoint to prevent ID alias insertion#284

Merged
ben-fornefeld merged 2 commits intomainfrom
cursor/dashboard-public-template-id-e422
Apr 3, 2026
Merged

fix: use v2 template update endpoint to prevent ID alias insertion#284
ben-fornefeld merged 2 commits intomainfrom
cursor/dashboard-public-template-id-e422

Conversation

@beran-t
Copy link
Copy Markdown
Contributor

@beran-t beran-t commented Mar 31, 2026

Summary

When toggling a template's visibility to public via the dashboard, the v1 PATCH /templates/{templateID} endpoint creates a "base alias" from the templateID, inserting the bare ID into env_aliases. This causes the template ID to appear as a name in the Name column.

This PR switches the updateTemplate mutation to use PATCH /v2/templates/{templateID}, which does not have this side effect.

The previous client-side workaround (filtering templateID out of names in TemplateNameCell) has been reverted since the root cause is now addressed at the API layer.

Slack Thread

Review & Testing Checklist for Human

  • Verify that toggling a template to public via the dashboard no longer inserts the template ID as a name in env_aliases (this requires checking the DB or observing the Name column after toggling)
  • Verify that toggling a template to internal (private) still works correctly with the v2 endpoint
  • Confirm the v2 endpoint is available and stable in all target environments (staging/production)

Suggested test plan: Toggle an existing template's visibility to public via the dashboard, then refresh the templates list. The Name column should show the human-readable alias, not the raw template ID.

Notes

  • The v2 endpoint uses the same TemplateUpdateRequest body ({ public: boolean }) but returns a TemplateUpdateResponse with names: string[]. The calling code only checks for success/error status, so the different response shape has no impact.
  • Templates that already had the ID inserted as an alias (from prior v1 calls) will still show the ID until those stale aliases are cleaned up separately.

Link to Devin session: https://app.devin.ai/sessions/c52f804e1cdb4ba5b4db88d3be77fa0b

Co-authored-by: Berry <beran-t@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Apr 3, 2026 9:19pm
web-juliett Ready Ready Preview, Comment Apr 3, 2026 9:19pm

Request Review

@beran-t beran-t marked this pull request as ready for review April 1, 2026 13:19
@beran-t beran-t requested a review from ben-fornefeld as a code owner April 1, 2026 13:19
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

LGTM — straightforward fix that correctly filters the template ID from the display names list while preserving fallback behavior.

Extended reasoning...

Overview

Single-file change in src/features/dashboard/templates/list/table-cells.tsx modifying only the TemplateNameCell component. The fix adds a pre-filter step before selecting the primary display name: it removes the raw templateID from the names array, then falls back to the original names array if no other entries remain.

Security Risks

None. This is a pure display/rendering change with no auth, data mutation, or external calls involved.

Level of Scrutiny

Low. The logic is simple, self-contained, and the fallback path is preserved exactly as before. The change directly addresses the described bug (template ID being shown as the primary name instead of human-readable aliases after toggling public status).

Other Factors

No bugs were found by the automated bug hunting system. The PR is a single-file UI fix with a clear causal link between the code change and the described problem. The additionalNames computation also correctly uses displayNames after the change, keeping the tooltip list consistent.

Switch from PATCH /templates/{templateID} (v1) to PATCH /v2/templates/{templateID}.
The v1 endpoint creates a base alias from the templateID, which inserts
the bare ID into env_aliases and causes it to appear as a name.

Revert the client-side workaround in TemplateNameCell since the root
cause is now addressed server-side.

Co-Authored-By: ben@e2b.dev <ben@e2b.dev>
@devin-ai-integration devin-ai-integration bot changed the title fix: keep template names visible after setting template public fix: use v2 template update endpoint to prevent ID alias insertion Apr 3, 2026
@ben-fornefeld ben-fornefeld merged commit 48ca9e9 into main Apr 3, 2026
10 checks passed
@ben-fornefeld ben-fornefeld deleted the cursor/dashboard-public-template-id-e422 branch April 3, 2026 22:50
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.

3 participants