Skip to content

feat(#844): route the classic Elastic Load Balancing tag operations - #1317

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/844-classic-elb-tags
Oct 1, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/844-classic-elb-tags

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

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.

This is #844's Tier 1b, which closes AC7's tag half and AC9. AC8 (the AWS::ElasticLoadBalancing::LoadBalancer deploy helper) is Tier 2 and follows in its own PR, so #844 stays open.

What differs between the generations

Every part of the shape, which is why these are separate handlers rather than a shared one with a flag:

  • The resource is named, not ARN'd — LoadBalancerNames.member.N in, and the classic TagDescription carries LoadBalancerName out. Substrate's classic responses emit no ResourceArn at all, which the round-trip test asserts against the raw body because a decode can only see members its struct declares.
  • AddTags and RemoveTags take one load balancer ("You can specify one load balancer only" / "a maximum of one load balancer name"); ELBv2's take a list with no published bound. DescribeTags takes 1–20 in both generations. Neither bound has a code of its own, so exceeding it answers ValidationError/400 from the Query Common Errors page.
  • Classic RemoveTags names its keys as Tags.member.N of TagKeyOnly, not TagKeys.member.N. This is the one difference whose wrong answer would have been a silent 200 — routed but decoded with v2's member name, the operation would have removed nothing and said so with a success. The test asserts both spellings against each other rather than only the published one.

What is reused rather than reimplemented

The rules all come from #1148 and are resolved from the stored record, never from the API door: the published cap of 10 against ELBv2's 50, each generation's own TooManyTags wording, and LoadBalancerNotFound/400. So one load balancer gets the same answer through its create, through classic AddTags and through the Resource Groups Tagging API — AC9, now asserted in both directions. DuplicateTagKeys/400 is answered on AddTags only, because that is the only page publishing it. Every check runs before any write, so a refused request leaves the stored tag set exactly 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 "the closure has no caller yet" paragraph goes. The duplicated classic LoadBalancerNotFound body is hoisted to elbClassicNotFoundError, reading its code from elbNotFoundCodes, so the four classic doors cannot drift in either code or wording.

Provenance

AWS's RemoveTags page contradicts itself about the member it takes: its parameter table publishes the indexed LoadBalancerNames.member.N, while its Sample Request shows singular &LoadBalancerName=my-loadbalancer. AddTags and DescribeTags both publish and sample the indexed form, so the singular is a typo on one page rather than a second accepted spelling — and the indexed form is what every SDK serializes. Substrate follows the model, which is the resolution elbMaxTagKeyLength already records for the Tag-length contradiction. A reader who copies AWS's own sample curl is therefore refused ValidationError/400, and docs/services.md says so rather than leaving it to be discovered.

LoadBalancerNotFound's message ("There is no ACTIVE Load Balancer named '…'") is AWS's observed text; its published text is the one-line description of the code itself, which is not a response body. The code, status and the operations that publish it all come from the API reference.

Verification

  • make lint — 0 issues; make test (race, -count=1) green.
  • make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check all pass. The emulator: substrate bookkeeping fields render as response members AWS does not publish #756 ratchet is byte-identical at 319 declared, 133 projected across 50 records, 186 still reachable — ELBClassicLoadBalancer is already projected and the new DescribeTags renders a TagDescription, not the record. operation-catalog-check reports no change, since the catalog is generated from action names and all three already appeared in the v2 arm.
  • Negative control. With the three new case lines deleted, every new test and subtest fails except TestELBClassicTags_TheELBv2FormOfTheSameActionsIsUntouched, which is by construction the control in the other direction. Getting there changed the tests: the refusal table originally asserted only code and status, and seven of its twelve rows still passed unrouted, because the ELBv2 handler refuses the same requests ValidationError/400 for a different reason ("ResourceArns is required"). Each row now asserts the message too, which is the only part of the refusal that says which generation turned the caller away.
  • Patch coverage: 100% of emulator/elb_classic_tags.go, every statement.

Refs #844

`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
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 17b7006 into main Oct 1, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the feat/844-classic-elb-tags branch October 1, 2026 18:15
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.

1 participant