Skip to content

feat(#844): the classic ELB API is routed by the Version a request carries (Tier 1a) - #1146

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/844-elb-classic-tier1a
Sep 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/844-elb-classic-tier1a

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Part of #844 (Tier 1a). This does not close #844 — Tiers 1b and 2 move to v0.121.0.

What was wrong

Elastic Load Balancing is two APIs at one endpoint. 2012-06-01 and 2015-12-01 share a signing
name, an IAM prefix and three action names — CreateLoadBalancer, DescribeLoadBalancers,
DeleteLoadBalancer — while publishing different members, shapes and errors under each. Substrate
read Version nowhere (the only Params["Version"] read in the tree was in a parser test), so
ELBv2's handler answered all three whatever the caller sent:

classic call before
CreateLoadBalancer ValidationError/400 on Name is required — ELBv2's member name for what classic spells LoadBalancerName
DeleteLoadBalancer ValidationError/400 on a missing LoadBalancerArn, for an operation that publishes no errors at all and documents idempotent success
DescribeLoadBalancers HTTP 200 carrying an ELBv2 body

The third is the worst, and it corrects the issue's own prediction. Both generations name their
result element DescribeLoadBalancersResult, so botocore finds what it is looking for and decodes
an empty list — not a KeyError. A classic caller was told, with a 200, that it owns no
classic load balancers.

What this does

  • The discriminator is Version and nothing else. An absent or unrecognized version resolves to
    ELBv2, so every request substrate already answered — every fixture, every recorded event log —
    answers exactly as before, and no code is invented for a version AWS publishes none for. Member
    names could not serve, because a classic DescribeLoadBalancers may carry no members at all.
  • The three operations answer their own published shapes. CreateLoadBalancer returns DNSName
    alone, prefixed internal- for the internal scheme per AWS's sample; DescribeLoadBalancers
    returns LoadBalancerDescriptions.member.N with each listener inside its published
    ListenerDescriptions wrapper and an empty PolicyNames element; DeleteLoadBalancer succeeds
    for a load balancer that does not exist. Eight of LoadBalancerDescription's sixteen members are
    absent rather than invented, each because the operation that would set it is not routed.
  • Classic records live in their own key space, so one name can be held by both generations and
    each generation's describe reports only its own.
  • Every refusal is a code the operation's own page publishes, including
    InvalidConfigurationRequest at HTTP 409 for two listeners claiming one LoadBalancerPort.
    DuplicateListener is not borrowed — it is published on CreateLoadBalancerListeners, which
    this operation does not have (ec2: an invalid block device mapping is accepted instead of refused with InvalidBlockDeviceMapping #671). An unissued Marker is refused rather than silently
    restarting the listing (A pagination token substrate never issued is silently answered with page one (CloudWatch, SSM x2, S3 ListObjectsV2) #915).
  • The tagging reversal is caller-scoped. ELBv2's AddTags enumerates the resources it tags and
    Classic is absent, so its three tag doors still answer ValidationError/400 — while RGT matches
    the type segment both generations spell loadbalancer, so TagResources accepts a classic ARN and
    GetResources reports it, including under ResourceTypeFilters=elasticloadbalancing:loadbalancer
    (cfn: the aws:cloudformation:* stamp covers EC2 only, so the rest of a stack is unstamped #765). The arity check tagging: resolveARN has no elasticloadbalancing arm, so the Resource Groups Tagging API reaches no ELB resource #863 added is not loosened; it is what keeps the two generations' records
    apart. CloudFormation's writers resolve the same way, though no template reaches the classic half
    yet
    — the classic type has no deploy helper, which is Tier 2.

Verification

Every assertion is over the wire, because the defect was a routing decision made from the request
body, and all three operations are asserted in both directions. The plan's requirement for this
PR — "a Version=2012-06-01 call answers the classic shape and a 2015-12-01 call is untouched, and
a classic ARN is accepted by RGT while still refused at ELBv2's own tag doors" — is
TestELBClassic_TheELBv2FormOfTheSameActionIsUntouched (subtests for both the explicit and the
absent version) and TestELBTagging_AClassicLoadBalancerARNIsCallerScoped.

Full nine-stage gate green: gofmt/build/vet, golangci-lint, make test on both toolchains,
coverage, the docs targets, the docs site build, the e2e module, and the three check targets.
Coverage 86.0% emulator / 85.5% total, against the release floor of 85.5%/85.0%.

Two blocks of the new file are deliberately uncovered and documented in place: a json.Marshal of
the record failing, and the classic arm's withTags closure, whose only caller would be
CloudFormation's tag writers — unreachable until the classic type has a deploy helper.

…rries

Elastic Load Balancing is two APIs at one endpoint. `2012-06-01` and
`2015-12-01` share a signing name, an IAM prefix and three action names —
`CreateLoadBalancer`, `DescribeLoadBalancers`, `DeleteLoadBalancer` — while
publishing different members, shapes and errors under each. Substrate read
`Version` nowhere, so ELBv2's handler answered all three whatever the caller
sent. The describe was the worst of the three: both generations name their
result element `DescribeLoadBalancersResult`, so botocore finds what it is
looking for and decodes an empty list — no error anywhere, a consumer simply
told it owns no classic load balancers.

The three operations now answer their own published shapes, the discriminator
is `Version` and nothing else, and an absent or unrecognized version resolves
to ELBv2 so every request substrate already answered is untouched. Classic
records live in their own key space, so one name can be held by both
generations. Every refusal is a code the operation's own page publishes,
including `InvalidConfigurationRequest` at HTTP 409.

The tagging reversal #863's fifth acceptance row needed is caller-scoped, not
global, because AWS's two pages disagree: ELBv2's `AddTags` enumerates the
resources it tags and Classic is absent, while RGT matches the type segment
both generations spell `loadbalancer`. So RGT accepts a classic ARN and reads
it back, and ELBv2's three tag doors still refuse one.

Part of #844 (Tier 1a). Tiers 1b and 2 remain open.
@codecov

codecov Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.45201% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/elb_classic.go 98.29% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit b3c7db6 into main Sep 19, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the fix/844-elb-classic-tier1a branch September 19, 2026 21:49
scttfrdmn added a commit that referenced this pull request Oct 1, 2026
…1317)

`AddTags`, `RemoveTags` and `DescribeTags` exist in both Elastic Load Balancing
APIs with different shapes, so all three now read the Query `Version` member the
way #1146's create/describe/delete trio does — six action names are discriminated
where three were. Before this a classic caller's `AddTags` reached the ELBv2
handler and was refused `ResourceArns is required`, a member the 2012-06-01 API
does not have: the same defect #1146 fixed, in its other half.

The generations differ in every part of the shape. The resource is named rather
than ARN'd on the way in (`LoadBalancerNames.member.N`) and on the way out (the
classic `TagDescription` carries `LoadBalancerName`, and substrate's classic
responses emit no `ResourceArn` at all). `AddTags` and `RemoveTags` take one load
balancer where ELBv2's take a list, and `DescribeTags` takes 1-20. And classic
`RemoveTags` names its keys as `Tags.member.N` of `TagKeyOnly`, not
`TagKeys.member.N` — the one difference whose wrong answer would have been a
silent 200, so the test asserts both spellings against each other rather than
only the published one.

The rules are not new. The published cap of 10 against ELBv2's 50, each
generation's own `TooManyTags` wording and `LoadBalancerNotFound`/400 all come
from #1148 and are resolved from the stored record rather than from the API door,
so one load balancer gets the same answer through its create, through classic
`AddTags` and through the Resource Groups Tagging API — #844's last acceptance
row, now asserted in both directions. `DuplicateTagKeys`/400 is answered on
`AddTags` only, because that is the only page publishing it, and every check runs
before any write, so a refused request leaves the stored tag set as it was. The
write goes through `elbTaggedResource.encode`, which stamps `ever_tagged` from
the pre-merge count (#938) — this is that method's first caller, as its own doc
comment anticipated, so `elb_classic.go`'s "no caller yet" paragraph goes.

AWS's `RemoveTags` page contradicts itself about the member: its parameter table
publishes the indexed `LoadBalancerNames.member.N` while its Sample Request shows
singular `&LoadBalancerName=`. `AddTags` and `DescribeTags` publish and sample the
indexed form, so the singular is a typo on one page rather than a second accepted
spelling, and substrate follows the model — what every SDK serializes.
`docs/services.md` records the contradiction so a reader who copies AWS's own
sample curl understands the refusal.

Each refusal asserts its message as well as its code and status, and that is what
makes most of those rows mean anything: unrouted, these same requests reached the
ELBv2 handler, which refused seven of them `ValidationError`/400 for a different
reason, so code and status alone passed with the routing removed. With the three
`case` lines deleted every new test and subtest fails except the one asserting
the ELBv2 half is untouched, which is the control in the other direction.

Refs #844
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.

elb: the classic (2012-06-01) Elastic Load Balancing API is unrouted, so aws elb create-load-balancer is refused for a v2 parameter name

1 participant