Skip to content

fix: don't delete or fail to update conditions when their parent step…#71

Merged
Ruari-Phipps merged 2 commits intomainfrom
ruari/fix/dont_delete_conditions_on_step_deletion
Apr 14, 2026
Merged

fix: don't delete or fail to update conditions when their parent step…#71
Ruari-Phipps merged 2 commits intomainfrom
ruari/fix/dont_delete_conditions_on_step_deletion

Conversation

@Ruari-Phipps
Copy link
Copy Markdown
Collaborator

@Ruari-Phipps Ruari-Phipps commented Apr 10, 2026

Summary

Fixes two bugs in _clean_resources_before_push that caused push failures when a flow step with conditions was deleted.

Motivation

When a FlowStep is deleted, Agent Studio automatically deletes its child Conditions server-side. This caused two issues:

  1. Explicitly including the condition in deleted_resources would result in a double-delete error.
  2. If a condition was also being updated (e.g. re-pointed to a new step), the update request would fail because the platform had already deleted the condition when the step was removed.

Changes

  • Strip conditions from deleted_resources when their parent FlowStep is being deleted (platform handles the cascade)
  • Promote affected conditions from updated_resources to new_resources when their original child_step is being deleted in the same push

Test strategy

  • Added/updated unit tests
  • Manual CLI testing (poly <command>)
  • Tested against a live Agent Studio project
  • N/A (docs, config, or trivial change)

Checklist

  • ruff check . and ruff format --check . pass
  • pytest passes
  • No breaking changes to the poly CLI interface (or migration path documented)
  • Commit messages follow conventional commits

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
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

Fixes push-time cleanup logic for Flow conditions when FlowSteps are deleted, preventing double-delete and invalid update operations caused by server-side cascade deletes.

Changes:

  • Adjust _clean_resources_before_push to remove Conditions from deleted_resources when their parent FlowStep is deleted.
  • Promote certain Condition updates to creates when their original child_step is deleted in the same push.
  • Add unit tests covering both scenarios; update delete prioritization to delete Conditions before Steps.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/poly/project.py Updates pre-push resource cleanup to avoid double-deletes and convert invalid condition-updates into creates.
src/poly/handlers/sync_client.py Prioritizes deleting Condition resources earlier in the delete queue.
src/poly/tests/project_test.py Adds unit tests for the two fixed push-cleanup edge cases involving deleted steps/conditions.

Comment thread src/poly/project.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Base (main) PR Change
71.5% 71.6% +0.1% ✅

Changed file coverage

File Coverage Change
poly/project.py 67.0% +0.4% ✅

@Ruari-Phipps Ruari-Phipps merged commit 85c6aea into main Apr 14, 2026
3 checks passed
@Ruari-Phipps Ruari-Phipps deleted the ruari/fix/dont_delete_conditions_on_step_deletion branch April 14, 2026 13:44
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