Skip to content

feat(shopify): run on shopify_api 1.0.0-rc.2 instead of a client of our own - #36

Merged
0xtlt merged 2 commits into
mainfrom
feat/shopify-api
Oct 27, 2026
Merged

0xtlt merged 2 commits into
mainfrom
feat/shopify-api

Conversation

@0xtlt

@0xtlt 0xtlt commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Every exchange with Shopify goes through shopify_api 1.0.0-rc.2. OpenShop keeps what is its own: which shop may get a token, the installations table, and the checks it makes beyond a signature.

What moved to shopify_api

  1. GraphQL: graphql! is shopify_api's, wrapped as openshop::graphql! with crate = ::openshop::shopify_api (and openshop::shopify::input! for input objects), so an app depends on openshop alone. It pins [package.metadata.shopify_api] api-version (2026-10 in the templates) and commits graphql/admin.schema.json, which openshop init now writes. Removed: openshop-graphql, openshop's macro, GraphqlOperation, openshop codegen.
  2. Client and tokens: ShopifyClient runs on shopify_api::Shopify (throttling, retries, 401 renewal; api() for pagination, bulk operations, webhook subscriptions). The client credentials grant, token exchange and OAuth code exchange are shopify_api requests. One shared client per app, shop and kind of grant serves concurrent callers; its TokenStore writes the row only where it still holds what was read. A refused grant falls back to the stored token, as before.
  3. Verification: session tokens, launches, OAuth callbacks, app proxy requests and webhooks.
  4. Transport: shopify_api runs without its own HTTP client. ReqwestTransport gives it the workspace's reqwest 0.12 and TLS stack, so there is no second reqwest and no aws-lc-rs next to ring. It still follows no redirection, caps whole answers at 10 MiB, and streams bulk results.

Behavior changes (stricter)

  • Session tokens: 10 s of clock skew, where nbf had 60 s. dest and iss must be written exactly as Shopify writes them.
  • Signed launches and app proxy requests: 90 s, where proxies had 5 min. A stale launch is now answered 401; it used to be served from the stored token.
  • Webhooks: the body must be a JSON object. The uninstall webhook needs its payload and its header to name the same shop.
  • Operations go to Admin API 2026-10, where they went to 2026-04. The MCP GraphQL tool accepts versions from 2026-04.

The full list is in the CHANGELOG.

Fixed in shopify_api rc.2

Found while porting, fixed in shopify_api and published as 1.0.0-rc.2 (0xtlt/shopify_api#33):

  • verify_app_proxy sorted the signed pairs by key; Shopify sorts the key=value strings. Requests with parameters like page/page2 were refused. Fixed.
  • Error::Auth now carries the token endpoint's status and OAuth code. openshop reads those fields instead of parsing the message to choose the 1 h or 30 s hold-back.
  • graphql! and input! take crate = path. openshop uses it, and the templates no longer list shopify_api.

Checks

  • cargo test --workspace --all-features: 1,259 passed, 0 failed (PostgreSQL 17). One webhook test failed once and then passed 3 runs in a row; it doesn't touch this change.
  • cargo clippy --workspace --all-targets -D warnings: clean.
  • mdbook build docs: OK.
  • A project generated by openshop init --template=minimal builds with the shipped schema, depending on openshop and serde only.

🤖 Generated with Claude Code

0xtlt and others added 2 commits October 27, 2026 08:15
…ur own

Every exchange with Shopify now goes through `shopify_api`. OpenShop keeps
what is its own: which shop may get a token, the `installations` table, and
the checks it makes beyond a signature.

- `graphql!` is `shopify_api`'s, re-exported. An app depends on
  `shopify_api`, pins `[package.metadata.shopify_api] api-version`
  (2026-10 in the templates) and commits `graphql/admin.schema.json`, which
  `openshop init` now writes. `openshop-graphql`, openshop's macro,
  `GraphqlOperation` and `openshop codegen` are removed.
- `ShopifyClient` runs on `shopify_api::Shopify`: throttling, retries, 401
  renewal, and `api()` for pagination, bulk operations and webhook
  subscriptions.
- The client credentials grant, the token exchange and the OAuth code
  exchange are `shopify_api` requests. One shared client per app, shop and
  kind of grant serves concurrent callers; its `TokenStore` writes the
  installation row only where it still holds what was read, and a refused or
  failed grant falls back to the stored token as before.
- Session tokens, launches, OAuth callbacks, app proxy requests and webhooks
  are verified by `shopify_api` (stricter: 10 s of JWT skew, exact
  `dest`/`iss`, 90 s for signed queries, JSON-object webhooks).
- `shopify_api` runs without its HTTP client: `ReqwestTransport` gives it
  the reqwest and the TLS of the workspace (no redirection, 10 MiB cap,
  streamed bulk results). `MockTransport` implements the same trait.

The breaking changes are listed in the CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p alone

- openshop::graphql! passes `crate = ::openshop::shopify_api` to the macro of
  shopify_api, and openshop::shopify::input! does the same for input objects:
  an application no longer lists shopify_api in its Cargo.toml. The templates
  drop it, and openshop re-exports the crate as openshop::shopify_api.
- A refusal of the token endpoint is read from the status and OAuth code that
  Error::Auth now carries, not parsed back from its message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xtlt 0xtlt changed the title feat(shopify): run on shopify_api 1.0.0-rc.1 instead of a client of our own feat(shopify): run on shopify_api 1.0.0-rc.2 instead of a client of our own Oct 27, 2026
@0xtlt
0xtlt merged commit f9fd330 into main Oct 27, 2026
0 of 12 checks passed
@0xtlt
0xtlt deleted the feat/shopify-api branch October 27, 2026 10:08
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.

1 participant