Repository navigation
Description
Found while deploying #752's fix to that Lambda.
What
spawn-pipeline-orchestrator is a live CloudFormation stack in the infra account
(UPDATE_COMPLETE, last updated 2026-01-30) managing four resources:
PipelineOrchestrationTable AWS::DynamoDB::Table
PipelineOrchestratorLogGroup AWS::Logs::LogGroup
PipelineOrchestratorFunction AWS::Lambda::Function (arm64, provided.al2023)
PipelineOrchestratorFunctionRole AWS::IAM::Role
There is no template for it anywhere in the repo. The only pipeline-ish YAML
is examples/workflow-ci-pipeline.yaml, which is an unrelated user-facing
example. So the infrastructure definition for a production Lambda, its IAM role
and its DynamoDB table exists only inside AWS.
Why it matters
- Unreviewable. No PR has ever shown a change to that role's permissions or
the table's configuration, because there is no file to diff. - Unreproducible. If the stack is deleted or the region is lost, the only
recovery path is reconstructing it fromdescribe-stacksoutput. - It nearly caused a silent revert. The template pins the function's
Code
to a fixed S3 object:AnS3Bucket: spawn-pipelines-us-east-1 S3Key: 0c1e7fa6cac480d1a5910327d6122446aws lambda update-function-code— the obvious way to ship a code fix, and
what the siblingspawn-sweep-orchestratorscript does — would have worked and
then been silently reverted by the next CFN update of this stack. I only
avoided that because the role name looked CloudFormation-generated and I
checked.
I deployed #752's fix by retrieving the live template, swapping the S3Key, and
executing a change set that showed exactly one in-place Modify touching only
Code. Drift detection afterwards: IN_SYNC, 0 drifted resources. That is the
right method, but it should not require pulling the template out of AWS each time.
Related
This is the same class as spawn-sweep-orchestrator, which has no stack at
all — a hand-deployed Lambda whose only record is
scripts/deploy-sweep-orchestrator.sh. #731 hardened that script (account
assertion, no env wipe, CodeSha256 verification) but the function remains
undeclared infrastructure. Both are instances of the "leave no trace" note's
second open subject: nothing reaps the lambdas, their roles, or their tables,
partly because nothing declares them either.
Suggested fix
- Commit the template.
aws cloudformation get-templatereturns the
processed CFN, which is deployable as-is — good enough to version-control
today, and honest about being a capture rather than hand-written SAM. - Add a deploy script matching
scripts/deploy-sweep-orchestrator.sh's
post-fix(scripts): make the hand-written Lambda deploys safe and verifiable #731 discipline — assert the account, never passVariables={}(this
function carriesENVIRONMENTandSPAWN_PIPELINE_ORCHESTRATION_TABLE, so a
wipe would break it), build arm64 (its sibling is x86_64 — easy to get
wrong), upload under a dated key, and update via change set rather than
update-function-code. - Consider a gate: a test asserting every Lambda directory under
lambda/
has either a committed template or a committed deploy script. There are 12
nested modules and at least two have neither.
(3) is the durable part. The first two fix these two functions; the gate stops
the next one shipping undeclared.
Activity
scttfrdmn commentedon Oct 8, 2026
Correction: the template is in the repo. The real bug is three Makefile targets that name a function that does not exist.
I filed this and the central claim is wrong. Verified today:
lambda/pipeline-orchestrator/template.yaml(157 lines) is a SAM template(
Transform: AWS::Serverless-2016-10-31) and it defines every live resource:PipelineOrchestrationTableAWS::DynamoDB::Table, same logical IDPipelineOrchestratorLogGroupAWS::Logs::LogGroup, same logical IDPipelineOrchestratorFunctionAWS::Serverless::Function, same logical IDPipelineOrchestratorFunctionRolePolicies:The role match is exact, not approximate: the live role carries
PipelineOrchestratorFunctionRolePolicy0…Policy6— SAM's generated naming —and the repo template has exactly 7
Policies:entries. It has no explicitRoleName(CFN-generated), soCAPABILITY_IAMis sufficient and theCAPABILITY_NAMED_IAMrecorded on the stack is surplus, not a requirement.There is also a deploy path —
lambda/pipeline-orchestrator/Makefile:So "unreviewable" and "unreproducible" are both false. My search missed it
because nothing in the path or filename says pipeline except the directory,
and I grepped for pipeline-ish YAML.
What is actually broken
Three targets name
spawn-pipeline-orchestrator-production, which does not exist.The template sets
FunctionName: spawn-pipeline-orchestrator— no suffix:Makefile:51update-code→aws lambda update-function-code --function-name spawn-pipeline-orchestrator-productionMakefile:56logs→aws logs tail /aws/lambda/spawn-pipeline-orchestrator-productionMakefile:61invoke-test→--function-name spawn-pipeline-orchestrator-productionVerified against the infra account:
list-functionsreturns onlyspawn-pipeline-orchestrator;get-function …-productionis aResourceNotFoundException; the only log group is/aws/lambda/spawn-pipeline-orchestrator. None of those three targets has everworked. The mistake is confined to this Makefile (
ttl-reaperandautoscale-orchestratorusedeploy-productionas a target name, which isunrelated).
This also corrects the "it nearly caused a silent revert" paragraph above. The
conclusion was right for the wrong reason:
make update-codewould not haveworked-then-been-reverted, it would have failed outright on the wrong name.
A correctly-named
update-function-codewould be reverted by the nextsam deploy, so the method I used was still the right one.Two smaller traps
packaged.yamlis committed, dated May 29, and was never packaged. It stillhas
TransformandAWS::Serverless::Functionand carries no S3 pin at all,so it is a stale copy of
template.yamlwearing the name of a deploy artifact.The
S3Bucket: spawn-pipelines-us-east-1/S3Key: 0c1e7fa6…I quoted in theissue body came from the live stack, not from this file.
The live stack's template is now the expanded form.
get-template --template-stage Originalreturns noTransformand an explicitAWS::Lambda::Function+AWS::IAM::Role— because my #752 deploy retrievedthe live template, swapped the
S3Key, and submitted that. The same deployreplaced SAM's content-hashed key with a hand-named one
(
pipeline-orchestrator-20261008082158.zip). Soget-templateand the repo nowdisagree in form, though not in substance.
Re-converging with
make deployshould be a no-op on resources — all fourlogical IDs are identical, so SAM re-expands onto the same ones with no
replacement — but that is a prediction, and this stack is production. It gets
proven with
sam deploy --no-execute-changesetand a read of the change setbefore anything executes.
Scope, revised
-productionfunction/log-group namespackaged.yaml(it is not an input to any target)commit the missing template— already presentStack snapshot for the record:
UPDATE_COMPLETE, last updated2026-10-08T15:22:39Z,
Environment=productionthe only parameter, no stack tags.scttfrdmn commentedon Oct 8, 2026
Correcting one claim in my comment above:
packaged.yamlwas genuinelysam packaged. I said it "carries no S3 pin at all" — it does:My grep looked for
S3Key/S3Bucket, which is the expanded form. A packagedSAM template keeps
AWS::Serverless::Functionand rewritesCodeUrito ans3://URL, so the pin was there and I looked for the wrong key.What survives: the file is from May 29, its object hash matches neither the
0c1e7fa6…in the issue body nor the key now live(
pipeline-orchestrator-20261008082158.zip), and nothing in the reporeferences it —
--resolve-s3meansmake deployrepackages every time. So itis a superseded build artifact that reads like an input, and removing it is still
the right call; my reason for it was just wrong.
The rest of the comment stands as verified.
fix(pipeline-orchestrator): three Makefile targets named a Lambda tha…
scttfrdmn commentedon Oct 8, 2026
Makefile fix merged in #762 (
4dc05f5): the three-productionnames now resolve tospawn-pipeline-orchestratorfrom a single definition,update-codewarns thatmake deployreverts it, and the stalepackaged.yamlis gone.Remaining, and the reason this stays open: the live stack still carries the expanded,
Transform-less template. Converging it back to the SAM form needs asam deploy --no-execute-changesetand a read of the change set before anything executes, because it is production. Expected result is zero resource changes — the four logical IDs are identical, so SAM re-expands onto the same resources — but that is a prediction, not a verification.scttfrdmn commentedon Oct 8, 2026
Converged. The live stack is SAM-form again, change-set reviewed.
Method:
sam deploy --no-execute-changeset→ read the change set → execute.The change set was not what I predicted
I said to expect zero resource changes. There were three — and the summary
table alone would have been misleading, because a
Metadata-scope modificationon a production DynamoDB table looks exactly like a dangerous one until you read
the scope:
PipelineOrchestrationTableMetadataonlyPipelineOrchestratorLogGroupMetadataonlyPipelineOrchestratorFunctionMetadata+Properties: CodeThe Metadata entries are SAM re-annotating resources with its own
SamResourceId— the signature of restoring the Transform. No table property was touched: no
billing mode, no key schema, no PITR.
Replacement: Falsethroughout.PipelineOrchestratorFunctionRoledoes not appear in the change set at all.That is the cleanest available proof that
template.yaml's 7Policies:entriesreproduce the deployed role exactly — the thing this issue claimed was
unreviewable because no file existed to diff.
Before → after
TransformTransform: AWS::Serverless-2016-10-31+AWS::Serverless::FunctionIN_SYNC, 0 driftedIN_SYNC, 0 driftedEnvironment=productionIAM+NAMED_IAMIAMyOhTwpzmumP5ENABLEDENABLED, original 2026-01-30 creation dateCodeSha AQnWWWKx…/ad06i8RU…,State: Active,LastUpdateStatus: SuccessfulCapabilities dropping
NAMED_IAMis expected and harmless — the role sets noexplicit
RoleName, soCAPABILITY_IAMis sufficient; the extra was surplusrecorded by an earlier deploy.
The deployed package was verified byte-for-byte, not assumed: downloaded via
get-function, one entry (bootstrap), sha256 identical to the local build.This also shipped #755, unavoidably
sam deployalways repackages, and the running code predated #755 — that commitlanded 16:30Z, the function's code was attached 15:22Z. So the convergence
necessarily carried #755's change to this Lambda, which is this:
Until now this Lambda created security groups and placement groups with no
spawn:managedtag, so the reaper was not permitted to touch them — its deletegrants are conditioned on that tag. It was an active source of uncollectable
orphans. Confirmed live in the deployed binary (
grep -a):spawn:created,spawn:managedandspawn:reaper-first-seenare all compiled in.Closing. The Makefile fix landed in #762;
make deployis now the documented andexercised path, and
get-templateand the repo agree again.feat(lambda): stamp the deployed version, and gate that every deploy …
feat(autoscale): make the reconciliation schedule a deploy-time param…