Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Jul 21, 2025

For WOOMOB-899

Just one review is required.

Why

A (likely edge case) scenario was brought up when the WooComemrce plugin's plugin path can be altered by certain hosts or another plugin, like WooCommerce Beta Tester plugin as in WOOMOB-896. This means that one of the common plugin matching patterns in the app using the full plugin path wouldn't work anymore, resulting in unexpected behavior like the store not being able to access POS.

How

From a previous discussion pdfdoF-3pF-p2#comment-4655 with the web team, we concluded that matching by just the filename without extension (e.g. */woocommerce.* in the example of WC plugin) in the plugin path is the most durable solution so far. This PR just updates the plugin matching for the POS use case, while leaving other use cases for the Backlog.

Implementation

This PR adds a new storage extension method loadSystemPlugin(siteID:fileNameWithoutExtension:active:) to support POS plugin matching by file name without extension.

The implementation uses regex pattern matching with NSPredicate format MATCHES for precise filename matching to support:

  • Supports both plugin types:
    • Single-file plugins: plugin-name.php
    • Folder-based plugins: folder/plugin-name.php
  • Exact matching: Prevents false positives (e.g., searching "woocommerce" won't match "woocommerce-extended.php")
  • Special character handling: Uses NSRegularExpression.escapedPattern(for:) to safely handle regex metacharacters in filenames

Steps to reproduce

Prerequisite: set up a JN store using the Woo Beta Tester plugin targeting trunk or a branch (example options screenshot in WOOMOB-896):

  • Log in to the JN store --> the POS tab should become visible
  • Tap on the POS tab --> it should enter POS items loaded state. before this PR, an ineligible UI is shown ("plugin not found")

Testing information

Tested in iPad mini iOS 18.5 simulator with WP store credentials login.

Screenshots

before after
Simulator Screenshot - iPad mini (A17 Pro) - 2025-07-21 at 15 07 09 Simulator Screenshot - iPad mini (A17 Pro) - 2025-07-21 at 15 08 59

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

…nsion for POS use case to fix scenario when plugin folder path is altered by plugins or hosts.
@jaclync jaclync added type: task An internally driven task. feature: POS labels Jul 21, 2025
@jaclync jaclync added this to the 22.9 milestone Jul 21, 2025
@jaclync jaclync changed the title Add storage extension to match system plugins by filename without extension [POS as a tab i2] Update WC plugin matching to use the file name in plugin path instead of full plugin path Jul 21, 2025
@jaclync jaclync changed the title [POS as a tab i2] Update WC plugin matching to use the file name in plugin path instead of full plugin path [POS as a tab i2] Update WC plugin matching to use the file name in plugin path instead of matching by full plugin path Jul 21, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 21, 2025

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

App NameWooCommerce iOS Prototype
Build Numberpr15931-322e50f
Version22.8
Bundle IDcom.automattic.alpha.woocommerce
Commit322e50f
Installation URL574t3ikcmvi98
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jaclync jaclync requested a review from staskus July 21, 2025 20:58
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

👍 Looks good. I haven't found issues with the regex itself. As you mentioned, we should complete a backlog task replace all the other calls to loadSystemPlugin using fileNameWithoutExtension version to avoid mismatching behavior 👍

@jaclync jaclync merged commit 24ef55a into trunk Jul 22, 2025
16 checks passed
@jaclync jaclync deleted the feat/WOOMOB-899-match-plugin-by-filename branch July 22, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants