You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tagging: the four merge helpers store a resource's tags in Go map order, so one state hashes two ways #862
Surfaced while auditing the tagging writer for #845 and fixed in the same PR (#851). Filed for the record: it is the kind of nondeterminism an event-sourced emulator cannot carry, and it was invisible because nothing compared state it had not changed.
What substrate did
All four slice-returning merge helpers in mergeResourceTags — EC2, IAM, ECS and EFS — built their result by ranging over a Go map. Map iteration order is randomised per run, so two identical runs stored one resource's tags in different orders.
Three consequences:
ListTagsForResource, DescribeTags and GetResources reported a different order each run for the same state. Nothing in substrate asserted on order, which is why no test caught it.
A hash over the stored record differed when nothing about the record had changed.
(2) is the one that matters here. Substrate's whole proposition is that the same inputs give the same outputs and that a failing run replays exactly — which requires being able to compare state a replay did not change and find it equal. A record whose byte content depends on map iteration order breaks that for every resource that carries a tag. Replay bypasses authorization, quota, consistency and fault injection #833's ValidateState work, in this same release, is what would have started reporting it as a spurious difference on every event.
All four helpers sort by key, which is the answer DescribeStacks already gives for a stack's own tags.
Closed as shipped. See #851 and the ## [Unreleased] entry in CHANGELOG.md. The remaining ordering nondeterminism of the same shape is not fixed and is much larger: MemoryStateManager.List returns Go map order with no sort, across 118 state.List( call sites in 41 files of which only 11 contain any sort. call — so two identical ListBuckets requests in one run can differ. That belongs with #817, whose analysis records it.
Shipped in #851 (v0.115.0). Closing as filed-and-fixed; the analysis above is the record, including the much larger MemoryStateManager.List ordering problem that is not fixed and belongs with #817.
Activity
scttfrdmn commentedon Sep 14, 2026
Shipped in #851 (v0.115.0). Closing as filed-and-fixed; the analysis above is the record, including the much larger
MemoryStateManager.Listordering problem that is not fixed and belongs with #817.fix(state): a listing's order comes from the state, not from Go's map…
fix(kms): a KeyId resolves from its own ARN, and the tagging API reac…
fix(sns): a TopicArn resolves to the topic its own ARN names (#925) (#…
fix(secretsmanager): a SecretId resolves to the secret its own ARN na…
fix(ssm): a tag call resolves to the resource type it names (#932) (#934
feat(tagging): GetResources reports an ECS service, task and task def…
fix(ecr): tags is an array of Tag objects, not a map (#1017) (#1056)