-
Notifications
You must be signed in to change notification settings - Fork 5
MR-17 Curious Reader component logic to deal with "minimum" received sub-app payload data #230
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
base: develop
Are you sure you want to change the base?
Conversation
…sub-app payload data
📝 WalkthroughWalkthroughAdds JSON payload processing for app events: new payload model, validator and validation result, handler interface and default implementation, and a WebAppInterface.logMessage(String) method that parses, validates, and delegates payloads with error handling. Changes
Sequence DiagramsequenceDiagram
participant Client
participant WebApp as WebAppInterface
participant Gson
participant Validator as AppEventPayloadValidator
participant Handler as DefaultAppEventPayloadHandler
Client->>WebApp: logMessage(payloadJson)
WebApp->>WebApp: check non-empty payload
alt payload empty
WebApp-->>Client: log error / return
else payload present
WebApp->>Gson: fromJson(payloadJson)
Gson-->>WebApp: AppEventPayload
WebApp->>Validator: validate(payload)
Validator-->>WebApp: ValidationResult
alt valid
WebApp->>Handler: handle(payload)
Handler-->>Handler: Log app_id, collection, timestamp
else invalid
WebApp-->>WebApp: log validation error
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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: 2
🤖 Fix all issues with AI agents
In `@app/src/main/java/org/curiouslearning/container/WebApp.java`:
- Around line 19-20: The file WebApp.java contains duplicate imports for
com.google.gson.Gson and com.google.gson.JsonSyntaxException; remove the
redundant import statements so each type is imported only once (locate the
duplicate import entries for Gson and JsonSyntaxException in WebApp.java and
delete the extra occurrences), ensuring the remaining imports are clean and the
class WebApp compiles without duplicate import warnings.
- Line 24: Remove the duplicate import of AppEventPayload in WebApp.java: locate
the redundant import statement for
org.curiouslearning.container.core.subapp.payload.AppEventPayload (it appears
twice) and delete one of them so the class is imported only once; ensure no
other needed imports are removed and that WebApp compiles with the single import
remaining.
🧹 Nitpick comments (1)
app/src/main/java/org/curiouslearning/container/core/subapp/validation/AppEventPayloadValidator.java (1)
31-33: Consider validating timestamp format.The validator checks that
timestampis present but not that it conforms to a valid format (e.g., ISO 8601). If payloads with malformed timestamps could cause issues downstream, consider adding format validation here.
Changes
How to test
Ref: MR-17
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.