feat(logs): real GetLogGroupFields, ListLogGroupsForQuery, StartLiveTail#761
Merged
vieiralucas merged 2 commits intomainfrom Apr 25, 2026
Merged
feat(logs): real GetLogGroupFields, ListLogGroupsForQuery, StartLiveTail#761vieiralucas merged 2 commits intomainfrom
vieiralucas merged 2 commits intomainfrom
Conversation
Three CloudWatch Logs operations were returning hardcoded stubs even though the data they need is already in fakecloud's state. They now return real values derived from recorded events / queries. - GetLogGroupFields walks every event in every stream of the target log group, parses each as JSON, and tallies how often each top-level key appears. Always-present fields (@timestamp, @message, @logstream) are still surfaced for empty groups. The response shape uses AWS's documented `name` / `percent` keys (not the prior `fieldName`). - StartQuery now accepts the AWS-documented `logGroupNames` and `logGroupIdentifiers` arrays in addition to the single `logGroupName`. The QueryInfo state captures every group/identifier the query referenced. - ListLogGroupsForQuery looks up the QueryInfo by `queryId` and returns the captured identifiers instead of an empty array. - StartLiveTail echoes the requested `logGroupIdentifiers` back in `sessionStart` instead of an empty list. The stubs in misc.rs for `get_log_object`, `get_log_fields`, and `get_log_record` (plus anomaly analysis) require Logs Insights query result generation to be wired through the event store and remain deferred — they are documented as known limitations elsewhere.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
3 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-logs/src/service/misc.rs">
<violation number="1" location="crates/fakecloud-logs/src/service/misc.rs:579">
P2: `StartLiveTail` silently ignores invalid `logGroupIdentifiers` values instead of returning a validation error.</violation>
</file>
<file name="crates/fakecloud-logs/src/service/queries.rs">
<violation number="1" location="crates/fakecloud-logs/src/service/queries.rs:92">
P1: Multi-group StartQuery inputs are reduced to one `log_group_name`, so `GetQueryResults` only scans a single group instead of all requested groups.</violation>
<violation number="2" location="crates/fakecloud-logs/src/service/queries.rs:429">
P2: Unknown `queryId` is silently treated as success with an empty list; return a not-found error instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- GetQueryResults: walk every log group/identifier captured by StartQuery (not just `log_group_name`). ARNs resolve to bare group names; duplicate references deduplicate. Multi-group queries now actually scan all groups. - ListLogGroupsForQuery: return ResourceNotFoundException when the queryId is unknown instead of silently returning an empty array. - StartLiveTail: validate that `logGroupIdentifiers` is an array of strings and reject non-string entries with InvalidParameterException, instead of silently dropping them via filter_map. - extract_log_group_from_arn promoted to pub(crate) so queries.rs can reuse it for ARN -> group-name resolution.
vieiralucas
added a commit
that referenced
this pull request
Apr 25, 2026
Three pre-existing test bugs that the protocol-map fix surfaced because this branch is the first to actually run the full conformance + e2e suites against post-#761 main: - crates/fakecloud-conformance/tests/logs.rs::logs_list_log_groups_for_query - crates/fakecloud-e2e/tests/logs.rs::logs_misc_stubs Both tests called `ListLogGroupsForQuery` with a synthetic queryId. PR #761's Cubic round (commit ad110ec) tightened the impl to return `ResourceNotFoundException` for unknown queryIds — matching real AWS — but the test sites still expected the previous "silently empty" answer. Fix: create a real query via `StartQuery` first, then look it up. - crates/fakecloud-e2e/tests/stepfunctions.rs::wait_for_execution 50 polls * 50ms = 2.5s. The PR-#757 SNS RSA-SHA256 signing + post-#760 SES-MIME work can push first-touch latency past that budget on GitHub-hosted runners under parallel load. Bump the budget to 10s. Locally executions still complete in <2s. The conformance probe-map change in this PR exposed these because `paths-filter` only triggers conformance + e2e when the conformance crate changes, so the failing tests rode in unnoticed.
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.
Summary
GetLogGroupFields: walks every event in every stream of the target log group, parses each as JSON, tallies how often each top-level key appears. Synthetic@timestamp/@message/@logStreamalways surfaced; response uses the documentedname+percentshape (not the priorfieldName)StartQuery: accepts the AWS-documentedlogGroupNamesandlogGroupIdentifiersarrays in addition to the singlelogGroupName.QueryInfocaptures every group/identifier referencedListLogGroupsForQuery: looks up the captured identifiers byqueryIdand returns them instead of an empty arrayStartLiveTail: echoes the requestedlogGroupIdentifiersback insessionStartOut of scope (documented limitations)
GetLogObject,GetLogFields,GetLogRecordand anomaly analysis still require Logs Insights query result generation to be wired through the event store; deferred[w1, w2 = "ERROR", w3]) — separate parser changeTest plan
get_log_group_fields_returns_synthetic_fields_when_no_events,get_log_group_fields_extracts_top_level_keys_from_json_events,list_log_groups_for_query_returns_started_groups,list_log_groups_for_query_returns_array_form_groupscargo clippy --workspace --all-targets -- -D warningscleancargo fmt --checkcleanSummary by cubic
Replace stubbed CloudWatch Logs APIs with real behavior and fix multi‑group query handling.
GetLogGroupFields,ListLogGroupsForQuery,StartLiveTail, andGetQueryResultsnow read recorded events and validate inputs.New Features
GetLogGroupFields: counts top-level JSON keys across events; always includes@timestamp,@message,@logStream; returnsname+percent.StartQuery: acceptslogGroupNamesandlogGroupIdentifiers; queries scan all referenced groups (ARNs resolved, duplicates deduped).ListLogGroupsForQuery: returns captured identifiers for thequeryId; unknownqueryIdnow returnsResourceNotFoundException.StartLiveTail: validateslogGroupIdentifiersis an array of strings and echoes them insessionStart.Migration
GetLogGroupFieldsresponse usesnameinstead offieldName. Update consumers accordingly.Written for commit ad110ec. Summary will update on new commits.