Repository navigation
Make four gates discover their sets instead of listing them - #847
Conversation
All four reported a clean bill of health for everything their list forgot — rule 4, four times in one package pair. templateSummary claimed "the 16 parameters the reaper template declares". It declares 19. NetResources, Version and LogRetentionDays were added and the fixture never updated, so the merge-params machinery — whose job is to stop a deploy resetting a live parameter, the thing that disarmed the production reaper once — was never exercised for three of them. NetResources is the staged DESTRUCTIVE sweep (#685). Two assertions in the same file also said "want all 16 declared", so they asserted against a world three parameters smaller than the real one and passed. All three derive from template.yaml now. apiServicePrefix omitted route53, which made a whole service invisible to its own coverage gate. pkg/reaperiam asserts that every AWS action the reaper calls is granted, and both halves of the discovery were anchored on four hand-written entries — `(ec2|fsx|ssm)Client` in the regex, four keys in the map. The reaper has a route53API interface and calls ListResourceRecordSets and ChangeResourceRecordSets, so "every action the reaper calls" silently excluded a service. Service names are discovered now, and an unmapped one FAILS rather than resolving to "". That hid no live defect — checked: the SAM template grants Route53 scoped to the hosted zone, the live production role has it, and `spawn reaper deploy` exposes no DNS flags so ScanSelfPolicyDocument has nothing to grant. The gate would not have told us either way. Real discovery surfaced two calls nobody had reasoned about because they had always been excluded. Both are recorded in grantedElsewhere with a reason. sts:GetCallerIdentity needing no IAM permission is proven, not assumed: the live role grants only sts:AssumeRole, and the reaper calls GetCallerIdentity every invocation and has been succeeding every ten minutes. The four reaper sentinels were enumerated by hand in TWO gates, so a fifth would have had no spelling pin and no metric-filter requirement. They are discovered from failures.go now, with a floor — which also folds the rename case into the same check, since a renamed constant is a literal the template no longer contains. TestEveryTemplateParameterIsInThePARAMMAP matched the CFN key half of a CfnKey:MAKE_VAR pair and never the make-variable, so DryRun:DRYRUN passed while `make deploy DRY_RUN=true` was silently ignored — the exact failure the PARAM_MAP exists to prevent, undetected by the gate guarding it. It parses the pairs now and checks the make-variable against the SCREAMING_SNAKE convention, with Environment:ENV as the one documented departure. Two mistakes of my own, both caught and both recorded in place: A 42 MB pipeline-orchestrator binary went in via `git add -A`, and TestNoTrackedCompiledBinaries caught it in CI rather than locally. A single-package `go build ./lambda/<name>/` writes the executable into the CURRENT directory, so the long-standing lambda/<name>/<name> ignore entries never covered the repo root. .gitignore covers both paths now, and TestEveryGoLambdaBinaryIsIgnored checks the root half too — scoped to lambdas in the ROOT module, since one with its own go.mod cannot be built from the root at all. Requiring it for all twelve was my first version: rule 6's mistake inside the fix for rule 4. And the reaperiam work was lost once before this commit. Verifying a revert, I used `git checkout pkg/reaperiam/drift_test.go` to discard it — which discards to HEAD, taking the real change with it, because the revert and the work were in the same file. Every other revert in this session used a cp backup. The PR would have claimed a fix it did not contain. The bare-substring sweep is #846 rather than this PR: 324 such assertions exist and most are correct, the narrow defect needs go/ast to detect, and a regex attempt produced 38 candidates dominated by false positives — it flagged iam:CreateServiceLinkedRole as comment-only when it is in code at pkg/aws/iam.go:1013. Closes #845
312d9c2 to
c70c381
Compare
|
Force-pushed. Two mistakes of my own in the first push, both worth stating because one of 1. The reaperiam work was not in the commit at all. While verifying a revert I used I noticed because the diff stat was four files when it should have been five. The fix is 2. A 42 MB binary went in via The gate did its job; my
And a third, inside that fix. My first version required a root entry for all twelve That is rule 6's mistake — gating a correlate, the set of lambda names, rather than the |
Closes #845.
Correctness audit 2026-10, Phase 4 — the hand-maintained-list class (rule 4),four instances in one package pair.
1.
templateSummaryclaimed 16 parameters; the template declares 19The merge-params machinery exists to stop a deploy resetting a live parameter — the thing
that disarmed the production reaper once. For three parameters it was never exercised, and
NetResourcesis the staged destructive sweep (#685).Two assertions inside the same file also said "want all 16 declared", so they asserted
against a world three parameters smaller than the real one and passed. All three now derive
from
template.yaml.2.
apiServicePrefixomitted route53 — a whole service invisible to its own gatepkg/reaperiam's gate asserts that every AWS action the reaper calls is granted. Bothhalves of the discovery were anchored on four hand-written entries:
The reaper has a
route53APIinterface and aroute53Client, and callsListResourceRecordSetsandChangeResourceRecordSets. So "every action the reaper calls"silently excluded a service. Service names are discovered now, and an unmapped one
fails rather than resolving to
"":No live defect behind it, checked rather than assumed: the SAM template grants Route53
scoped to the hosted zone, the live production role has it
(
TTLReaperFunctionRolePolicy2), andspawn reaper deployexposes no DNS flags soScanSelfPolicyDocumenthas nothing to grant. The gate would not have said either way,which is the point.
Two calls nobody had reasoned about
Real discovery surfaced
sts:GetCallerIdentityand the two Route53 actions as ungranted —they had always been excluded, so nobody had ever had to decide. Both are now in a
grantedElsewheremap with a reason.sts:GetCallerIdentityneeding no IAM permission is proven, not assumed: the liveproduction role grants only
sts:AssumeRole(scoped to the cross-account role), the reapercalls
GetCallerIdentityon every invocation, and it has been succeeding every ten minutes.This is an exception list, not the rule-6 smell: the rule ("every called action must be
granted") is right, and these are scope boundaries with evidence, like
fsx:DeleteFileSystem→ #613.3. The four sentinels were enumerated by hand in two gates
TestSentinelSpellingsAreStableandTestEverySentinelHasAMetricFiltereach listed thesame four constants, so a fifth would have had no spelling pin and no metric-filter
requirement. The sentinels are a literal-text contract with CloudWatch metric filters, so
an unalarmed one is a log line nobody sees — the same failure as the heartbeat tag spored
wrote for months with zero readers (#682).
Discovered from
failures.gonow, with a floor. That also folds the rename case into thesame check, since a renamed constant is a literal the template no longer contains — so one
gate replaces two. Verified against three reverts: a fifth sentinel with no filter, a
rename, and a filter removed from the template.
4. The PARAM_MAP gate never checked the make-variable
That matches the CFN key half of a
CfnKey:MAKE_VARpair and nothing else, soDryRun:DRYRUNsatisfied it whilemake deploy DRY_RUN=truewas silently ignored — theexact failure the PARAM_MAP exists to prevent, undetected by the gate guarding it. It was
also unanchored, so any mention of
DryRun:anywhere in the Makefile counted.It parses the pairs now and checks the make-variable against the SCREAMING_SNAKE
convention, with
Environment:ENVas the one documented departure:Deliberately not here: the bare-substring sweep → #846
The plan's remaining Phase 4 item. There are 324
strings.Contains(artifact, …)assertions and most are correct. The narrow defect is a literal that also appears in prose
in the generating source, so the gate cannot fail — I hit two instances today and fixed
each in place (#818's comment, #808's
"skipping verification").I attempted regex detection and it is not trustworthy: 38 candidates dominated by false
positives, because stripping
//with a regex also strips inside string literals. Itflagged
iam:CreateServiceLinkedRoleas comment-only; it is in code atpkg/aws/iam.go:1013. Doing it properly needsgo/ast, which is its own piece of work —#846.
Verification
make check(all nested modules),make check-docs, changelog gate,scripts/lambda-deploy-census.sh,semgrep0 findings, Tier 0 e2e with-count=1.Eight compiling reverts across the four gates: a wrong make-variable, a parameter dropped
from PARAM_MAP, a fifth sentinel with no filter, a sentinel rename, a filter removed, a new
client with an unmapped service, a genuinely missing grant (still caught), and route53
removed from
grantedElsewhere(then correctly reported).