Status, 11 October 2026: accepted by Dmitriy Zhuk and Yevhen Kariakin; not implemented. Proposed on 8 October 2026 in a brainstorming session with Yevhen Kariakin. Nothing on this page runs yet: the API talks to one kind of store today, through one implementation of one port, until iteration 6 in PLAN.md lands. The reference page is Platform drivers.
005 — One Commerce port, two kinds of driver
Every shop platform reaches the Store Deputy API through one port, and there are two kinds of driver behind it, not one per platform. A ModuleDriver speaks Module Protocol to any module installed in a shop (OpenCart 3, OpenCart 4, the WooCommerce plugin, PrestaShop) and does not know which platform answers. A ShopifyDriver calls the Shopify Admin API from the Store Deputy side, because a hosted platform has no module. A store carries a connection kind that selects its driver. Everything above the port, from the store lifecycle to the agent's tools, the change engine of decision 004 and the ledger, does not know the kind.
Context
The API already has a port with one implementation: IBridgeGateway (api/src/slices/store/store/domain/bridge.gateway.ts:21) with pair, revoke, describe, catalogSearch, catalogGet, catalogList, implemented by BridgeGateway over BridgeRepository, which builds, signs and verifies Module Protocol requests. StoreService calls the port and owns the lifecycle: connect, disconnect, pause, check, reachability, a manifest cache with a TTL, and a contact wrapper that records every result (api/src/slices/store/store/domain/store.service.ts:270). The Store row keeps platform as a string, endpointUrl, an encrypted secretEnc and the last manifest (api/src/slices/store/store/store.prisma). The port's methods are Module Protocol operations by name, and the credentials are the module's credentials by shape: a second kind of store does not fit.
Facts found while exploring:
- Shopify has no module. An app reaches a merchant's store with an access token obtained through the authorization code grant; the client credentials grant works only for stores in the app owner's own organization, and the Shopify documentation says static Admin API tokens of custom apps are no longer created (Shopify authentication, client credentials grant). Uninstalling the app arrives as a webhook. The Admin GraphQL API has no conditional price write; a driver reads, compares and writes.
- WooCommerce can go either way. Its REST API authenticates with a consumer key and secret as HTTP Basic Auth over HTTPS and has batch product and variation endpoints with no expected value (WooCommerce REST authentication). A plugin on the shared PHP core speaks Module Protocol instead: the conditional write is one SQL statement, WordPress hooks fire, and no write-capable admin key is stored in Store Deputy. Yevhen chose the plugin.
- CleanSlice puts an external service in a self-contained repository and the mapping to domain types in a gateway, and asks that an external effect be a durable operation with reconciliation of unknown outcomes (
architecture/reliable-operations.mdin the CleanSlice MCP).
Decision
- A new slice
store/driverowns the port.ICommerceDriverandIDriverRegistryare abstract classes in itsdomain/; the drivers are gateways in itsdata/, each over its own repository:ModuleRepository(today'sBridgeRepository, moved) andShopifyRepository(an Admin GraphQL client with API version and cost accounting).store/storekeeps the lifecycle and never imports a driver; it asks the registry for the store's driver by connection kind. The MCP server, the change engine and the catalog tools depend onStoreServiceand the port only.Store.platformstays informational; a newStore.connectionKind(moduleorshopify) selects the driver. - The port is the operation shape of decision 004.
describe,search,get,list,applywith the resource as a typed discriminator, andrevoke;connecttakes a request typed by kind. A driver never receives who is asking. The port's errors are the three that exist today: unreachable, refused with a code, capability unavailable. The port has no platform-specific method; a field the API needs is promoted into the neutral model, not into the port. - Credentials, connecting, revocation and Pause are per kind. Credentials become one encrypted envelope with a kind discriminator: endpoint, connection id and secret for a module; shop domain, offline access token, scopes and API version for Shopify. Connecting is today's code-and-pair flow for a module and the authorization code grant for Shopify. Revocation is
connection.revokefor a module and theapp/uninstalledwebhook for Shopify, received by a controller instore/driverthat verifies the webhook signature over the raw body and deduplicates by webhook id. Pause: a module has the owner's switch; Shopify has none, so its driver always reportspaused: false, and Store Deputy's own pause applies to every kind. - The manifest is the driver's. The module driver takes it from
store.describe. The Shopify driver builds it from the app's scopes: read scopes giveproduct.read,product.list,variant.read,order.read;write_productsgivesproduct.write.priceandvariant.write.pricewithconditional: emulated. The cache, its TTL and the forced refresh after connecting or a capability refusal are unchanged. The change engine recordsconditionalin the receipt, and the approval card for an emulated write tells the owner that the shop does not guarantee atomicity and that Store Deputy verifies by reading back. - Failure is reported the same way by every driver. A call ends as a result, a refusal with a code, unreachable, or unknown. A timeout or an unverifiable answer to
applyis unknown, the API reads the items back and classifies them as in reconciliation, and an unknown outcome is never retried as a new operation. Rate limiting on Shopify becomes a refusal with a retry time that the change engine waits for. Invalid credentials of either kind put the store into "needs reconnection".
Alternatives considered
- One driver per platform in the API (
OpenCartDriver,WooCommerceDriver,ShopifyDriver). Clear structure, but two of the three speak the same Module Protocol and would duplicate it, and the API would start to know the platform, against Protocol 1 and decision 004. Rejected: every new PHP platform would again need API code. - Everything through Module Protocol, Shopify as a "virtual module". A separate Store Deputy service that accepts signed Module Protocol requests and translates them to Shopify. One driver in the API forever, and the conformance suite covers Shopify unchanged. Rejected: an HMAC-signed hop to ourselves, an invented pairing without a module-issued code, one more deployable, and Shopify tokens in a second secret store. The conformance benefit is kept by running the suite against the port instead of the wire.
Consequences
- A new PHP platform touches nothing in the API. A new hosted platform adds one driver, one repository and one connect flow.
- The conformance suite (STOR-27) runs against the port: the same fixtures SD-001 to SD-008 and the same scenarios check the module driver against the local OpenCart shops and, when one exists, the Shopify driver against a test shop. A
FakeDriverimplements the port in memory and replaces today's fake module in the API tests. BridgeRepositorymoves and is renamed;IBridgeGatewayis replaced by the port. TheStorerow changes shape (connection kind, one credentials envelope). No connection is deployed, so there is nothing to migrate.- A Shopify test shop and a Partner app do not exist today. Until they do, the Shopify driver is proven only against recorded GraphQL fixtures, and every report must call that a simulation.
contracts:checkgains a check that the port andcontracts/module/protocol.yamlname the same resources, verbs and capabilities, so the module driver cannot drift from the wire.
Scope
In: the port, the slice layout, the two driver kinds, credentials and connecting per kind, the manifest per kind, failure reporting, how it is proved. Out: the reading strategy of the catalog tools, the split of the PHP module into a shared core and platform adapters (Protocol 1's adapter architecture, Artem's), the storefront entry point for the shopper agent, the Shopify install page on the site, a WooCommerce REST driver without a plugin.
Constraints and numbers
| Fact | Where |
|---|---|
| Port with one implementation, methods named after Module Protocol operations | api/src/slices/store/store/domain/bridge.gateway.ts:21 |
| Error mapping from module codes to the three port errors | api/src/slices/store/store/data/bridge.gateway.ts:76 |
| Request building, signing and response verification | api/src/slices/store/store/data/repositories/bridge/bridge.repository.ts:42 |
| Lifecycle wrapper that records every contact | api/src/slices/store/store/domain/store.service.ts:270 |
| Capability check and manifest refresh before a call | api/src/slices/store/store/domain/store.service.ts:258 |
Store row: platform, endpointUrl, secretEnc, manifest | api/src/slices/store/store/store.prisma |
| Shopify: authorization code grant for other merchants' stores; static custom-app tokens no longer created | Shopify documentation linked above |
| WooCommerce REST: consumer key and secret as Basic Auth; batch endpoints without an expected value | WooCommerce documentation linked above |
What this supersedes or must be reconciled with
- Extends decision 002: the "store REST module" of that decision becomes one driver kind among two. The three authority boundaries do not change; the driver still never learns who is chatting.
- Builds on decision 004: the port's operations are its resource × verb shape.
- Leaves Protocol 1's adapter architecture for the module side as it is; that split is Artem's and is not decided here.
contracts/, theStoreschema and the store slice change only after this record is accepted, with fixtures in the same change andbun run contracts:checkandbun run api:testpassing.
Open questions
| Question | Owner |
|---|---|
| The two-kind design was accepted on 11 October 2026. Still open: when does a Shopify Partner app and a test shop exist? | Dmitriy Zhuk |
| Shopify's official webhook retry and deduplication rules; only third-party summaries were read in this session. | yevhen.kariakin |
Where the catalog mirror lives and how the Shopify driver feeds it (webhooks versus list with updatedSince). Reading strategy, its own design. Decided in decision 006, its withdrawal proposed by decision 007: there is no copy, so webhooks feed nothing. | yevhen.kariakin |
| The split of the PHP module into a shared core and platform adapters, and the WooCommerce plugin on it. | Artem Belikov |
| Credential rotation per kind: the module cannot replace its secret yet; Shopify offline tokens are replaced by reinstalling. | yevhen.kariakin, Artem Belikov |
| How the Shopify install path appears on the site, and whether Connect starts in the Shopify admin or on the Store Deputy site. | Dmitriy Zhuk, yevhen.kariakin |