Skip to content

fix(apps): give new deployed endpoints unique template names - #696

Open
deanq wants to merge 1 commit into
mainfrom
deanq/sls-991-deploy-template-names
Open

deanq wants to merge 1 commit into
mainfrom
deanq/sls-991-deploy-template-names

Conversation

@deanq

@deanq deanq commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

What

rp flash deploy named every endpoint template {app}-{resource}-template. Template names are unique per owner, and a deleted endpoint keeps its template for a while before the platform removes it. So these fail with "endpoint template names must be unique":

rp flash deploy
rp flash app delete <app> --yes
rp flash deploy        # same app name, shortly after the delete

Deploying an app to a second environment while the first one is live fails for the same reason.

Changes:

  • New endpoints get {app}-{resource}-template-<6 hex chars>.
  • Updates to existing endpoints send the bound template's current name, so redeploying a live app sends the same template name as today. The environment queries now select endpoints { id name template { name } }.
  • If an existing endpoint comes back without template info, the legacy fixed name is used.

Why this shape

Only new endpoints vary the name. Updates keep it, so this PR doesn't depend on how the platform treats a template name change during an update.

#683 fixes the same collision for rp flash dev sessions in dev.py. This PR only touches the deploy path (deploy.py and the environment queries), so the two don't overlap.

Template cleanup after an endpoint is deleted isn't part of this PR. Held templates are removed by the platform.

Test plan

  • New tests in tests/test_apps/test_deploy.py:
    • new endpoints get a suffixed name that differs between deploys
    • updates keep the existing template name
    • endpoints without template info use the legacy name
    • both environment queries select the template name
  • The suffix and keep-name tests failed before the change
  • make quality-check (2778 passed)
  • Live check: the first deploy got a suffixed template name, a redeploy kept it, and deleting the app then redeploying right away got a new suffix and succeeded. On unfixed code, the same delete-then-redeploy failed with "endpoint template names must be unique".

Template names are unique per owner, and a deleted endpoint keeps its
template for a while before the platform removes it. Deploys named
every template {app}-{resource}-template, so redeploying an app soon
after deleting it, or deploying it to a second environment, failed
with "endpoint template names must be unique".

- new endpoints get {app}-{resource}-template-<6 hex chars>
- updates send the bound template's current name, read from the
  environment query, so redeploys of existing endpoints are unchanged
- endpoints without template info fall back to the legacy name

This branch has not been deployed

No deployments
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.

1 participant