Repository navigation
fix(schedule): invoke a sweep orchestrator that exists, in a region it is deployed to (#812) - #825
Merged
Merged
Conversation
…t is deployed to (#812) `spawn schedule` has never worked. lambda/scheduler-handler invoked arn:...:function:sweep-orchestrator; the deployed function is spawn-sweep-orchestrator. Verified against the live account before changing anything: aws lambda get-function-configuration --function-name sweep-orchestrator -> DOES NOT EXIST ... --function-name spawn-sweep-orchestrator -> spawn-sweep-orchestrator ... --function-name scheduler-handler --query Environment.Variables -> (empty — nothing overrode the compiled-in default) Consistent with all three spawn-schedules-* buckets measuring 0 objects: no schedule has ever run far enough to stage its parameters. This is #790's mirror image — a MISSING prefix rather than an extra one. ## A second bug was hiding behind the first The invoke ARN interpolated schedule.Region — the region the sweep's INSTANCES go to — while the orchestrator is deployed once, in the infra account's us-east-1. Fixing only the name would have left every non-us-east-1 schedule failing identically. The region is now its own setting (SPAWN_ORCHESTRATOR_REGION), not derived from the schedule. ## The deploy script set no environment at all So the deployed configuration came entirely from compiled-in defaults, which cannot be read back from AWS — making skew between the repo and the live function invisible. It now sets both values explicitly, so `get-function-configuration` is the answer rather than a guess. --environment REPLACES rather than merges. Deliberate: this script is meant to be the source of truth for the function's configuration, and the live function had no variables to displace. Documented inline, with a pointer to the deploy-sweep-orchestrator.sh `Variables={}` incident that the scripts gate exists for. ## The #790 gate missed this twice, and I wrote it It required the identifier to end in `Function` and required a literal after `:function:`. Both describe how I happened to spell the constants in pkg/infrastructure, not the property being gated — defaultOrchestratorFuncName ends in FuncName, and the name reaches AWS through `:function:%s` from a variable. Demonstrated rather than asserted, against the shipped bug: old regex matches: False new regex matches: True ## The widened pattern needed its own gate Matching any identifier containing Func/Function/FuncName is deliberately loose, and I justified that with a measurement — five such identifiers repo-wide, all genuine Lambda names. A measurement nothing re-checks is rule 4's hand-maintained list one level up. So TestEveryLambdaNamingIdentifierIsChecked pins the population with each expected value. A sixth fails with instructions to NARROW THE PATTERN rather than grow the list, because a false positive means the pattern is wrong, not that the list is short. Verified by planting `handlerFunctionName = "index-handler"`: both gates fire. ## Scope of the claim This makes the handler invoke a function that exists, in a region it is deployed to. Whether a given account's schedules then run end to end also depends on #804 (the write side resolves the schedules bucket and the read side reconstructs it from a template). In the infra account, which owns spawn-schedules-us-east-1, the preferred name is used and #804 does not bite; in a fallback account it still would. Needs a Lambda deploy to take effect — production stays broken until scripts/deploy-scheduler-handler.sh runs. make check green across all 9 nested modules, check-docs, census, changelog, semgrep 0 findings, Tier 0 e2e with -count=1 (68s).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 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.
Closes #812
spawn schedulehas never worked. The handler invokedarn:…:function:sweep-orchestrator; the deployed function isspawn-sweep-orchestrator.Verified against the live account before changing anything
Nothing overrode the compiled-in default. Consistent with all three
spawn-schedules-*buckets measuring 0 objects — no schedule has ever run farenough to stage its parameters. This is #790's mirror image: a missing prefix
rather than an extra one.
A second bug was hiding behind the first
The ARN interpolated
schedule.Region— where the sweep's instances go —while the orchestrator is deployed once, in the infra account's
us-east-1.Fixing only the name would have left every non-
us-east-1schedule failingidentically. The region is now its own setting, not derived from the schedule.
The deploy script set no environment at all
So the deployed configuration came entirely from compiled-in defaults, which
cannot be read back from AWS — making repo-vs-live skew invisible. It now sets
both values explicitly, so
get-function-configurationis the answer rather thana guess.
--environmentreplaces rather than merges. Deliberate: this script is thesource of truth for the function's configuration, and the live function had no
variables to displace. Documented inline, pointing at the
deploy-sweep-orchestrator.shVariables={}incident the scripts gate existsfor.
The #790 gate missed this twice, and I wrote it
It required the identifier to end in
Functionand a literal after:function:. Both describe how I happened to spell the constants inpkg/infrastructure, not the property being gated —defaultOrchestratorFuncNameends inFuncName, and the name reaches AWSthrough
:function:%sfrom a variable.Demonstrated rather than asserted, against the shipped bug:
The widened pattern needed its own gate
Matching any identifier containing
Func/Function/FuncNameis deliberatelyloose, and I justified that with a measurement — five such identifiers repo-wide,
all genuine Lambda names. A measurement nothing re-checks is rule 4's
hand-maintained list one level up.
So
TestEveryLambdaNamingIdentifierIsCheckedpins the population with eachexpected value. A sixth fails with instructions to narrow the pattern rather
than grow the list, because a false positive means the pattern is wrong, not
that the list is short. Verified by planting
handlerFunctionName = "index-handler": both gates fire.Scope of the claim, stated precisely
This makes the handler invoke a function that exists, in a region it is
deployed to. Whether a given account's schedules then run end-to-end also
depends on #804 — the write side resolves the schedules bucket (falling back
to an account-scoped name) while the read side reconstructs the shared name from
a template. In the infra account, which owns
spawn-schedules-us-east-1, thepreferred name is used and #804 does not bite; in a fallback account it still
would.
Needs a Lambda deploy to take effect — production stays broken until
scripts/deploy-scheduler-handler.shruns. Not done here; same shape as #797.Verification
make checkgreen across all 9 nested modules,check-docs, the deploy census,the changelog gate,
semgrep(0 findings), and the full Tier 0 e2e with-count=1(68s).