Repository navigation
fix(#756): render ECS responses from the published shape - #1309
Merged
Merged
Conversation
All four ECS records were answered to the caller as stored, so each of the thirteen operations that reports a cluster, task definition, service or task carried AccountID and Region unconditionally and ever_tagged once the resource had been tagged. API_Cluster, API_TaskDefinition, API_Service and API_Task publish none of the three. emulator/ecs_wire.go projects each record onto its published shape, on the pattern ecr_wire.go established (#1090). Twelve baseline lines discharged: 272 still reachable to 260. Deciding a response's membership surfaced two members AWS does not publish on the shape substrate put them on, neither of which could be carried into a type holding only published members: ECSService.ClusterName, which API_Service has no member for, and ECSTaskDefinition.Tags, which API_TaskDefinition has none for either — Register and Describe publish task-definition tags as a top-level response element, and Deregister publishes none. DescribeTaskDefinition now reads `include` so the gate its reference states is honored. startedAt/stoppedAt were `,omitempty` on a struct type, where the option is inert, and a zero EpochSeconds marshals as null — so a running task reported "stoppedAt":null. The projection's two are pointers, which is available because the wire type is new and has no recorded encoding to preserve. The twelve fields stay on the records: a projection changes the response and leaves the state a replay reads back alone. A new test reads all four records out of state to pin that, since the tagging plugin reads EverTagged across the service boundary. Refs #756
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 1, 2026
Merged
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.
What
All four ECS records —
ECSCluster,ECSTaskDefinition,ECSServiceandECSTask— were handedto
ecsJSONResponseas stored, at every one of the thirteen sites that answers a resource. Soeach of those responses carried substrate's own
AccountIDandRegion(neither hasomitempty,so both were unconditional) and
ever_taggedonce the resource had been tagged.API_Cluster,API_TaskDefinition,API_ServiceandAPI_Taskpublish none of the three.New
emulator/ecs_wire.goprojects each record onto its published shape, on the patternecr_wire.goestablished (#1090) andefs_wire.gofollowed (#1304). Twelve baseline linesdischarged — the largest single block left on #756:
ECS is also the cheapest of the remaining services and the counter-example #1305 measures ACM,
Redshift Data and Firehose against:
RegisteredAtandCreatedAtare alreadyEpochSecondsinthe record, which is what all four operations' JSON protocol publishes, so nothing needed
converting.
Two members AWS does not publish on the shape substrate put them on
Projecting is where a response's membership is decided, so a member that is not on the published
shape cannot be carried into a type whose whole purpose is to hold only published members. Two had
to be resolved rather than copied, and both are invisible to the ratchet — neither is one of the
five bookkeeping names:
ECSService.ClusterName, renderedclusterName.API_ServicepublishesclusterArn; itsmember list has no
clusterNameentry. The field stays on the record —resolveClusterNamederives it from the request and the state key is built from it — and is absent from
ecsServiceOut. A caller wanting the name has the ARN, whose last segment is it.ECSTaskDefinition.Tags, renderedtagsinside thetaskDefinitionobject.API_TaskDefinitionhas notagsmember at all. Task-definition tags are published one levelup:
RegisterTaskDefinitionandDescribeTaskDefinitioneach publishtagsas a top-levelresponse element, a sibling of
taskDefinition, andDeregisterTaskDefinitionpublishes notags at all. So the member moved rather than went away. A consumer reading
taskDefinition.tagsoff a substrate response was reading a member the SDK's own decoder discards, because the shape
it decodes into has no field for it.
DescribeTaskDefinitiontherefore now readsinclude: "Determines whether to see the resourcetags for the task definition. If
TAGSis specified, the tags are included in the response. Ifthis field is omitted, tags aren't included in the response." Substrate read no
includebefore,because the tags were nested where the caller got them unconditionally; lifting them to the top
level without the gate would answer tags where AWS answers none.
RegisterTaskDefinitionhas noincludeparameter and always publishes the tags it was handed.DescribeClustersandDescribeServicescarry the same gate and still ignore it — left alonedeliberately.
Cluster.tagsandService.tagsare published members of their shapes, soreporting them unconditionally over-reports a real member, which is a different defect from
reporting one AWS does not have. #756 is the bookkeeping leak; that is its own, and it is recorded
in the table row rather than smoothed over.
A null-vs-absent divergence fixed for free
ECSTask.StartedAt/.StoppedAtare taggedstartedAt,omitempty/stoppedAt,omitemptyand neveromitted anything:
omitemptyhas no effect on a struct type, andEpochSeconds.MarshalJSONrenders the zero time as JSON
null. So a task that had not stopped reported"stoppedAt":null—a member
API_Taskomits when it has no value.ecsTaskOut's two are*EpochSeconds, which isavailable only because the wire type is new and has no recorded encoding to preserve;
ecr_wire.go's rule forbids retyping the record's field, not the projection's.What stays on the records
AccountID,RegionandEverTaggedstay inecs_types.go, untouched. The state keys alreadyscope by account and Region so nothing reads those two back, but a persisted member is not free to
remove —
ecr_wire.gostates the rule:json:"-"and retyping in place both change the format ofevery recorded run, because
MemoryStateManagersnapshots those bytes and a replay reads themback.
EverTaggedis read across a service boundary besides: theTaggingPlugin'secsNamespacearm writes it and its scans report it. So the twelve baseline lines stay and are discharged in
scripts/wire-bookkeeping-projected.txtinstead.ECSService.CreatedAtis the one field of the twelve already excluded from the baseline, becauseAPI_ServicepublishescreatedAtand the exclusion is per field rather than per struct. It isprojected here like any other published member — and
ecsServiceOut.CreatedAthad to join theexclusion map for the same reason
ecrRepositoryOut.CreatedAtis in it: a projection has to carryevery published member, so building one is what adds a line of that kind, and filing it as a leak
would point at deleting a member AWS does publish. The script's header says so, and its count of
excluded entries goes from twelve to thirteen.
Tests
emulator/ecs_wire_test.go, five tests, asserting on raw response bytes rather than a decodedstruct — a decode into a Go type is exactly the step that hides an extra member. One test per
record, cited from the projected file, plus the record-intact pin:
"AccountID","Region"or"ever_tagged".ever_taggedassertion is anchored. An,omitemptymember is absent whenever itsvalue is the zero one, so an absence assertion on a record that was never tagged passes on a
response that could not have carried the member — the vacuous assertion fix(#756): render EFS responses from the published shape #1304 shipped on EFS
before it was caught.
EverTaggedis stamped bytaggingStampRecordEverTagged(fix(tagging): GetResources reports untagged resources, which AWS omits #938) reachedfrom
ecsMergeRecordTags, so ECS's ownTagResourcesets it:ecsTagAndAnchortags theresource and proves through
ListTagsForResourcethat the tag landed before the absenceassertions run. The three create sites answer before anything can have tagged, and that is
stated at each rather than left to be noticed.
clusterNameabsent from all four service sites, anchored onclusterArnbeing present so abody that dropped the whole record could not pass by answering nothing.
Register, absent withoutinclude, top-level withinclude: ["TAGS"], none at all onDeregister, and never nested. Each body is decoded into ashape that separates the top-level element from the nested member, because a substring search for
"tags"cannot tell the published one from the unpublished one and the fix moves the member fromone to the other.
stoppedAtabsent while running, present once stopped — two-sided, so the omission provessomething.
TestECSWire_ProjectionLeavesTheRecordIntactreads all four records back out of state andasserts
AccountID,Regionandever_taggedare still persisted, which is the other half ofthe claim and what keeps the tagging plugin's cross-service read honest.
Negative control. The leaked members were temporarily reintroduced into all four wire structs,
plus
clusterNameonecsServiceOutand nestedTagsonecsTaskDefinitionOut. The run failed46 assertions across all thirteen sites — every bookkeeping site, both divergences, and the
nested-tags assertion on all four task-definition responses — then the file was restored.
Verification
make lint(0 issues),make test(race,-count=1), andmake docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-checkall green, with no baseline line added or removed.docs/services.mdrecords the three divergences per operation row and adds a paragraph on theprojection;
CHANGELOG.md→ Fixed.Refs #756