Repository navigation
fix(autoscale): scope the coverage check to the env, and drop the space-valued param - #778
Merged
Merged
Conversation
…ce-valued param Two defects, both found by actually deploying rather than by reading. ## 1. The coverage check warned about the wrong environment It matched orchestrators by NAME PREFIX and took whichever the API returned first. The moment staging's schedule was disabled, a user working in PRODUCTION saw:⚠️ the autoscale orchestrator spawn-autoscale-orchestrator-staging is deployed, but its schedule … is DISABLED about an environment they were not using, while production's schedule was healthy. A warning about the wrong thing is the #624 cry-wolf failure — reintroduced by the check written to prevent it, one commit after I described that risk. Now an EXACT match on AutoscaleFunctionName(env) for the --env being operated on. An absent result names the function it looked for as well as the region, so "not found" says what was missing instead of gesturing at a category. Verified both ways against the live account: production reports healthy, --env staging reports DISABLED. ## 2. ScheduleRate could not be passed inline, and that failed a deploy `--parameter-overrides` cannot carry a value containing a SPACE, and every valid EventBridge rate has one. Passing 'ScheduleRate=rate(1 minute)' failed the staging deploy with Parameter ScheduleExpression is not valid. (Service: EventBridge, 400) and rolled the stack back. The ttl-reaper Makefile documents this trap at length — "sam either rejects the line outright or, worse, silently falls through to another pattern and mis-keys every parameter" — and I passed a space-containing value inline anyway. It failed the better way of the two. Rollback verified COMPLETE rather than assumed: stack params back to the original two, rule still ENABLED at rate(1 minute), function Active, and neither SPAWN_VERSION nor the spawn:version tag present — so env and tags reverted too. ScheduleRate is no longer passed. The template default is correct, and the Makefile now says it must not be re-added without switching to a file:// params file. ## Also hardened while here - `--region $(REGION)` is now explicit on the deploy. Without it a wrong ambient region does not fail — it CREATES A SECOND STACK elsewhere while the real one sits untouched. - `EC2RoleArn` is passed explicitly. --parameter-overrides is not additive, so an omitted parameter resets to the template default; it was benign only because the live value and the default happen to agree, which is luck (#650). Deployed: staging ScheduleState=DISABLED, via a reviewed change set. Production untouched and still ENABLED, confirmed after.
Codecov Report❌ Patch coverage is
📢 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.
Two defects, both found by actually deploying rather than by reading.
1. The coverage check warned about the wrong environment
It matched orchestrators by name prefix and took whichever the API returned
first. The moment staging's schedule was disabled, a user working in
production saw:
…about an environment they weren't using, while production's schedule was
healthy. A warning about the wrong thing is the #624 cry-wolf failure —
reintroduced by the check written to prevent it, one commit after I described
that exact risk.
Now an exact match on
AutoscaleFunctionName(env)for the--envin use, and anabsent result names the function it looked for as well as the region.
Verified both ways live: production reports healthy;
--env stagingreportsDISABLED.
2.
ScheduleRatecan't be passed inline, and it failed a real deploy--parameter-overridescannot carry a value containing a space, and everyvalid EventBridge rate has one. Passing
'ScheduleRate=rate(1 minute)'failedthe staging deploy:
and rolled the stack back. The ttl-reaper Makefile documents this trap at
length — "sam either rejects the line outright or, worse, silently falls through
to another pattern and mis-keys every parameter" — and I passed one inline
anyway. It failed the better of the two ways.
Rollback verified complete, not assumed: stack parameters back to the
original two, rule still
ENABLEDatrate(1 minute), functionActive, andneither
SPAWN_VERSIONnor thespawn:versiontag present — so env and tagsreverted too.
ScheduleRateis no longer passed; the template default is correct, and theMakefile now says it must not be re-added without a
file://params file.Also hardened
--regionis now explicit on the deploy. Without it, a wrong ambient regiondoesn't fail — it creates a second stack elsewhere while the real one sits
untouched.
EC2RoleArnis passed explicitly.--parameter-overridesisn't additive,so an omitted parameter resets to the template default. It was benign only
because the live value and the default happen to agree — luck, not design
(lambda/ttl-reaper: 'make deploy' defaults would DISARM the live production reaper and silently drop its DNS/alarm config #650).
Deployed
Staging
ScheduleState=DISABLEDvia a reviewed change set (the rule changed onlyStateandTargets; the role change was Tags-only). Production untouched andstill ENABLED, confirmed after.