Repository navigation
fix(#995): the two Step Functions deletes are idempotent, and DELETING is admitted unreachable - #1069
Merged
Merged
Conversation
…G is admitted unreachable DeleteStateMachine and DeleteActivity refused an absent resource with StateMachineDoesNotExist / ActivityDoesNotExist. Both are real Step Functions codes, but API_DeleteStateMachine publishes exactly InvalidArn and ValidationException and API_DeleteActivity publishes InvalidArn alone. Substrate answered them because both handlers went through the same require* helper as their published siblings, so the code arrived with the lookup rather than by a decision. Both now parse the ARN, load directly, and answer 200 with an empty body when nothing is there. This is substrate's reading of an absent code, not a published guarantee, and weaker evidence than SNS's #992 where API_DeleteTopic states the property outright. The ARN parse stays ahead of the load, so idempotence licenses an ARN that names nothing and not a string that is not the right kind of ARN. StateMachineState.Status no longer claims DELETING. A tree-wide search for a writer found one, writing "ACTIVE". Nothing can write the other: the delete removes the record synchronously, so there is no observation between ACTIVE and gone for it to occupy, which also makes StateMachineDeleting/400 unreachable. Stated in the type, in docs/services.md and in a test asserting the emulator's actual answer. The shared ARN tables keep both operations, because three other tests still require both deletes to answer InvalidArn; the three anonymous structs collapse into a named sfnArnOpCall carrying an absentIsIdempotent column. Since a 200 no longer proves the delete declined to act, the tests assert the state instead. Closes #995
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
DeleteStateMachineandDeleteActivityrefused an ARN naming nothing withStateMachineDoesNotExist/ActivityDoesNotExist. Both are real Step Functions codes — published atDescribeStateMachine,UpdateStateMachine,StartExecution,StartSyncExecution,ListExecutionsandDescribeActivity— butAPI_DeleteStateMachinepublishes exactlyInvalidArnandValidationException, andAPI_DeleteActivitypublishesInvalidArnalone. Substrate answered them because both handlers went through the samerequire*helper as their published siblings, so the code arrived with the lookup rather than by a decision.Both now parse the ARN, load directly, and answer
200with an empty body when nothing is there.The evidence, stated at its actual strength
This is substrate's reading of an absent code, not a published guarantee, and weaker than SNS's #992 where
API_DeleteTopicstates the property outright. What carries it:DELETINGand begins the deletion process. A state machine is deleted only when all its executions are completed." A caller that has issued a delete and retries cannot distinguish "already gone" from "stillDELETING".The ARN parse stays ahead of the load in both handlers, so idempotence licenses an ARN that names nothing and not a string that is not the right kind of ARN. Every
InvalidArnrefusal is unchanged, and a test states that reason where the idempotence is.DELETINGis not modelled, and the type stops claiming itStateMachineState.Status' doc comment named bothACTIVEandDELETING, whichAPI_DescribeStateMachinepublishes. A tree-wide search for aStatus:writer in Step Functions finds exactly one, writing"ACTIVE". Nothing can write the other: the delete removes the record synchronously, so there is no observation betweenACTIVEand gone for aDELETINGto occupy — which also makesStateMachineDeleting/400 unreachable atUpdateStateMachine,StartExecutionandStartSyncExecution. A caller therefore cannot test a poll loop that waits for a delete to finish.Modelling the transition is in scope for substrate as a seedable progression, but it is separate work. The limitation is stated in the type, in
docs/services.md, and in a test that asserts the emulator's actual answer, so whoever models it later hits a failing assertion naming this decision rather than silently widening the enum.The ARN tables keep both operations
The issue asked for both deletes to be removed from
sfnArnStateMachineOpsandsfnArnActivityOps. That would have deleted live coverage — those tables drive three other tests in which both deletes still must answerInvalidArn(malformed shape, wrong resource type, version- or alias-qualified ARN). Only the absent-resource loop changes, so the three anonymous structs collapse into a namedsfnArnOpCallwith anabsentIsIdempotentcolumn and the operation inventory stays in one place. Explained in full on the issue, along with two line-drift corrections and the fact that neither page states idempotence.Because a
200on a foreign ARN no longer proves by its status that the delete declined to act, the tests assert the state instead: the caller's own same-named resources survive every cross-account and cross-Region delete, a repeated delete leaves the name index intact and a sibling untouched, andDescribestill refuses — only the delete is idempotent.Verification
gofmt,go build,go vet,golangci-lint run ./...(0 issues), the race suite on both toolchains, the docs reference and authz checks,npm --prefix docs run build, the e2e module, andscripts/check-discarded-unmarshal.shall pass. Coverage: 85.4% emulator / 84.9% total, above the 85.1%/84.6% floor.Closes #995