Skip to content

feat(tagging): GetResources honors all eight of its request members (#1004) (#1010) - #1049

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/1004-1010-getresources
Sep 18, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/1004-1010-getresources

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #1004
Closes #1010

API_GetResources publishes eight request members. Substrate decoded four, and of those
four, two were not honoured as published either — so six of the eight were wrong in one of
three ways: dropped silently, clamped where AWS refuses, or accepted with both decode errors
discarded.

The two issues are one PR because they cannot be split: enforcing ResourceARNList's
exclusion against the pagination members requires telling an absent ResourcesPerPage from a
sent one, which is exactly the *int #1004 introduces. Splitting them writes that pointer
twice.

What changed

Member Before Now
ResourcesPerPage clamped — 0/-5 became 100, 5000 was served refused outside 1–100
PaginationToken both decode errors discarded → page one refused unless substrate issued it; 0–2048 length checked
ResourceARNList dropped, and its three exclusions unenforced selects the named ARNs exactly; bounds and exclusions enforced
TagsPerPage dropped cuts the page by tag count and reissues the token
IncludeComplianceDetails dropped renders ComplianceDetails
ExcludeCompliantResources dropped refused without its companion

Plus, response-side: PaginationToken lost omitempty, and ComplianceDetails stopped
being *struct{}.

The one that mattered most

ResourceARNList was not merely unimplemented. The page publishes it as mutually exclusive
with ResourceTypeFilters, with TagFilters, and with all three pagination members — three
sentences — so substrate accepted three request shapes AWS refuses and answered the
account-wide scan for all three. A caller asking for the tags on five ARNs got a superset at
HTTP 200 with nothing in the response to say the request served was not the request sent.

ResourcesPerPage was the same failure in the other direction: 5000 was honoured, so one
call could return every resource in the account on a page size AWS rejects, and the
consumer's paging loop was never exercised.

Decisions the issues asked for, and the sources that settle them

TagsPerPage is implemented, not refused — against #1010's own lean. The page publishes
exact, fully deterministic behaviour: the 100–500 range, "a resource with no tags is counted
as having one tag (one key and value pair)"
, "does not split a resource and its associated
tags across pages"
, and a worked example (100 against 22 resources of 10 tags each → pages
of 10, 10, 2) that pins the comparison as inclusive. Fifteen lines and no invention. One
documented departure, unobservable: at least one resource is always taken, because a literal
reading of "a PaginationToken is returned in place of the affected resource" would let a
caller loop forever if a first resource's tags exceeded the whole budget.

ComplianceStatus is omitted, and true was the tempting answer — nothing can be
noncompliant with a policy that does not exist. The Organizations tag-policies guide settles
it the other way: "[u]ntagged resources or tags that aren't defined in the tag policy aren't
evaluated for compliance with the tag policy."
Not evaluated is not compliant, so true
would claim an evaluation that never happened. It is not a struct field at all, so it cannot
be reported by accident later. The three key arrays are emitted as [], because each is
defined against the effective tag policy by its own description and substrate models no
organization with one — derived, not placeholder. It follows that
ExcludeCompliantResources: true excludes nothing; recorded in docs/services.md rather
than left to be discovered.

A previously-tagged resource named in ResourceARNList is returned, with #938's empty
tag set. Substrate's reading: the page scopes "Tags": [] to the no-TagFilters case, but
the operation's own scoping sentence is "GetResources does not return untagged resources",
and a resource that ever held a tag is not untagged — which is precisely why AWS publishes
the empty form for it. A test pins it so the opposite reading has to argue with a failing
assertion.

InvalidParameterException/400 for a never-issued token, not
PaginationTokenExpiredException.
Malformed ≠ expired, and the two imply different
consumer actions. The expiry is also wall-clock (fifteen minutes), which CLAUDE.md forbids
depending on.

ExcludeCompliantResources is refused only when true. AWS's own Sample Request sends
the member with a non-meaningful value, and an explicit false asks for nothing.

Per-member checks before cross-member exclusions. No order avoids every two-round-trip
case, so the criterion is the one #991 and #983 already use: name what is wrong with a single
member before what is wrong with the request as a whole.

Scope, stated rather than left silent

ResourceTypeFilters' per-item 0–256 length with its 100-item array bound, and TagFilters'
50-key/20-value bounds, are not enforced. They belong to neither issue, and adding a
bound without walking its citations is how an emulator starts refusing what AWS accepts.
docs/services.md records them as unenforced so the new checks are not read as complete
coverage.

Also folded in

The tagging_plugin.go token site, one of the sixteen remaining #915 sites, because it lives
in the same function. It is the fifth operation of that class, and docs/services.md's #915
table gains its row.

Provenance

Three of the readings above are substrate's rather than transcriptions, and each says so in
the code, the CHANGELOG and docs/services.md: the previously-tagged-resource rule, the
always-emitted PaginationToken (one Sample Response, not a citation), and the mapping of
the page's "Invalid Parameter exception" — spaced and capitalised, and not an entry in the
Errors section — to InvalidParameterException.

One documentation curiosity recorded for the next reader: AWS's page misspells its own member
as ResourceArnList in the two exclusion sentences written on ResourceTypeFilters and
TagFilters.

Verification

Twelve new tests in emulator/tagging_get_resources_test.go, all over the wire (#765), every
refusal asserting the status alongside the code (#923), and the compliance assertions reading
raw JSON because a decoded struct cannot show a missing member. The tag-budget test was
mutation-checked: removing the cost == 0 → 1 rule fails it.

The nine-command gate is green and coverage holds.

…1004) (#1010)

`API_GetResources` publishes eight request members. Substrate decoded four, and
of those four, two were not honored as published either — so six of the eight
were wrong in one of three ways: dropped silently, clamped where AWS refuses, or
accepted with both decode errors discarded.

The two issues are one commit because they cannot be split: enforcing
`ResourceARNList`'s exclusion against the pagination members requires telling an
absent `ResourcesPerPage` from a sent one, which is exactly the `*int` #1004
introduces.

`ResourcesPerPage` is refused outside 1–100 rather than clamped into it. One arm
was doing two jobs — supplying the default and swallowing an out-of-range value —
and only the first was correct. `5000` was honored, so one call could return
every resource in the account on a page size AWS rejects.

`ResourceARNList` was the costliest omission, and not because it was
unimplemented: the page publishes it as mutually exclusive with
`ResourceTypeFilters`, with `TagFilters`, and with all three pagination members,
so substrate accepted three request shapes AWS refuses and answered the
account-wide scan for all three — a caller asking for five ARNs got a superset at
HTTP 200.

`TagsPerPage` is implemented rather than refused, against the issue's own lean,
because the page publishes exact deterministic behavior plus a worked example
that pins the comparison as inclusive.

`ComplianceStatus` is omitted rather than reported as `true`: the Organizations
tag-policies guide says a tag outside the policy is not evaluated for compliance
at all, so `true` would claim an evaluation that never happened. The three key
arrays are emitted as `[]`, each derivable from its own definition given no
effective tag policy. It follows that `ExcludeCompliantResources: true` excludes
nothing, which is recorded rather than left to be discovered.

Folds in the `tagging_plugin.go` token site, the fifth operation of #915's class,
because it lives in the same function.

Two published constraints are deliberately left unenforced and said so:
`ResourceTypeFilters`' 0–256/100-item bounds and `TagFilters`' 50/20 bounds.

Closes #1004
Closes #1010
@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.07407% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/tagging_plugin.go 92.85% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 47844f2 into main Sep 18, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the feat/1004-1010-getresources branch September 18, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant