Skip to content

Four gates reported a clean bill of health for sets they only partly covered #845

Closed

Description

@scttfrdmn

Phase 4 of the audit, the hand-maintained-list class (CLAUDE.md rule 4). All four measured,
all four fixed in the PR that closes this. Filed as the record.

1. templateSummary claimed 16 parameters; the template declares 19

fixture:  16
template: 19
missing from fixture: LogRetentionDays, NetResources, Version

The merge-params machinery exists to stop a deploy resetting a live parameter — that is
what disarmed the production reaper once. For three parameters it was never exercised, and
NetResources is 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.

2. apiServicePrefix omitted route53, so a whole service was invisible to its own gate

pkg/reaperiam's coverage gate asserts that every AWS action the reaper calls is granted.
Both halves of the discovery were anchored on a four-entry hand list:

var apiServicePrefix = map[string]string{"ec2":"ec2","fsx":"fsx","ssm":"ssm","netResource":"ec2"}
var methodCall = regexp.MustCompile(`\b(ec2|fsx|ssm)Client\.([A-Z][A-Za-z0-9]+)\(`)

The reaper has a route53API interface and a route53Client and calls
ListResourceRecordSets and ChangeResourceRecordSets. Neither was visible, so "every
action the reaper calls" silently excluded a service.

No live defect behind it — checked rather than assumed: the SAM template grants Route53
scoped to the configured hosted zone, the live production role has it
(TTLReaperFunctionRolePolicy2), and spawn reaper deploy exposes no DNS flags so
ScanSelfPolicyDocument has nothing to grant. The gate would not have told us either way,
which is the problem.

Making discovery real surfaced two more calls nobody had reasoned about, because they had
always been excluded: sts:GetCallerIdentity (needs no IAM permission — proven, since the
live role grants only sts:AssumeRole and the reaper calls GetCallerIdentity successfully
every ten minutes) and the two Route53 actions above.

3. The four reaper sentinels were listed by hand in two gates

TestSentinelSpellingsAreStable and TestEverySentinelHasAMetricFilter each enumerated
the same four constants. A fifth sentinel would have been covered by neither — no
spelling pin, no metric-filter requirement, and nothing to say so. The sentinels are a
literal-text contract with CloudWatch metric filters, so an unalarmed one is a log line
nobody sees.

4. TestEveryTemplateParameterIsInThePARAMMAP never checked the make-variable

if !strings.Contains(string(mk), name+":") {

That matches the CFN key half of a CfnKey:MAKE_VAR pair and nothing else, so
DryRun:DRYRUN satisfies it while make deploy DRY_RUN=true is silently ignored — the
exact 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.

Deliberately not in this PR: the bare-substring sweep

The plan's remaining Phase 4 item was "bare-substring assertions over generated artifacts,
found six times". There are 324 strings.Contains(artifact, "…") assertions in the
tree and most are legitimate — asserting a specific generated line is present is the right
thing to do.

The narrow defect is an asserted literal that also appears in prose in the generating
source, so the gate cannot fail. I hit two instances of that today and fixed each in place
(#818's comment, and #808's "skipping verification").

I tried to detect the class with a regex scan and it is not trustworthy: 38 candidates,
dominated by false positives, because stripping // comments with a regex also strips
inside string literals. Spot-checked iam:CreateServiceLinkedRole, reported as
comment-only, and it is in code at pkg/aws/iam.go:1013.

Doing it properly needs go/ast comment-stripping — the approach cmd/user_facing_strings_test.go
already uses for exactly this reason. That is the deliverable, and it is its own piece of
work rather than a speculative sweep of 324 sites. Filing separately.

Activity

  1. added a commit that references this issue on Oct 11, 2026
    c70c381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions