Skip to content

Add ShopifySovereignBridge for Robert biometric cart sync and inventory adjustment#121

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/sync-robert-to-shopify
Draft

Add ShopifySovereignBridge for Robert biometric cart sync and inventory adjustment#121
Copilot wants to merge 2 commits intomainfrom
copilot/sync-robert-to-shopify

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Implements ShopifySovereignBridge — a class bridging the Robert biometric engine with Shopify's Admin API to inject fit-score metadata into draft orders and propagate Armario Solidario stock changes.

Changes

api/shopify_bridge.py

  • ShopifySovereignBridge.__init__(api_key, shop_url) — normalises shop_url (strips scheme/path), builds api_base against SHOPIFY_ADMIN_API_VERSION (default 2026-04), and sets auth headers.
  • sync_robert_to_shopify(look_id, engine_metrics) — POSTs a draft order with Robert_Fit_Score and Biometric_Validation line-item properties; returns the invoice_url from the response, a fallback label, or None on failure.
  • update_inventory_physics(fabric_key, stock_change) — calls inventory_levels/adjust.json mapping fabric_keyinventory_item_id with location_id read from SHOPIFY_LOCATION_ID env var; returns bool success.

tests/test_shopify_bridge.py (new)

19 unit tests covering init URL/header construction, draft-order payload shape, HTTP error and exception paths, and inventory adjustment payload mapping.

Usage

bridge = ShopifySovereignBridge(api_key=os.environ["SHOPIFY_ADMIN_ACCESS_TOKEN"],
                                 shop_url="mystore.myshopify.com")

# Inject Robert fit score into a Shopify draft order
url = bridge.sync_robert_to_shopify(look_id=variant_id, engine_metrics={"fitScore": 94})

# Sync stock when Armario Solidario withdraws a garment
# Requires SHOPIFY_LOCATION_ID env var (numeric Shopify location ID)
bridge.update_inventory_physics(fabric_key="inventory_item_id_here", stock_change=-1)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tryonyou-pilot Error Error Apr 7, 2026 1:49pm

Request Review

Copilot AI changed the title [WIP] Add functionality to sync Robert metrics to Shopify Add ShopifySovereignBridge for Robert biometric cart sync and inventory adjustment Apr 7, 2026
Copilot AI requested a review from LVT-ENG April 7, 2026 13:51
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.

2 participants