Repository navigation
Description
Found by actually running lambda/dashboard-api/deploy.sh for #797.
The scope gap
Both deploy gates are scoped to one directory:
| gate | scope | source |
|---|---|---|
TestDeployScriptsAssertTheAccount / region check |
os.ReadDir(".") from the scripts module |
scripts/deploy_scripts_test.go:150 |
spawn:version stamping + log retention |
for s in scripts/deploy-*.sh |
scripts/lambda-deploy-census.sh:73 |
Neither sees lambda/*/deploy.sh. There are deploy scripts in both places —
spawn-dashboard-api is created and updated only by
lambda/dashboard-api/deploy.sh — so a whole class of deploy script is
unguarded. This is the #136 bug shape a third time: a check scoped to the
directory where the author happened to be looking.
Three measured consequences
1. No spawn:version tag. Measured on the live function just now:
$ aws lambda list-tags --resource ...:function:spawn-dashboard-api
{ "spawn:managed": "true", "spawn:purpose": "dashboard-api" }
The script sets tags only on create, never on update, and never stamps a
version. So #768's premise — "every operated deploy path stamps spawn:version,
so skew between the CLI and the control plane is readable in one API call" — is
false for this function, and the census gate cannot say so because it does
not look here.
2. A race that half-fails. The script calls update-function-configuration
immediately after update-function-code with no wait:
→ Updating existing Lambda function...
✓ Function code updated
→ Updating function configuration...
aws: [ERROR]: ResourceConflictException: The operation cannot be performed at
this time. An update is in progress for resource: ...spawn-dashboard-api
Exit 254. The code update did land; the configuration update did not. It is
benign here only by luck — the script's hardcoded --timeout 30 --memory-size 512 already matched the live values, so nothing drifted. On a function whose
timeout had been raised in the console, the deploy would silently leave the code
updated and the configuration not, with a non-zero exit that looks like total
failure. Needs aws lambda wait function-updated between the two calls.
3. set -e skips its own cleanup. The failure above exited before
rm -f bootstrap function.zip, leaving a 20 MB binary and a 6.6 MB zip in
lambda/dashboard-api/. Both are gitignored, so this is untidy rather than
dangerous — but it means the script cannot be trusted to clean up after the
failure mode it most often hits. A trap ... EXIT would.
Also worth noting
The script hardcodes --timeout 30 --memory-size 512 on every update, which is
the #650 shape: a deploy that asserts values from a script default rather than
reading the live ones. Today they match. Nothing guarantees they will.
Suggested
- Widen both gates to discover deploy scripts anywhere in the tree rather than
in one directory —find . -name 'deploy*.sh', failing when discovery finds
none, perscripts/nested-modules.sh. - Fix the three defects above in
lambda/dashboard-api/deploy.sh, then let the
widened gates confirm there are no others. There are at least
lambda/dashboard-api/scripts/deploy.shand
lambda/dashboard-api/scripts/setup-dashboard-api-gateway.shin the same
directory that nobody has looked at. - Stamp
spawn:versionon update, not just create.
Related: #768 (version stamping), #650 (parameters reset to defaults), #136 (the
directory-scoped-discovery bug).
Activity
fix(deploy): discover deploy scripts instead of listing them, and fix…
security: remove an sts:AssumeRole grant into an account we do not ow…