-
Notifications
You must be signed in to change notification settings - Fork 41
feat: add support for clipped client ID lists and enhance aggregation handling #1164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughParsers and models for V1 summary data now use named JSON keys, safely handle optional boolean/int fields, and surface clipping metadata. Two model classes gained new fields and constructors. Tests were added/extended to validate clipped, totalUnidentified, and totalClientIds behaviors. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Summary
participant JSON as JsonObject
Caller->>Summary: asSummaryMultipleV1(JSON)
Summary->>JSON: read TOTAL, CLIENT_IDS, CLIPPED, TOTAL_UNIDENTIFIED, TOTAL_CLIENT_IDS
Note right of Summary #ddeeff: Missing numeric fields → null/0 as handled by helpers
Summary-->>Caller: SummaryClientIdCounts(total, clientIds, totalUnidentified, totalClientIds, clipped)
Caller->>Summary: asSummaryFlagV1(JSON)
Summary->>JSON: read CLIENT_IDS, CLIPPED, TOTAL
Summary-->>Caller: SummaryClientIdList(total, clientIds, clipped)
Caller->>Summary: asSummaryTotalV1(JSON)
Summary->>JSON: read TOTAL
Summary-->>Caller: int total
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (1)
lib/src/main/java/io/ably/lib/types/Summary.java (1)
86-94: Use typed deserialisation for List and validate clientIds shape.Raw List.class can mask type issues. Also, add a clear error when clientIds is missing or not an array.
Apply:
- List<String> clientIds = Serialisation.gson.fromJson(jsonObject.get(CLIENT_IDS), List.class); + if (jsonObject.get(CLIENT_IDS) == null || !jsonObject.get(CLIENT_IDS).isJsonArray()) { + throw new IllegalStateException("clientIds must be a JSON array"); + } + List<String> clientIds = Serialisation.gson.fromJson( + jsonObject.get(CLIENT_IDS), + new com.google.gson.reflect.TypeToken<java.util.List<String>>() {}.getType() + );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
lib/src/main/java/io/ably/lib/types/Summary.java(2 hunks)lib/src/main/java/io/ably/lib/types/SummaryClientIdCounts.java(1 hunks)lib/src/main/java/io/ably/lib/types/SummaryClientIdList.java(1 hunks)lib/src/test/java/io/ably/lib/types/SummaryTest.java(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
lib/src/main/java/io/ably/lib/types/Summary.java (1)
lib/src/main/java/io/ably/lib/util/Serialisation.java (1)
Serialisation(40-299)
lib/src/test/java/io/ably/lib/types/SummaryTest.java (1)
lib/src/main/java/io/ably/lib/types/Summary.java (1)
Summary(30-176)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: check
- GitHub Check: check-rest-okhttp
- GitHub Check: check-realtime
- GitHub Check: check-rest
- GitHub Check: check-realtime-okhttp
- GitHub Check: check-liveobjects
- GitHub Check: check (24)
- GitHub Check: check (19)
- GitHub Check: check (21)
- GitHub Check: check (29)
- GitHub Check: build
- GitHub Check: check (29)
🔇 Additional comments (6)
lib/src/main/java/io/ably/lib/types/SummaryClientIdList.java (1)
5-23: Docs: clear and useful context.The added Javadoc clarifies semantics and the new clipped flag well.
lib/src/main/java/io/ably/lib/types/Summary.java (3)
34-39: Good: centralised JSON keys.Moving literals to constants improves maintainability and reduces typos.
101-116: Helpers: sensible defaults.The boolean/int field readers are straightforward and safe.
68-82: Use clientIds.size() as the fallback for totalClientIds, not total- totalClientIds == null ? total : totalClientIds + totalClientIds == null ? clientIds.size() : totalClientIdsUpdate any tests expecting the old value (e.g., 5/2 → 2/2).
lib/src/test/java/io/ably/lib/types/SummaryTest.java (2)
130-131: Nice: verifies clipped defaults to false.
234-253: Good coverage for clipped=true in multiple.v1.Covers total, totalClientIds, totalUnidentified, and clipped propagation.
AndyTWF
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spec PR now at ably/specification#382 if we want to annotate :)
0542f47 to
55da346
Compare
… handling Introduce `clipped` field in `SummaryClientIdList` and `SummaryClientIdCounts` for managing truncated client ID lists. Update relevant methods to read this field and handle additional aggregation metadata (`totalClientIds`, `totalUnidentified`). Add comprehensive test cases for new functionality.
132470a to
d0f1060
Compare
Introduce
clippedfield inSummaryClientIdListandSummaryClientIdCountsfor managing truncated client ID lists. Update relevant methods to read this field and handle additional aggregation metadata (totalClientIds,totalUnidentified). Add comprehensive test cases for new functionality.Summary by CodeRabbit
New Features
Documentation
Tests