Skip to content

Fix unsupported IN operator for store_type filter in FetchStoreByDomain#6963

Open
ericlee878 wants to merge 1 commit intomainfrom
fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain
Open

Fix unsupported IN operator for store_type filter in FetchStoreByDomain#6963
ericlee878 wants to merge 1 commit intomainfrom
fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain

Conversation

@ericlee878
Copy link
Contributor

@ericlee878 ericlee878 commented Mar 10, 2026

Resolves: https://github.com/shop/issues-api-foundations/issues/1372

Summary

  • Fix FetchStoreByDomain using the unsupported IN operator for store_type filters on accessibleShops. The backend silently ignores unrecognized operators, so the filter was never applied and all stores were returned.
  • Switch to EQUALS operator via structured ShopFilterInput filters. Since the backend ANDs multiple filters, we fan out one request per store type and merge results.
  • Change storeByDomain return type from OrganizationStore | undefined to OrganizationStore[] so callers receive all matches across store types.

Implmentation Details

  • The IN operator is unsupported for STORE_TYPE filters in the business-platform-organizations API, and multiple filters are combined with AND logic. Since a store can't match multiple types simultaneously, we work around this by making one request per store type in parallel using EQUALS. Most call sites pass a single type (APP_DEVELOPMENT), so this is a no-op for the common path. The 4-type case (app logs, webhook trigger) makes 4 parallel requests instead of 1.

Test plan

  • Existing fetchStore tests updated and passing
  • Verify storeByDomain correctly filters by store type (previously all stores were returned regardless of type)
  • Regenerate GraphQL types from updated .graphql query

Tophat instructions:

  1. shopify app dev --path <your-app> : confirm dev store resolves normally
  2. shopify app dev --path <your-app> --store <non-dev-store-domain> : should fail with "store not found", confirming the store type filter is now applied (previously all stores were returned regardless of type)

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ericlee878 ericlee878 marked this pull request as ready for review March 10, 2026 00:51
@ericlee878 ericlee878 requested a review from a team as a code owner March 10, 2026 00:52
@github-actions
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

@ericlee878 ericlee878 marked this pull request as draft March 10, 2026 00:52
@binks-code-reviewer
Copy link

binks-code-reviewer bot commented Mar 10, 2026

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ No issues → ✅ No issues

@ericlee878 ericlee878 changed the title fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain Fix Mar 10, 2026
@ericlee878 ericlee878 changed the title Fix Fix unsupported in operator for store_type filter in FetchStoreByDomain Mar 10, 2026
@ericlee878 ericlee878 changed the title Fix unsupported in operator for store_type filter in FetchStoreByDomain Fix unsupported in operator for store_type filter in FetchStoreByDomain Mar 10, 2026
@ericlee878 ericlee878 changed the title Fix unsupported in operator for store_type filter in FetchStoreByDomain Fix unsupported IN operator for store_type filter in FetchStoreByDomain Mar 10, 2026
@ericlee878 ericlee878 force-pushed the fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain branch 3 times, most recently from 67ff436 to 01432b3 Compare March 10, 2026 01:55
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 79.13% 14575/18420
🟡 Branches 73.4% 7233/9854
🟡 Functions 79.25% 3713/4685
🟡 Lines 79.46% 13771/17331

Test suite run success

3816 tests passing in 1459 suites.

Report generated by 🧪jest coverage report action from 640fe55

@ericlee878 ericlee878 force-pushed the fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain branch 4 times, most recently from f9c7d85 to 995a335 Compare March 10, 2026 02:20
@ericlee878 ericlee878 marked this pull request as ready for review March 10, 2026 02:21
@ericlee878 ericlee878 force-pushed the fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain branch from 995a335 to 3b3e158 Compare March 10, 2026 02:28
const organization = storesResult.organization
async storeByDomain(orgId: string, shopDomain: string, storeTypes: Store[]): Promise<OrganizationStore[]> {
const results = await Promise.all(
storeTypes.map((storeType) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like pre-existing issue, but map is always synchronous, so this code is probably producing race conditions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for flagging! The map here is intentional. It builds an array of Promises (through businessPlatformOrganizationsRequest) that are immediately passed to Promise.all, so all requests run in parallel and we wait for all of them to resolve. No fire-and-forget happening.

@ericlee878 ericlee878 force-pushed the fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain branch from 3b3e158 to ed6ac63 Compare March 11, 2026 18:49
@ericlee878 ericlee878 force-pushed the fix-unsupported-in-operator-for-storetype-filter-in-fetchstorebydomain branch from ed6ac63 to 640fe55 Compare March 11, 2026 19:27
@ericlee878 ericlee878 requested a review from ryancbahan March 11, 2026 19:41
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.

2 participants