Files
floci/src/main/java
Hector Ventura 0f7df0fd19 refactor(cloudformation): move the AutoScaling types into a per-service provisioner (#3582)
Moves AWS::AutoScaling::AutoScalingGroup and AWS::AutoScaling::LaunchConfiguration out
of the monolith switch into AutoScalingGroupCfnProvisioner. Monolith 4,988 to 4,702
lines, legacy types 31 to 29. The monolith side of the diff is pure deletion: nothing
in it was edited, only removed.

autoScalingService was exclusive to these two types, so the field and its constructor
parameter leave with them. Seven private helpers leave too, having no caller left
behind: sameNameExistingResource, deleteRenamedResource, parseIntProp, resolveAsgTags,
resolveAsgTagPropagation, resolveMixedInstancesPolicy and parseOptionalInt. The first
three were shared with RDS until batch 7 took RDS out, which is why they could not move
before now.

Reading the name and the prior entity goes through ProvisionContext rather than a copied
helper: stablePhysicalName for the create-only name, reusesPriorEntity for the
update-versus-replace decision, and resolveOptional and resolveStringList for the
properties. That is behaviour-preserving because the engine sets the resource's physical
id and the context's priorPhysicalId from the same value on the same call.

Two gaps close with the move, each proved by a test that fails without it.

AWS::AutoScaling::AutoScalingGroup declares exactly one readOnlyProperty in the registry
schema, AutoScalingGroupARN, but the monolith recorded the ARN only under the key "Arn".
Fn::GetAtt for the documented name therefore resolved to the literal string
"LogicalId.AutoScalingGroupARN" and the stack still reported CREATE_COMPLETE. Both keys
are now set: "Arn" stays because templates and an existing integration test read it.
AWS::AutoScaling::LaunchConfiguration declares no readOnlyProperties, so it adds no
attribute surface.

#3494 added DesiredCapacityType, CapacityRebalance, MaxInstanceLifetime and
DefaultInstanceWarmup to AutoScalingService but left the CloudFormation path passing
AsgOptionalFields.none(), noting in its own description that the wiring belonged in a
per-service provisioner rather than in the monolith. All four are registry schema
properties, so a template setting them was silently dropped. They are read now, and
absent stays null rather than false or zero, so an update overwrites only what the
template set, matching applyToExistingGroup and the Query handler.

Delete keeps the monolith's behaviour and does not wrap the calls in
CfnDeletes.safeDelete. AutoScalingService raises ValidationError at 28 sites and only one
of them means "not found", so tolerating that code would be the catch-all AGENTS.md rules
out, swallowing a real delete failure and reporting DELETE_COMPLETE over it.

Tests: 8 unit tests against a mocked service, plus the existing AutoScaling integration
test extended to assert the schema attribute and the four fields end to end. Reverting
each change makes the matching assertions fail, checked separately because RestAssured
stops at the first failed expectation and one would otherwise mask the other.
2026-09-13 19:43:42 -05:00
..