mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 15:49:33 -05:00
Moves the last CloudFront type out of the monolith switch and into the provisioner that already owns the four configuration types a distribution references by id. Monolith 4,702 to 4,521 lines, legacy types 29 to 28. No new class: the type joins an existing provisioner that already injects CloudFrontService and is already wired into CfnProvisionerFixture. Nine private helpers move with it, every one exclusive to the distribution: cfnOrigins, cfnDefaultCacheBehavior, cfnCacheBehaviors, cfnCustomErrorResponses, putIfPresent, cfnStringList, cfnText, cfnTextOrDefault and cfnBool. cfnText shows 21 references in the monolith and looks shared until each is resolved to its enclosing method: they are all CloudFront. All nine are carried over byte for byte. The provision method itself changes in exactly two places. It takes a ProvisionContext rather than a bare engine, and it decides create versus update from ctx.isUpdate() and ctx.priorPhysicalId() rather than reading the physical id off the resource, which is what AGENTS.md asks for because provision assigns the new id as it runs. The two are the same value on the same call: the engine sets resource.setPhysicalId(existingPhysicalId) and passes that same variable into the context. Delete keeps the monolith's behaviour. removeDistribution is the stack-level delete, with no disable or If-Match guard, and it tolerates an id that is already gone, so unlike the policy arms beside it there is no not-found code to list. Also deletes blankToNull, which #3582 left behind with no caller. It had 9 references before that PR and 1 after, its own definition. Tests: three cases added to the existing CloudFrontCfnProvisionerTest covering create with the exact Fn::GetAtt keys, an in-place update under the prior id, and the stack-level delete. servesTheFourConfigTypes pinned the served set at four types and is renamed and widened to five, which is the assertion doing its job rather than an inconvenience. Registration is proved rather than assumed: removing the type from resourceTypes(), which is what a missed registration looks like, fails both CfnResourceInventoryTest and the provisioner test. Without that, the dispatcher's stub arm reports CREATE_COMPLETE with a synthetic ARN and the suite stays green.