Skip to content

Status, 12 October 2026: the accepted design from decision 005, implemented in part. Step B1 of iteration 6 (PLAN.md) extracted the port ICommerceDriver, the registry and the module driver into api/src/slices/store/driver/; the store slice chooses the driver by the store's connectionKind and never imports one. Step B2 made the driver speak the accepted contract: the neutral model and the resource × verb operations (product.search, product.get, product.list, product.apply), with a signed unknown_op read as "capability unavailable" and an untrustworthy apply answer read as "unknown". No module answers it yet: the OpenCart 3 module still answers the removed operations, so bun run store:test is red until it is rewritten; the API's tests run through FakeModule and FakeDriver. There is no Shopify driver and no credentials envelope per kind yet.

Update, 20 October 2026 (STOR-67): the fake module is gone from the API's tests. Every suite that talks to a store talks to the real OpenCart 3 module on the two local test shops, behind a reverse proxy in the tests that checks each request against the contract and can break the transport without changing the module's answers. FakeDriver remains for the catalog scan's page bound. Proven only on the local test shops, never on a real store.

Platform drivers: one port, two kinds ​

The Store Deputy API reaches every shop through one port, ICommerceDriver, and chooses one of two drivers by the store's connection kind. The ModuleDriver speaks Module Protocol to a module installed in the shop and does not know which platform answers; the ShopifyDriver calls the Shopify Admin API from Store Deputy's side. Everything above the port is the same for every shop.

MCP tools · change engine · catalog tools, live reads (decision 007)
            │
        StoreService  (lifecycle: connect, pause, check, reachability, manifest cache, contact record)
            │ asks the registry for the store's driver by connectionKind
        ICommerceDriver  (describe · search · get · list · apply · revoke · connect)
        ┌───────────────┴────────────────┐
   ModuleDriver                      ShopifyDriver
   ModuleRepository (envelope,       ShopifyRepository (Admin GraphQL,
   HMAC, transport)                  API version, cost accounting)
        │                                 │
   module in the shop: OpenCart 3,   Shopify Admin API of the merchant's store
   OpenCart 4, WooCommerce plugin,
   PrestaShop

Slice layout ​

SliceOwnsDoes not
store/storethe store lifecycle: connect, disconnect, pause, resume, check, status, reachability, the manifest cache and its TTL, the contact wrapper that records every resultimport a driver or a repository; know the connection kind beyond passing it to the registry
store/driverICommerceDriver and IDriverRegistry in domain/; ModuleDriver and ShopifyDriver as gateways in data/, each over its own repository; the webhook controller for Shopifyauthorize anyone, journal anything, or decide what the agent may do

Per CleanSlice an external service is a self-contained repository with its own types and no domain imports, and a gateway maps its output to domain types. ModuleRepository is today's BridgeRepository, moved; ShopifyRepository is new.

The Store row gains connectionKind (module or shopify) and replaces endpointUrl and secretEnc with one encrypted credentials envelope whose shape depends on the kind. platform stays an informational string from describe ("opencart", "woocommerce", "shopify"), shown and logged, never branched on.

The port ​

OperationTakesReturns
connect(request)a request typed by kind: pairing code, connection id, secret and display names for a module; the OAuth callback for Shopifycredentials envelope and the first manifest
describe(conn)manifest: platform, storefronts, currency, prices include tax, timezone, limits, capabilities with version and conditional, paused, warnings
search(conn, resource, criteria)identifiers or the resource's narrow criteriaevery match for every input
get(conn, resource, ids, options)1 to maxIdsPerRead idsitems, missing
list(conn, resource, { cursor, limit, updatedSince })items, nextCursor
apply(conn, resource, items)1 to maxItemsPerWrite items of { id, expected, set }one outcome per item
revoke(conn)nothing

