feat(ecs): Batch 3 — services with rolling deployments#724
Merged
vieiralucas merged 2 commits intomainfrom Apr 24, 2026
Merged
Conversation
- CreateService spawns tasks to match desiredCount, tagging each with
`startedBy=ecs-svc/<name>` so the tasks reconcile back to the service
for later scale/drain.
- UpdateService supports two independent mutations:
* Scale: new desiredCount spawns additional tasks or flips excess
tasks to `desiredStatus=STOPPED` and SIGTERMs them via the runtime.
* Rolling deployment: new taskDefinition marks the previous PRIMARY
deployment as ACTIVE, creates a new PRIMARY, and drains tasks on
the old revision while new ones come up. Deployment circuit
breaker + minimumHealthyPercent/maximumPercent are honoured.
- DeleteService refuses while desiredCount>0 unless force=true; the
forced path scales to 0 and stops every running task under the
service before removing it.
- DescribeServices derives runningCount/pendingCount from live task
state on each read so scale/drain are reflected immediately.
- ListServices + ListServicesByNamespace with cluster/launchType/
schedulingStrategy filters.
- Snapshot schema bumped to v3 to persist services.
- Conformance tests for all 6 new actions with live checksums.
- E2E scenarios for create/describe/list, scale up + down, rolling
deployment with a new task definition, and force-delete behavior.
- Website + README updated with services section + new op count.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-ecs/src/service.rs">
<violation number="1" location="crates/fakecloud-ecs/src/service.rs:2195">
P1: Rolling deployment over-spawns tasks when combined with scale-down. `stop.len()` counts tasks stopped for both scaling *and* TD-drain, so new-task spawns exceed `effective_desired`. Use `effective_desired` as the target instead of `stop.len()`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
… overlap Addresses Cubic P1 on PR #724. When UpdateService mutated both desiredCount (down) and taskDefinition in the same call, the rolling deployment code used `stop.len()` as the replacement target — which conflated scale-down stops with TD-drain stops and ended up spawning more tasks than the new desiredCount. Key the replacement count off `effective_desired - kept_on_new_td - already_spawned` instead so the post-deploy count matches intent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Batch 3 of the ECS rollout. Adds the full services surface on top of the Batch 2 task execution: `CreateService`, `UpdateService`, `DeleteService`, `DescribeServices`, `ListServices`, `ListServicesByNamespace` with desired-count enforcement and rolling deployments.
Highlights:
Deferred to Batch 4: task sets (EXTERNAL deployment controller), container instances, capacity providers, task protection, `ExecuteCommand`, EventBridge state-change events.
Test plan
Summary by cubic
Adds ECS services with rolling deployments on top of task execution, with desired-count enforcement and live running/pending counts. Also fixes an over-spawn issue when scaling down during a rolling deployment. Snapshot schema bumped to v3.
New Features
CreateService,UpdateService,DeleteService,DescribeServices,ListServices,ListServicesByNamespace.desiredStatus=STOPPEDand SIGTERMs via the runtime.taskDefinitioncreates a new PRIMARY, marks the previous PRIMARY ACTIVE, and drains old tasks; honorsminimumHealthyPercent,maximumPercent, and the deployment circuit breaker.startedBy=ecs-svc/<name>;DescribeServicesderivesrunningCount/pendingCountfrom live tasks;ListServicessupports cluster/launchType/schedulingStrategy filters.Bug Fixes
UpdateServicewhen scaling down and changingtaskDefinitionin the same call by computing replacements from the effective desired count (not from the total stop set).Written for commit f7995e3. Summary will update on new commits.