Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Nov 18, 2025

Description

Adds analytics tracking for the local_catalog_sync_skipped event in WooCommerce POS to monitor when and why local catalog synchronization is being skipped. This helps identify potential issues with sync operations and understand sync behavior patterns.

WOOMOB-1680

Key changes:

  • Introduced LocalCatalogSyncSkipped analytics event with sync_type and optional skip_reason properties
  • Added tracking in WooPosLocalCatalogSyncWorker for full sync skip scenarios
  • Added tracking in WooPosPerformLocalCatalogIncrementalSync for incremental sync skip scenarios
  • Defined five skip reason constants:
    • POS_NOT_OPENED_30_DAYS - POS hasn't been used recently
    • SYNC_NOT_REQUIRED - Catalog was recently synced
    • LOCAL_CATALOG_DISABLED - Local catalog feature is disabled (e.g., catalog too large)
    • CHECKING_SYNC_REQUIREMENT_FAILED - Failed to determine sync requirements (e.g., no network)
    • SITE_NOT_SELECTED - No site is currently selected
  • Updated unit tests to verify analytics tracking in all skip scenarios

Test Steps

You can adjust intervals in WooPosLocalCatalogSyncScheduler and WooPosPeriodicSyncFacade to make full/incremental sync attempts more frequent.

  1. Verify that the 🔵 Tracked: woocommerceandroid_pos_local_catalog_sync_skipped, Properties: {"sync_type":"full"} event is tracked
  2. Verify that the 🔵 Tracked: woocommerceandroid_pos_local_catalog_sync_skipped, Properties: {"sync_type":"incremental"} event is tracked
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 18, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitbcf5d0e
Direct Downloadwoocommerce-wear-prototype-build-pr14986-bcf5d0e.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 18, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitbcf5d0e
Direct Downloadwoocommerce-prototype-build-pr14986-bcf5d0e.apk

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.54%. Comparing base (0985ed9) to head (bcf5d0e).

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14986      +/-   ##
============================================
+ Coverage     38.52%   38.54%   +0.02%     
- Complexity    10268    10270       +2     
============================================
  Files          2160     2160              
  Lines        122496   122533      +37     
  Branches      16864    16864              
============================================
+ Hits          47189    47228      +39     
+ Misses        70518    70517       -1     
+ Partials       4789     4788       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samiuelson samiuelson requested a review from Copilot November 20, 2025 16:07
@samiuelson samiuelson marked this pull request as ready for review November 20, 2025 16:08
@samiuelson samiuelson requested a review from kidinov November 20, 2025 16:08
Copilot finished reviewing on behalf of samiuelson November 20, 2025 16:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive analytics tracking for the local_catalog_sync_skipped event in WooCommerce POS, enabling monitoring of when and why catalog synchronization operations are being skipped. The implementation tracks both full and incremental sync skip scenarios with specific reason codes where applicable.

Key changes:

  • Introduced LocalCatalogSyncSkipped analytics event with sync_type parameter and optional skip_reason enum
  • Added five skip reason constants to categorize why syncs are skipped (POS inactive, sync not required, catalog disabled, sync check failed, no site selected)
  • Implemented analytics tracking in full sync worker with specific skip reasons for all scenarios
  • Implemented analytics tracking in incremental sync handler (without specific skip reasons)
  • Added comprehensive test coverage verifying analytics tracking in all skip scenarios

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
WooPosAnalyticsEvent.kt Added LocalCatalogSyncSkipped event class with sync type and optional skip reason properties
WooPosAnalyticsEventConstant.kt Defined SyncSkipReason enum with five skip reason constants
WooPosLocalCatalogSyncWorker.kt Integrated analytics tracking for all full sync skip scenarios with specific reasons
WooPosPerformLocalCatalogIncrementalSync.kt Added analytics tracking for incremental sync skip scenarios without specific reasons
WooPosLocalCatalogSyncWorkerTest.kt Updated tests to verify analytics tracking in all full sync skip cases, including new edge case test
WooPosPerformLocalCatalogIncrementalSyncTest.kt Refactored test structure and added analytics tracking verification for all incremental sync skip cases
WooPosProductsDataSourceTest.kt Minor test update to use more descriptive error message

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Update `WooPosPerformLocalCatalogIncrementalSync` to report why an incremental sync was skipped (e.g. no network, no site selected, or feature disabled).

Move pre-sync checks inside the coroutine scope to allow suspendable tracking and update unit tests.
@samiuelson samiuelson requested a review from Copilot November 20, 2025 16:32
Copilot finished reviewing on behalf of samiuelson November 20, 2025 16:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@samiuelson samiuelson added this to the 23.8 milestone Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants