Skip to content

fix: [MR-84] added container version to firestore payload - #255

Merged
janfb-codev merged 1 commit into
developfrom
feature/MR-84
May 26, 2026
Merged

fix: [MR-84] added container version to firestore payload#255
janfb-codev merged 1 commit into
developfrom
feature/MR-84

Conversation

@janfb-codev

@janfb-codev janfb-codev commented May 22, 2026

Copy link
Copy Markdown
Contributor

Changes

  • added container version to firestore payload

How to test

  • Open Assessment inside Container App, then complete the assessment, Firestore should store now Container App Version

Ref: MR-84

Summary by CodeRabbit

  • Chores
    • Enhanced event tracking by including container version information in stored event data, improving diagnostic and monitoring capabilities.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds container version tracking to event payloads persisted in Firestore. The DefaultAppEventPayloadHandler now enriches the payload data with a container_version field populated from the app's build version, enabling downstream analytics and debugging to correlate events with specific container releases.

Changes

Container version tracking in event payloads

Layer / File(s) Summary
Add container version field to event payload
app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java
DefaultAppEventPayloadHandler imports BuildConfig and inserts a container_version field into the payload data map (when data is a Map) using BuildConfig.VERSION_NAME before persisting to Firestore.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • curiouslearning/CRcontainer#252: Bumps versionName in app/build.gradle, which this PR reads via BuildConfig.VERSION_NAME and stores in payload data.
  • curiouslearning/CRcontainer#232: Modifies DefaultAppEventPayloadHandler's Firestore payload persistence flow; this PR extends that pathway by enriching data with version metadata.

Suggested reviewers

  • miguelccodev

Poem

🐰 A rabbit hops through data streams,
Adding version tags to dreams,
BuildConfig whispers: "Here's my name!"
Each payload now plays the versioning game.

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Tests & Lint & Coverage ⚠️ Warning No tests added for DefaultAppEventPayloadHandler changes; no linting configured; CI/CD runs no test/coverage tasks. PR lacks all three required conditions. Add unit tests for DefaultAppEventPayloadHandler (especially testing container_version field addition), configure linting (e.g., checkstyle/spotbugs), and add test/coverage execution to CI/CD with 70% coverage verification.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change—adding container version to the Firestore payload—and includes the JIRA key (MR-84) following the team convention.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/MR-84

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java (1)

56-58: ⚡ Quick win

Avoid mutating payload.data in 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

📥 Commits

Reviewing files that changed from the base of the PR and between 67b7821 and 958b82b.

📒 Files selected for processing (1)
  • app/src/main/java/org/curiouslearning/container/core/subapp/handler/DefaultAppEventPayloadHandler.java

@janfb-codev
janfb-codev merged commit 90dbb4d into develop May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants