Repository navigation
fix(#1224): a log group that does not exist is not an empty log group - #1252
Merged
Merged
Conversation
DescribeLogStreams, GetLogEvents and FilterLogEvents each answered HTTP 200 with an empty listing for a log group with no record, so "this group is empty" and "this group was never created" were the same response. Each page publishes ResourceNotFoundException — "The specified resource does not exist." — at HTTP 400, and all three now answer it. DescribeLogGroups is excluded: its Errors section publishes no not-found at all. Because the published status is 400, the four sites that already refused an absent resource moved from 404 with them; one code cannot keep two statuses in one service. All seven now go through two shared helpers. GetLogEvents also resolves the stream, group first. Against #1086's token refusal the addressed resource wins, following SNS ListSubscriptionsByTopic; the token is still decoded before the listing is read, which is what #887's criterion asks, and the three ordering assertions now seal the listing's key with a control rather than sealing every read. CreateLogGroup/CreateLogStream's ResourceAlreadyExistsException stays at 409 where its pages publish 400 — same class, different code, filed as #1251.
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.
DescribeLogStreams,GetLogEventsandFilterLogEventseach answered HTTP 200 with an emptylisting for a log group with no record, so "this group is empty" and "this group was never created"
were the same response — and a consumer waiting for a Lambda's first log line could not tell a
still-warming stream from a name it had misspelled.
What the pages publish
Each of
API_DescribeLogStreams,API_GetLogEventsandAPI_FilterLogEventslistsResourceNotFoundException, glossed "The specified resource does not exist.", at HTTP Status Code400 — not the 404 the code's name suggests. All three now answer it.
API_DescribeLogGroupsis deliberately excluded: its Errors section publishesInvalidParameterException/400 andServiceUnavailableException/500 and no not-found at all, so alogGroupNamePrefixmatching nothing is a legitimately empty listing there and refusing it would beinventing a code the page does not carry (#671).
Why the fix is seven sites and not three
DeleteLogGroup,CreateLogStream,DeleteLogStreamandPutLogEventsalready refused an absentresource — at 404, where each of their pages publishes 400, and where
PutRetentionPolicyandDeleteRetentionPolicyalready answered 400 throughloadLogGroup. One code cannot keep two statusesin one service without a consumer switching on status seeing a difference AWS does not have, so the
four moved with the three reads. All seven now go through
cwLogsGroupNotFound/cwLogsStreamNotFoundand cannot drift.GetLogEventsalso resolves the stream, since itslogStreamNameisRequired: Yes; the group ischecked first, because a caller told the stream is missing would create it and be refused again.
Ordering against #1086's token refusal
AWS publishes nothing about which of the two wins, so the reading is the one already in the tree: SNS
ListSubscriptionsByTopic(#926) and S3ListObjectsV2resolve the resource the request addressesfirst, because a token is a continuation of a listing over that resource and there is no listing to
continue when the resource does not exist.
#887's criterion survives in the form that matters: the token is still decoded before the listing is
read. The three ordering assertions therefore seal the listing's key alone — the stream-name index at
two sites, the events key at
GetLogEvents— each with a control call proving the sealed key isreached, exactly as SNS's does. Sealing every read, as they did before, would now fail the group lookup
and assert nothing about the token. The absent-required-member refusal keeps the front of the sequence.
Every ordering is asserted in both directions, because all the refusals involved answer 400 and the
code is the only thing that says which one won.
logStreamNamesonFilterLogEventsis a filter ratherthan the addressed resource, so a name in it with no stream behind it is still not refused — asserted.
Left as it was
CreateLogGroupandCreateLogStreamanswerResourceAlreadyExistsExceptionat 409 where bothpages publish 400. Same class of defect, different code with its own consumers, and it needs the same
survey across the plugin's other conflict answers that this change did for not-found — filed as #1251
(v0.124.0) and cross-referenced from
cloudwatchlogs_not_found.go.Verification
Non-vacuity was checked by restoring the pre-fix plugin: every new criterion fails, including all three
precedence subtests, and the two subtests that assert unchanged behaviour (
DescribeLogGroupsstays anempty 200; an existing group still reads) pass either way.
make lint(0 issues),make test(race, all packages ok),make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-checkall pass.Closes #1224