Skip to content

Add multiplyCustomUserDetail for the $mul user property modifier - #165

Merged
arifBurakDemiray merged 1 commit into
stagingfrom
board/parity-r132-countly-sdk-cpp
Nov 2, 2026
Merged

arifBurakDemiray merged 1 commit into
stagingfrom
board/parity-r132-countly-sdk-cpp

Conversation

@arifBurakDemiray

@arifBurakDemiray arifBurakDemiray commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Card C-137: Bring R132 Modifier mul to the C++ SDK

Why: the C++ SDK cannot multiply a custom user property on the server ($mul), which Android, iOS, HarmonyOS and React Native ship (parity R132, reference ModuleUserProfile.multiply).
Change:

  • New Countly::multiplyCustomUserDetail(const std::string &key, double value) queues user_details={"custom":{"<key>":{"$mul":<value>}}}, after flushing recorded events like setCustomUserDetails.
  • Applies the SBS user property filter to the key as given, then the max key length. A call before start(), an empty key and a non-finite value are ignored with a log line.
  • Details set before start() that still wait for the first session are queued first, so the server applies them before the multiplication.
  • setCustomUserDetails and addEvent share the new filter helper (same behaviour).
    Decided:
  • One request per call, named after setCustomUserDetails; rejected a userProfile() object with save(), since this SDK has no profile cache.
  • double, like iOS (NSNumber), HarmonyOS, React Native and Dart (Add multiply user property modifier countly-sdk-dart#13). The server takes JSON numbers, so 2.0 lands as 2 (plugins/users/api/ingestor.js).
  • Before start() the call is ignored, like addEvent: Android's userProfile() does not exist before init either.
    Checked:
  • tests/user_details.cpp: 6 cases, 67 assertions, and all 6 fail with the method body stubbed out. Whole suite on macOS arm64: 77 cases, 1300 assertions (SQLite off) and 94 cases, 1640 assertions (SQLite on).
  • Mock Countly server over real HTTP (libcurl, /i and /o/sdk): 7 /i requests in the expected order (events, waiting details, four $mul, begin_session without details). The server's SBS blacklist and lkl applied, a key with &=+% arrived intact, 3 ignored calls logged.
  • Live on master.count.ly (desktop test app, fresh device): three properties set before start(), then multiplied. The profile shows 10 × 2 = 20, 7 × 0.5 = 3.5 and 3 × 3 = 9 (the &=+% key), and all 6 requests were answered Success in order.
  • Reviews: code review, simplify, security review, no open findings. CI: all 44 jobs green on 2373783.
    Not checked: the C++ help-center page has no "Modifying data" section yet (countly-backup-documentation, its own docs card).

@arifBurakDemiray arifBurakDemiray changed the title [board] Add multiplyCustomUserDetail for the $mul user property modifier Add multiplyCustomUserDetail for the $mul user property modifier Nov 2, 2026
@arifBurakDemiray
arifBurakDemiray force-pushed the board/parity-r132-countly-sdk-cpp branch from 765c720 to 2373783 Compare November 2, 2026 09:35
@arifBurakDemiray
arifBurakDemiray marked this pull request as ready for review November 2, 2026 09:37
@arifBurakDemiray
arifBurakDemiray merged commit 8fe2cf3 into staging Nov 2, 2026
44 checks passed
@arifBurakDemiray
arifBurakDemiray deleted the board/parity-r132-countly-sdk-cpp branch November 2, 2026 13:13
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.

1 participant