# Session handoff — resume here

## Where we are
All code for the Maison Fayard wine-club system is **built and tested locally** (see
[README.md](README.md) and [DEPLOYMENT.md](DEPLOYMENT.md)). We were about to create the
metaobjects + seed the Q2 cycle on the live store, but the Shopify connection in the
previous chat session got stuck (a store-switch revoked that session's token and it
couldn't re-auth). Everything below is ready to execute.

## ⚠️ CRITICAL: Maison Fayard is a COLLABORATION store
Confirmed in the dev dashboard (Stores → Collaborations): the store is **owned by a
different Shopify org**; Darryn has **collaborator** access. Consequences:
- ❌ client-credentials grant → 400 (only works same-org). Do NOT use for the Worker.
- ❌ dev-dashboard app tokens (`atkn_`, app automation token) → 401 (bound to Darryn's
  org, not the client store). Dead end.
- ✅ **claude.ai Shopify MCP connector** (authenticates as Darryn's collaborator login) —
  this is the path for API-driven build. Worked at session start.
- ✅ **Browser agent driving the Admin UI** (also collaborator auth) — can create
  metaobjects by clicking; a ready paste is in the last chat / KICKOFF-ADMIN-UI.
- Worker runtime token: must be an **offline OAuth-install token** or a store-level custom
  app token (owner must enable custom app dev), NOT client-credentials.

## Store facts (confirmed)
- Store admin handle: **`maison-fayard`**; internal domains **`grs60a-y0.myshopify.com`**
  AND **`maison-fayard.myshopify.com`** (both connected). Public: www.maisonfayard.com.
- Org (Darryn's dev dashboard): 225365807. Store owner org: Maison Fayard (separate).
- The **claude.ai Shopify connector has been reconnected to Maison Fayard** by the user.
  A FRESH session should reach it directly — first action: call `get-shop-info` and
  confirm it returns "Maison Fayard", NOT "Zayr".
- Dev-dashboard app **"wine-club-api-2"** exists with all needed scopes (metaobjects,
  customers, draft_orders, orders, products), legacy install flow on. Its Admin token
  (`atkn_…`) 401'd earlier because the app wasn't installed on the store — the Worker
  will need a valid installed-app token later, but it is NOT needed for the build below.

## Immediate next steps (do via the Shopify MCP once get-shop-info works)
1. **Create metaobject + metafield definitions** — run the 5 mutations in
   [metaobjects/definitions.graphql](metaobjects/definitions.graphql) via
   `graphql_mutation`. (2 metaobject defs, 3 wine product metafields, 1 customer
   selection metafield.)
2. **Read real product GIDs** — `search_products` for the wines that go in the Q2 pools;
   record variant IDs + prices.
3. **Seed Q2 2026** — follow [metaobjects/seed-q2-2026.md](metaobjects/seed-q2-2026.md):
   create the `q2-2026` cycle + one `wineclub_tier_pool` per tier with real GIDs.
4. **Set wine product metafields** (`wineclub.vintage`, `wineclub.wine_type`,
   `wineclub.catalog_group`) on each wine — confirm values with the client.
5. **Upload theme files** from `theme/` and create page `/pages/wine-club-customize`.
6. **Deploy the Worker** (`app-proxy/`) — needs a valid installed-app Admin token +
   secrets; see DEPLOYMENT.md.

## Locked decisions (don't re-litigate)
- Backend = thin Cloudflare Worker behind App Proxy.
- "Add bottles" = one-time, this shipment only.
- Pricing = live Shopify variant price.
- Swap pool = curated per-tier pool.

## Still pending from client
- Appstle API key + exact plan-swap endpoint; does Appstle already generate the renewal
  order? (decides fulfillment strategy)
- Email provider key (Resend) + from-address.
- Two edge-case rulings: out-of-stock substitution; unpaid add-ons at close.
- Which wines are the default box vs. swap pool per tier for Q2.
