Skip to content

Optional verified customer identity via Shopify customer-account sign-in - #17

Merged
codeyogi911 merged 1 commit into
mainfrom
feat/shopify-customer-sign-in
Aug 8, 2026
Merged

Optional verified customer identity via Shopify customer-account sign-in#17
codeyogi911 merged 1 commit into
mainfrom
feat/shopify-customer-sign-in

Conversation

@codeyogi911

@codeyogi911 codeyogi911 commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Closes #15.

What

Anonymous visitors keep today's experience — knowledge-grounded simple answers, progressive contact card when needed. A customer who signs in with the deployment's Shopify store account gets the verified rail:

  • No contact card, ever — the store-account session is verified contact on file, and it survives WebSocket reconnects by transport (the cookie re-arrives on every upgrade).
  • Order questions without an order number — a new list_my_orders tool serves the signed-in caller's five most recent orders (names, status, totals, tracking) so the assistant confirms which order they mean instead of sending them hunting for a number. Explicit numbers still use the existing possession-checked get_order_status.
  • Sign in / sign out affordances on the assistant homepage, config-gated.

How

  • New deep module src/identity/shopify-customer.ts: Customer Account API endpoints resolved through the shop's discovery documents; authorization-code flow with PKCE (public client); signed single-use login transactions for the redirect round-trip; HMAC-signed short-lived session cookies (customer-capability secret); bounded customer-context GraphQL validated against the 2026-07 schema. Typed unavailable on any provider failure — raw errors never reach the model.
  • Routes /auth/shopify/{start,callback,logout} on the public surface. Every failure path returns the visitor to the portal as anonymous — sign-in never blocks support.
  • Prompt: the signed-in variant replaces the ask-for-the-number instruction rather than contradicting it (the model follows the last directive it sees).
  • Dormant until a deployment sets SHOPIFY_CUSTOMER_CLIENT_ID (Customer Account API public client) alongside the existing shop domain; setup steps added to the deployment guide. Multipass intentionally not used — it requires Shopify Plus.

Validation

  • npm run check green: 233 tests including the new identity-module suite (PKCE/state/expiry/tamper/projection), auth-route tests, and agent tests for verified sessions and tampered tokens.
  • npm run eval:voice: 13/14 with a new real-model case proving the signed-in flow (list_my_orders called, order referenced, no number requested). The one failure is the pre-existing flaky unfamiliar-product case tracked separately.

🤖 Generated with Claude Code

@codeyogi911
codeyogi911 enabled auto-merge (squash) August 8, 2026 03:39
…t sign-in

Anonymous visitors keep the progressive contact flow and knowledge-grounded
answers; a customer who signs in with the deployment's Shopify store account
gets a verified rail: no contact card, tickets filed under the verified
identity, and order questions answered without an order number.

- New identity module: discovery-resolved Customer Account API endpoints,
  authorization-code flow with PKCE for a public client, signed single-use
  login transactions, HMAC-signed short-lived session cookies, and a bounded
  customer context read (profile plus five recent orders with status and
  tracking) validated against the 2026-07 schema. Provider failures are typed
  'unavailable'; every sign-in failure path lands back on the portal as
  anonymous.
- /auth/shopify/start, /callback, and /logout routes on the public surface,
  config-gated by SHOPIFY_CUSTOMER_CLIENT_ID plus the shop domain.
- The assistant treats a store-account session as verified contact on file —
  the card never appears — and gains list_my_orders for signed-in callers.
  The session cookie re-arrives on every WebSocket reconnect, so verified
  identity survives connection drops by transport. The signed-in prompt
  replaces the ask-for-the-number instruction instead of contradicting it.
- Sign-in affordance on the assistant homepage; deployment guide section for
  creating the Customer Account API client.
- Coverage: identity module unit tests, auth route tests, agent tests for the
  verified session and tampered tokens, and a real-model eval case for the
  signed-in order flow (passes; the pre-existing unfamiliar-product how-to
  case remains the known flaky one).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codeyogi911
codeyogi911 force-pushed the feat/shopify-customer-sign-in branch from e2f37e6 to b8469ef Compare August 8, 2026 03:41
@codeyogi911
codeyogi911 merged commit c93e97d into main Aug 8, 2026
5 checks passed
@codeyogi911
codeyogi911 deleted the feat/shopify-customer-sign-in branch August 8, 2026 03:43
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.

Optional verified customer identity via Shopify customer-account sign-in

1 participant