conn is the connection: store id, kind, decrypted credentials, cached capabilities and when they were refreshed. The resource is a discriminator typed by the neutral model of Module Protocol 1, and the operations are the shape of decision 004. Three rules carry over from Protocol 1:

  • A driver never learns who is asking. No employee, conversation, agent or approval travels through the port. Authorization and approval are decided above it.
  • A driver keeps no journal and takes no idempotency key. Idempotency, the ledger and reconciliation are the change engine's.
  • A driver has no platform-specific method. A field the API needs is promoted into the neutral model; platform-only data stays in extensions.<platform>.

The port's errors are the three that exist today: StoreUnreachableError (something other than the driver's counterpart answered, or the address was refused), StoreRefusedError with a code, CapabilityUnavailableError. Each driver maps its own failures into them.

The two kinds ​

moduleshopify
PlatformsOpenCart 3, OpenCart 4, WooCommerce (plugin on the shared PHP core), PrestaShop; the driver does not know whichShopify
Credentialsendpoint URL, connection id, HMAC secretshop domain, offline access token, granted scopes, Admin API version
Connectingthe owner presses Connect in the module, gets a one-time code, signs in on the site, the API calls connection.pairthe merchant installs the app; the authorization code grant returns an offline token to the API (Shopify authentication)
Manifeststore.describe: the module declares exactly what it implementedbuilt by the driver from the scopes: read scopes give product.read, product.list, variant.read, order.read; write_products gives product.write.price and variant.write.price with conditional: emulated
Conditional writeone SQL statement where the platform allows it; conditional: atomicread, compare, productVariantsBulkUpdate; conditional: emulated
Product-saved eventfired by the module after an applied itemShopify fires its own webhooks
Revocationconnection.revoke, or the owner disconnects in the modulethe app/uninstalled webhook; verified over the raw body, deduplicated by webhook id, then the store is disconnected
Owner's Pause in the shopthe module's switch; paused in the manifestnone; the driver always reports paused: false. Store Deputy's own pause applies to both
Invalid credentialsunsigned not_pairedHTTP 401
Rate limitnone; the module declares timeBudgetMsHTTP 429 and extensions.cost; a refusal with a retry time

WooCommerce is the module kind by decision 005: the plugin keeps the conditional write atomic, lets WordPress hooks fire, and leaves no write-capable admin key in Store Deputy. A REST driver without a plugin is possible later and is not designed.

Failure, reported the same way ​

Every call through the port ends in exactly one of: a result, a refusal with a code, unreachable, or unknown. Unknown is a timeout, an unverifiable answer, or an answer that does not cover every item of an apply. The change engine then reads the items back through get and classifies each as applied, not applied or conflict, exactly as in reconciliation; it never resends an unknown item as a new operation. A rate-limit refusal carries a retry time and the change engine waits; it does not retry blindly. Invalid credentials of either kind mark the store as needing reconnection, and the agent sees the store as unreachable until the owner reconnects.

For an emulated conditional write the receipt records conditional: emulated, and the approval card tells the owner that the shop does not guarantee atomicity and that Store Deputy verifies the result by reading back.

How it is proved ​

LevelWhatReal or simulated
Conformance suite against the portthe fixtures SD-001 to SD-008 and the scenarios of STOR-27, called through ICommerceDriverreal against the module driver and the two local OpenCart shops; against the Shopify driver only when a test shop exists
FakeDriverimplements the port in memory and replaces today's fake module in api:test; every MCP and change-engine test goes through itsimulation, by design
Module driverbun run store:test against both local OpenCart shopsreal chain to a shop, as today
Shopify driverrecorded Admin GraphQL fixtures until a Partner app and a test shop existsimulation; every report must say so
Contract checkcontracts:check verifies that the port and contracts/module/protocol.yaml name the same resources, verbs and capabilitiesstatic

What exists on 12 October 2026: the store/driver slice with the port, the registry and the module driver speaking the accepted contract, Store.connectionKind (module for every row), FakeModule and FakeDriver in the API's tests. What does not: a real module that answers the contract, the Shopify repository, the webhook controller and the credentials envelope per kind.