Skip to content

fix(schedule): invoke a sweep orchestrator that exists, in a region it is deployed to (#812) - #825

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/812-scheduler-orchestrator-name
Oct 11, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/812-scheduler-orchestrator-name

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #812

spawn schedule has never worked. The handler invoked
arn:…:function:sweep-orchestrator; the deployed function is
spawn-sweep-orchestrator.

Verified against the live account before changing anything

get-function-configuration --function-name sweep-orchestrator        -> DOES NOT EXIST
get-function-configuration --function-name spawn-sweep-orchestrator  -> exists
get-function-configuration --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 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-1 schedule failing
identically. 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-configuration is the answer rather than
a guess.

--environment replaces rather than merges. Deliberate: this script is the
source of truth for the function's configuration, and the live function had no
variables to displace. Documented inline, pointing at the
deploy-sweep-orchestrator.sh Variables={} incident the scripts gate exists
for.

The #790 gate missed this twice, and I wrote it

It required the identifier to end in Function and 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, 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, 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. Not done here; same shape as #797.

Verification

make check green 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).

…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).
@scttfrdmn scttfrdmn added this to the Correctness audit 2026-10 milestone Oct 11, 2026
@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 4602df8 into main Oct 11, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/812-scheduler-orchestrator-name branch October 11, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every scheduled sweep fails: scheduler-handler invokes sweep-orchestrator, but the function is spawn-sweep-orchestrator

1 participant