fix(application-autoscaling): persist state across restart; fix example compose healthcheck#1953
Merged
Merged
Conversation
…le compose healthcheck Bug-hunt 2026-06-25. - Application Auto Scaling state (scalable targets, scaling policies, scheduled actions, tags) was never persisted — ApplicationAutoScalingService had no snapshot store/hook, so everything vanished on restart in persistent mode while its direct-API siblings survived. Added the standard per-service snapshot pattern (mirroring wafv2): a versioned ApplicationAutoScalingSnapshot, with_snapshot_store / snapshot_hook / save_snapshot, a central save after any successful mutating action, and the load-on-boot + CFN-hook wiring in main.rs. The tuple-keyed state maps (TargetKey/PolicyKey/ScheduledKey) can't serialize as JSON object keys, so they round-trip through a map_as_pairs serde adapter (the tuple-key serde gotcha from the persistence sweep). - examples/docker-compose.yml healthcheck used `curl`, which the slim published image doesn't ship, so the example container reported unhealthy forever. Switched to the built-in `fakecloud healthcheck` probe (matching the root compose file). Added a round-trip test: RegisterScalableTarget writes a snapshot that deserializes back with the target present.
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.
Summary
Bug-hunt 2026-06-25.
ApplicationAutoScalingServicehad no snapshot store/hook, so everything vanished on restart in persistent mode while its direct-API siblings survived (it was added recently in test(tfacc): wire application-autoscaling + fix ECS service/cluster delete fidelity #1944 and missed the persistence sweep). Added the standard per-service snapshot pattern (mirroring wafv2): a versionedApplicationAutoScalingSnapshot,with_snapshot_store/snapshot_hook/save_snapshot, a central save after any successful mutating action, and load-on-boot + the CFN hook wiring inmain.rs. The tuple-keyed state maps (TargetKey/PolicyKey/ScheduledKey) can't serialize as JSON object keys, so they round-trip through amap_as_pairsserde adapter (the tuple-key serde gotcha from the persistence sweep).examples/docker-compose.ymlusedcurl, which the slim published image doesn't ship, so the example container reported unhealthy forever. Switched to the built-infakecloud healthcheckprobe (matching the root compose file).Test plan
RegisterScalableTargetwrites a snapshot that deserializes back with the target present (proves the tuple-key serde adapter + save path).cargo test -p fakecloud-application-autoscaling— 15 passed.cargo clippy -p fakecloud-application-autoscalingand-p fakecloud --bin fakecloudclean;cargo fmtapplied.Surface check
application-autoscaling/snapshot.jsonfollows the existing per-service layout; schema versioned (v1) with forward-compat guard, like the other services.ApplicationAutoScalingAccounts/AccountStategainedClone+ themap_as_pairsserde adapter; backward-compatible (new on-disk file only written in persistent mode).Summary by cubic
Persist Application Auto Scaling state across restarts and fix the example compose healthcheck so containers report healthy. This prevents state loss for scalable targets, policies, schedules, and tags in persistent mode.
Bug Fixes
fakecloud-application-autoscalingstate using a versioned snapshot (v1); save after successful mutating actions and load on boot fromapplication-autoscaling/snapshot.json(tuple-key maps serialize viamap_as_pairs).fakecloud-serverso CFN-triggered saves also persist.examples/docker-compose.ymlhealthcheck to usefakecloud healthcheckinstead ofcurl.Dependencies
fakecloud-persistencetofakecloud-application-autoscaling.Written for commit f654b11. Summary will update on new commits.