Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Oct 24, 2025

WOOMOB-1576

Description

This PR consolidates the requirements for local catalog support duplicated across different places into a single, centralized check through the new WooPosIsLocalCatalogSupported class. This refactoring reduces duplication and simplifies the logic across multiple components.

Test Steps

This is purely a refactoring PR. It's important to analyze the code to make sure the business logic didn't change and smoke test the POS local catalog syncing behavior.

Images/gif

N/A

  • 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.

@samiuelson samiuelson requested a review from Copilot October 24, 2025 14:42
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 consolidates the various requirements for local catalog support into a single, centralized check through the new WooPosIsLocalCatalogSupported class. This refactoring reduces duplication and simplifies the logic across multiple components.

Key Changes:

  • Created WooPosIsLocalCatalogSupported class to centralize all local catalog support checks (feature flag, variations endpoint availability, and periodic sync settings)
  • Refactored WooPosLocalCatalogSyncWorker to use the consolidated support check instead of multiple individual validations
  • Updated WooPosFullSyncStatusChecker to delegate support checks to the new centralized class

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WooPosIsLocalCatalogSupported.kt New class that consolidates all local catalog support checks in one place
WooPosIsLocalCatalogSupportedTest.kt Test coverage for the new consolidated support checker
WooPosLocalCatalogSyncWorker.kt Simplified to use consolidated support check, removing redundant individual checks
WooPosLocalCatalogSyncWorkerTest.kt Updated tests to use new consolidated checker, removing tests for individual conditions
WooPosFullSyncStatusChecker.kt Refactored to use consolidated support check instead of individual validations
WooPosFullSyncStatusCheckerTest.kt Updated tests to reflect consolidated approach, removing redundant individual condition tests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@samiuelson samiuelson added the type: task An internally driven task. label Oct 24, 2025
@samiuelson samiuelson added this to the 23.6 milestone Oct 24, 2025
@samiuelson samiuelson marked this pull request as ready for review October 24, 2025 14:47
@wpmobilebot
Copy link
Collaborator

📲 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
Commit0868295
Direct Downloadwoocommerce-wear-prototype-build-pr14821-0868295.apk

@wpmobilebot
Copy link
Collaborator

📲 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
Commit0868295
Direct Downloadwoocommerce-prototype-build-pr14821-0868295.apk

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.24%. Comparing base (c6c68cf) to head (0868295).

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14821      +/-   ##
============================================
- Coverage     38.24%   38.24%   -0.01%     
+ Complexity    10088    10087       -1     
============================================
  Files          2130     2131       +1     
  Lines        120423   120416       -7     
  Branches      16490    16488       -2     
============================================
- Hits          46058    46048      -10     
- Misses        69710    69711       +1     
- Partials       4655     4657       +2     

☔ 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.

@malinajirka malinajirka self-assigned this Oct 27, 2025
Copy link
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

LGTM!

if (!prefsRepo.isPeriodicSyncEnabledForSite(siteId)) {
return false
}

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 We could consider having the catalog size check here as well - we could have a parameter, something like forceRefresh, that would indicate whether we actually check the catalog size or whether we use a cached value. Either case, it's not in scope of this PR, since it'd be more than just refactoring.

@malinajirka malinajirka merged commit ae1a066 into trunk Oct 27, 2025
19 checks passed
@malinajirka malinajirka deleted the woomob-1576-woo-poslocal-catalog-reuse-wooposfullsyncstatuschecker-in branch October 27, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants