mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
* test(cloudformation): pin UpdateStack over AWS::Pipes::Pipe An unchanged pipe name must update the pipe instead of calling createPipe again, a changed Source is refused as replacement worthy, and a rename creates the replacement before deleting the original. The three existing PipesCfnProvisioner cases move out of LeafCfnProvisionerTest so the class has one test file. * fix(cloudformation): reconcile AWS::Pipes::Pipe on UpdateStack provision() re-runs for every resource on every UpdateStack, so a pipe already on file under the same name went back through createPipe and the stack rolled back with ConflictException. It is now updated in place from the prior physical id. A changed Source is create-only on the resource and is refused with a ValidationError instead of replacing the pipe, and a rename creates the replacement before deleting the original. * test(cloudformation): delete the pipe update stack at the end of its case The pipe survived the case in the shared emulator, and PipesIntegrationTest listPipes counts pipes globally, so it saw three where it expects two. The case now deletes its stack and asserts the pipe is gone. * test(cloudformation): pin the pipe update path on tags, Source and failed lookups A rename whose deletePipe throws still completes, a describePipe error that is not the not-found one propagates unchanged, an absent or blank Source reports the required property fault the create path reports, and the tags the template declares reach the pipe on a same name update. * fix(cloudformation): reconcile pipe tags and report the real fault on update Four defects on the pipe update path. A rename whose deletePipe failed propagated after the replacement was already created, orphaning it with no stack resource pointing at it; that cleanup is now best effort and logged, as it is for AWS::Kinesis::Stream. A describePipe failure that was not the not-found one fell into the create arm and surfaced as ConflictException, hiding the real error. A template with no Source was diagnosed as a replacement worthy Source change instead of the missing required property the create path reports. Tags declared in the template went stale, since nothing reconciled them; they now travel through the TagHandler calls PipesService already exposes. * fix(cloudformation): restore the pipe when a failed update rolls back updatePipe lands before the tag calls it cannot carry, so a listTags, untagResource or tagResource that failed left the pipe holding the new configuration under tags that were neither the old nor the new set, and the stack rolled back without putting it back. CloudFormation restores every resource an update touched, so the pipe now snapshots what it carries before its first mutating call and restores from that snapshot. The snapshot holds the properties updatePipe accepts plus the tags and the region; Name, Source and Arn are create-only or derived. It describes the update in flight: provision drops the one an earlier update left behind before it decides whether it mutates the pipe at all. CfnResourceProvisioner gains a rollbackUpdate hook that answers false by default, and CloudFormationResourceProvisioner delegates to the provisioner registered for the resource type before its own Step Functions arm, so a pipe owns its rollback instead of adding a branch to that class. * test(cloudformation): pin the pipe rollback on the properties the failed update added * fix(pipes): clear the properties a failed update added when the pipe is restored The rollback path now writes the snapshotted configuration in full through restorePipe, while updatePipe keeps the UpdatePipe contract of leaving an unset property alone. * test(pipes): pin both meanings an unset property carries on the pipe writers * test(cloudformation): pin the pipe rename cleanup on the committed update cleanup path * fix(cloudformation): delete the pipe a rename displaces on the committed update cleanup The pipe left under the prior name was deleted inside provision, with any failure swallowed at warn. It now travels the same update cleanup path every replaced resource takes: three attempts after the stack update commits, DELETE_IN_PROGRESS then DELETE_COMPLETE or DELETE_FAILED, and an orphan named in the stack's UPDATE_COMPLETE status reason. CfnResourceProvisioner gains the updateCleanupPhysicalId, completeUpdate, hasReplacementUpdate and clearUpdate hooks beside rollbackUpdate, and the four methods on CloudFormationResourceProvisioner ask the registry before falling through to the Step Functions arm. UpdateCleanupResult moves to the provisioners package so an extracted provisioner can return one. * test(cloudformation): pin the cleanup-in-progress status a pipe rename puts the stack in * test(cloudformation): pin the pipe rename rollback of a failed stack update An update that renames a pipe and fails at a later resource must end with the stack resource pointing at the prior pipe, the replacement gone and no resource reported as UPDATE_FAILED. The guard case pins the refusal: a pipe standing under the replacement's name that this update did not create is not deleted. * fix(cloudformation): roll back a pipe rename to the pipe it displaced A rename replaces the pipe, and an update that fails at a later resource never commits that replacement. The prior pipe is still on file, since the rename only records it for the committed cleanup, so rollbackUpdate points the stack resource and its Arn attribute back at it, deletes the replacement, and spends the rename record: a rollback owes no committed cleanup, and a stale record would delete the pipe the rollback just restored. The pipe about to be deleted is identified by the creation time recorded when this update created it, which the rename record now carries beside the displaced name. Any other pipe standing under that name belongs to somebody else, so the rollback refuses and leaves both pipes in place rather than guess. UpdateReplacePolicy Retain does not reach that delete: it governs the pipe a committed replacement displaces, which this path keeps by making it the resource's physical id again, while the replacement is a resource this update created. * test(cloudformation): pin the pipe restore a failed tag reconciliation owes A tag call that fails after updatePipe has written the pipe leaves it carrying the update the stack disowns. One test pins the pipe coming back to its prior description and tags with the stack reporting UPDATE_ROLLBACK_COMPLETE, the other pins UPDATE_ROLLBACK_FAILED naming the pipe when the restore fails too. * fix(cloudformation): restore a pipe eagerly when its own update fails updateExistingPipe writes the pipe through updatePipe and then through the tag calls, so a failure among them left the pipe carrying the update the stack was about to disown: the snapshot that would undo it rides on the provisioner's own copy of the resource, which the service discards when it puts the previous resource back, and the restored marker it then sets short-circuits the rollback hook. The reconcile-in-place path now honours the contract the rename path already did and restores from that snapshot inside provision, spending it there, while the failure that interrupted the update is what reaches the caller. A restore that fails leaves the pipe in a configuration nobody recorded, so its reason goes on the resource under the rollback-failure marker and the stack lands on UPDATE_ROLLBACK_FAILED naming the pipe instead of reporting a clean rollback; the restore failure travels with the original as suppressed. The rollback hook keeps the case it was written for, a failure at a later resource, where this pipe's update committed and its snapshot is still unspent. * test(cloudformation): pin the displaced pipe an interrupted rename cleanup leaves behind A cleanup phase that stops before it deletes the pipe a rename displaced leaves the stack in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS with the pipe alive. The next update owes that deletion, and the pipe is gone by the time the stack reports UPDATE_COMPLETE. * fix(cloudformation): finish an interrupted cleanup before the next update runs The cleanup phase of a committed update marks the stack UPDATE_COMPLETE_CLEANUP_IN_PROGRESS and persists it before any delete runs, so a phase that stops halfway leaves the marker on the resource with the displaced entity still alive. Provisioning drops that marker as its first act, and neither the update nor a later DeleteStack names the displaced entity again, so it leaks. An update now finishes that pending cleanup before it parses the template: a marker present at entry belongs to a phase that never ended, since a phase that finishes clears it and so does a rollback. Whatever the resumed cleanup cannot delete joins this update's own cleanup failures in the UPDATE_COMPLETE status reason. * test(cloudformation): pin the orphan a resumed cleanup gives up on The update that resumes an interrupted cleanup reports what that cleanup could not delete. A resumed deletion that fails all three attempts leaves the stack UPDATE_COMPLETE naming the pipe in the status reason, with a DELETE_FAILED event carrying the failure. * test(cloudformation): pin the prior pipe a rollback keeps when the replacement delete fails * fix(cloudformation): keep the prior pipe when a rename rollback cannot delete the replacement The rollback pointed the resource at the prior pipe only after deleting the replacement, so a delete that failed left the resource naming the replacement with the rename cleanup still recorded. The next update read that cleanup and deleted the prior pipe, which is the pipe the rollback existed to preserve, and reported UPDATE_COMPLETE with no status reason. The resource now names the prior pipe and spends the cleanup before the delete is attempted, and the replacement name travels into the delete as a parameter rather than being read off the resource. The failure still propagates and the stack still lands UPDATE_ROLLBACK_FAILED naming the resource; what is left orphaned is the replacement the failed update created. * test(cloudformation): pin the refusal of an update while an interrupted cleanup owns the stack A status ending in _IN_PROGRESS says an operation owns the stack, so UpdateStack and CreateChangeSet are refused with a ValidationError naming the stack and that status, and DeleteStack is the escape that removes the displaced pipe as well as the current one. * fix(cloudformation): refuse an update while an operation owns the stack An update no longer picks up the cleanup phase an earlier update abandoned. That phase ran inside the new update's transaction, so every non-happy exit of the new update had to account for a failure it did not cause. A status ending in _IN_PROGRESS is a precondition instead: it says an operation owns the stack, and UpdateStack and CreateChangeSet are refused with a ValidationError naming the stack and that status. Nothing finishes an abandoned phase. DeleteStack stays allowed in every status, since it is now the only way out of one, and it deletes whatever the resource's pending cleanup names as well as the physical id the resource carries. That reaches every resource type, not just the one that surfaced it. * test(cloudformation): pin the refusal message CloudFormation itself emits The refusal was asserted in this project's own bracket wording, which no real client ever receives. An emulator is matched against by tooling that reads the message, so the assertion now carries the string CloudFormation emits verbatim: the stack id in Stack:<arn> form, the status, and 'state and can not be updated.' with its own spelling and trailing period. * fix(cloudformation): emit the refusal in CloudFormation's own wording The refusal named the stack in this project's bracket idiom. Real CloudFormation names it as Stack:<stack id arn> and ends the sentence with 'state and can not be updated.', which is what a client matching on the message expects to read, so the emulator emits that. --------- Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>