Repository navigation
feat(tagging): GetResources honors all eight of its request members (#1004) (#1010) - #1049
Merged
Merged
Conversation
…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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1004
Closes #1010
API_GetResourcespublishes eight request members. Substrate decoded four, and of thosefour, 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'sexclusion against the pagination members requires telling an absent
ResourcesPerPagefrom asent one, which is exactly the
*int#1004 introduces. Splitting them writes that pointertwice.
What changed
ResourcesPerPage0/-5became 100,5000was servedPaginationTokenResourceARNListTagsPerPageIncludeComplianceDetailsComplianceDetailsExcludeCompliantResourcesPlus, response-side:
PaginationTokenlostomitempty, andComplianceDetailsstoppedbeing
*struct{}.The one that mattered most
ResourceARNListwas not merely unimplemented. The page publishes it as mutually exclusivewith
ResourceTypeFilters, withTagFilters, and with all three pagination members — threesentences — 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.
ResourcesPerPagewas the same failure in the other direction:5000was honoured, so onecall 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
TagsPerPageis implemented, not refused — against #1010's own lean. The page publishesexact, 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
PaginationTokenis returned in place of the affected resource" would let acaller loop forever if a first resource's tags exceeded the whole budget.
ComplianceStatusis omitted, andtruewas the tempting answer — nothing can benoncompliant 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
truewould 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 isdefined against the effective tag policy by its own description and substrate models no
organization with one — derived, not placeholder. It follows that
ExcludeCompliantResources: trueexcludes nothing; recorded indocs/services.mdratherthan left to be discovered.
A previously-tagged resource named in
ResourceARNListis returned, with #938's emptytag set. Substrate's reading: the page scopes
"Tags": []to the no-TagFilterscase, butthe 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, notPaginationTokenExpiredException. Malformed ≠ expired, and the two imply differentconsumer actions. The expiry is also wall-clock (fifteen minutes), which CLAUDE.md forbids
depending on.
ExcludeCompliantResourcesis refused only whentrue. AWS's own Sample Request sendsthe member with a non-meaningful value, and an explicit
falseasks 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, andTagFilters'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.mdrecords them as unenforced so the new checks are not read as completecoverage.
Also folded in
The
tagging_plugin.gotoken site, one of the sixteen remaining #915 sites, because it livesin the same function. It is the fifth operation of that class, and
docs/services.md's #915table 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, thealways-emitted
PaginationToken(one Sample Response, not a citation), and the mapping ofthe page's "
Invalid Parameterexception" — spaced and capitalised, and not an entry in theErrors section — to
InvalidParameterException.One documentation curiosity recorded for the next reader: AWS's page misspells its own member
as
ResourceArnListin the two exclusion sentences written onResourceTypeFiltersandTagFilters.Verification
Twelve new tests in
emulator/tagging_get_resources_test.go, all over the wire (#765), everyrefusal 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 → 1rule fails it.The nine-command gate is green and coverage holds.