Fix unsupported IN operator for store_type filter in FetchStoreByDomain#6963
Fix unsupported IN operator for store_type filter in FetchStoreByDomain#6963ericlee878 wants to merge 1 commit intomainfrom
IN operator for store_type filter in FetchStoreByDomain#6963Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ No issues → ✅ No issues |
FetchStoreByDomain
FetchStoreByDomainIN operator for store_type filter in FetchStoreByDomain
67ff436 to
01432b3
Compare
Coverage report
Test suite run success3816 tests passing in 1459 suites. Report generated by 🧪jest coverage report action from 640fe55 |
f9c7d85 to
995a335
Compare
995a335 to
3b3e158
Compare
| const organization = storesResult.organization | ||
| async storeByDomain(orgId: string, shopDomain: string, storeTypes: Store[]): Promise<OrganizationStore[]> { | ||
| const results = await Promise.all( | ||
| storeTypes.map((storeType) => |
There was a problem hiding this comment.
looks like pre-existing issue, but map is always synchronous, so this code is probably producing race conditions
There was a problem hiding this comment.
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.
packages/app/src/cli/api/graphql/business-platform-organizations/generated/types.d.ts
Show resolved
Hide resolved
3b3e158 to
ed6ac63
Compare
ed6ac63 to
640fe55
Compare

Resolves: https://github.com/shop/issues-api-foundations/issues/1372
Summary
FetchStoreByDomainusing the unsupportedINoperator forstore_typefilters onaccessibleShops. The backend silently ignores unrecognized operators, so the filter was never applied and all stores were returned.EQUALSoperator via structuredShopFilterInputfilters. Since the backendANDs multiple filters, we fan out one request per store type and merge results.storeByDomainreturn type fromOrganizationStore | undefinedtoOrganizationStore[]so callers receive all matches across store types.Implmentation Details
INoperator is unsupported forSTORE_TYPEfilters in the business-platform-organizations API, and multiple filters are combined withANDlogic. Since a store can't match multiple types simultaneously, we work around this by making one request per store type in parallel usingEQUALS. 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
fetchStoretests updated and passingstoreByDomaincorrectly filters by store type (previously all stores were returned regardless of type).graphqlqueryTophat instructions:
shopify app dev --path <your-app>: confirm dev store resolves normallyshopify 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)