fix: [MR-84] added container version to firestore payload - #255
Conversation
📝 WalkthroughWalkthroughThis PR adds container version tracking to event payloads persisted in Firestore. The ChangesContainer version tracking in event payloads
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
🧹 Nitpick comments (1)
app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java (1)
56-58: ⚡ Quick winAvoid mutating
payload.datain place before persistence.Line 57 writes directly into a caller-provided map. That can throw at runtime for unmodifiable maps and creates hidden side effects across handlers. Copy then enrich instead.
Proposed change
- if (payload.data instanceof Map) { - ((Map<String, Object>) payload.data).put("container_version", BuildConfig.VERSION_NAME); - } + if (payload.data instanceof Map) { + Map<String, Object> enrichedData = + new HashMap<>((Map<String, Object>) payload.data); + enrichedData.put("container_version", BuildConfig.VERSION_NAME); + payload.data = enrichedData; + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java` around lines 56 - 58, DefaultAppEventPayloadHandler mutates caller-provided payload.data in place which can throw for unmodifiable maps and causes hidden side-effects; instead, detect when payload.data is a Map (payload.data), create a shallow mutable copy (e.g., new HashMap<>(...)), put the "container_version" key into that copy, and then use/assign the copied Map for persistence/forwarding so the original payload.data remains unchanged; update any places in DefaultAppEventPayloadHandler that assume in-place mutation to consume the new copied Map.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java`:
- Around line 56-58: DefaultAppEventPayloadHandler mutates caller-provided
payload.data in place which can throw for unmodifiable maps and causes hidden
side-effects; instead, detect when payload.data is a Map (payload.data), create
a shallow mutable copy (e.g., new HashMap<>(...)), put the "container_version"
key into that copy, and then use/assign the copied Map for
persistence/forwarding so the original payload.data remains unchanged; update
any places in DefaultAppEventPayloadHandler that assume in-place mutation to
consume the new copied Map.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a5892a75-d6aa-4820-929f-734e62678be1
📒 Files selected for processing (1)
app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java
Changes
How to test
Ref: MR-84
Summary by CodeRabbit