Skip to content

Feat: AE-2089: update sls endpoint template params#198

Merged
deanq merged 3 commits intomainfrom
jhcipar/AE-2089/update-endpoint-bound-template
Feb 13, 2026
Merged

Feat: AE-2089: update sls endpoint template params#198
deanq merged 3 commits intomainfrom
jhcipar/AE-2089/update-endpoint-bound-template

Conversation

@jhcipar
Copy link
Contributor

@jhcipar jhcipar commented Feb 12, 2026

  • Fixes serverless endpoint update behavior so template changes are reliably persisted during in-place updates.
  • Adds a direct saveTemplate GraphQL path and wires serverless updates to resolve and reuse templateId
  • Preserves input-only config fields (like env, networkVolume, and related local state) after GraphQL hydration to avoid false drift/redeploy loops
  • Syncs templateId back onto caller objects after deploy/update

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances serverless endpoint template update functionality to ensure template changes are reliably persisted during in-place updates. It introduces a dedicated GraphQL path for template updates via the update_template method, properly resolves and reuses templateId across operations, and preserves input-only configuration fields (env, networkVolume, datacenter) after GraphQL hydration to prevent false drift detection and unnecessary redeployments.

Changes:

  • Added update_template GraphQL mutation method to enable separate template updates
  • Modified serverless update flow to call saveTemplate separately when template changes are detected
  • Enhanced deploy and update methods to sync templateId back to caller objects after operations

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/runpod_flash/core/api/runpod.py Added update_template method with saveTemplate GraphQL mutation
src/runpod_flash/core/resources/serverless.py Added _build_template_update_payload method, modified update flow to call update_template separately, and synced templateId to caller objects in deploy and update methods
tests/unit/resources/test_serverless.py Added tests for templateId syncing, input-only field restoration during updates, and separate template update calls
tests/unit/resources/test_resource_manager.py Added test verifying config drift triggers in-place update instead of redeploy
tests/conftest.py Added mock for update_template in shared test fixtures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mock_runpod_client.update_template.assert_called_once()
template_payload = mock_runpod_client.update_template.call_args.args[0]
assert template_payload["id"] == "template-existing"
assert template_payload["imageName"] == "image:v2"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The test creates a PodTemplate with dockerArgs="--flag" but doesn't verify that dockerArgs is included in the template_payload sent to update_template. Consider adding an assertion like assert template_payload["dockerArgs"] == "--flag" to ensure the _build_template_update_payload method correctly includes all template fields.

Suggested change
assert template_payload["imageName"] == "image:v2"
assert template_payload["imageName"] == "image:v2"
assert template_payload["dockerArgs"] == "--flag"

Copilot uses AI. Check for mistakes.
Comment on lines +608 to +611
if not updated.templateId:
updated.templateId = (
resolved_template_id or self.templateId or new_config.templateId
)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The templateId fallback logic has redundancy. Line 588-590 already resolves templateId from the result, self, or new_config. Then lines 608-611 do the same fallback again. This creates confusing control flow where the same logic is duplicated. Consider removing the second fallback since resolved_template_id should already contain the correct value from line 588-590.

Suggested change
if not updated.templateId:
updated.templateId = (
resolved_template_id or self.templateId or new_config.templateId
)
if not updated.templateId and resolved_template_id:
updated.templateId = resolved_template_id

Copilot uses AI. Check for mistakes.
payload = {
key: value for key, value in template_data.items() if key in allowed_fields
}
# savetemplate mutation requires volumeInGb, but for sls this is always 0
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The comment on line 508 has a typo: "savetemplate" should be "saveTemplate" to match the GraphQL mutation name and maintain consistency with the rest of the codebase which uses camelCase for mutation names.

Suggested change
# savetemplate mutation requires volumeInGb, but for sls this is always 0
# saveTemplate mutation requires volumeInGb, but for sls this is always 0

Copilot uses AI. Check for mistakes.
raise ValueError("Cannot update: endpoint not deployed")

try:
resolved_template_id = self.templateId or new_config.templateId
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

This assignment to 'resolved_template_id' is unnecessary as it is redefined before this value is used.

Suggested change
resolved_template_id = self.templateId or new_config.templateId

Copilot uses AI. Check for mistakes.
@deanq deanq merged commit 656fa46 into main Feb 13, 2026
12 checks passed
@deanq deanq deleted the jhcipar/AE-2089/update-endpoint-bound-template branch February 13, 2026 19:10
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