← back to Designer Wallcoverings

audits/new-arrivals-boost-scope/diagnose.sh

33 lines

#!/usr/bin/env bash
# New Arrivals / Boost scope diagnostic — read-only.
# Proves: Shopify-native collection membership (~586) vs Boost-rendered storefront (27,726).
set -euo pipefail
cd "$(dirname "$0")/../.."
TOKEN=$(grep SHOPIFY_ADMIN_TOKEN .env | sed 's/.*=//' | tr -d '\r\n ')
DOMAIN="designer-laboratory-sandbox.myshopify.com"

echo "== 1. Smart collection rule + true count (Admin API) =="
curl -s "https://$DOMAIN/admin/api/2024-10/graphql.json" \
  -H "X-Shopify-Access-Token: $TOKEN" -H "Content-Type: application/json" \
  -d '{"query":"{ collection(id:\"gid://shopify/Collection/167327760435\"){ title handle sortOrder ruleSet{appliedDisjunctively rules{column relation condition}} productsCount{count} } }"}' \
  | python3 -m json.tool

echo "== 2. Shopify-NATIVE membership (bypasses Boost) =="
total=0
for p in 1 2 3 4; do
  c=$(curl -s -A "Mozilla/5.0" "https://www.designerwallcoverings.com/collections/new-arrivals/products.json?limit=250&page=$p" \
      | python3 -c "import sys,json;print(len(json.load(sys.stdin).get('products',[])))")
  echo "  native page $p: $c"; total=$((total+c)); [ "$c" -lt 250 ] && break
done
echo "  NATIVE TOTAL (Boost-independent): $total"

echo "== 3. Oldest active Wallcoverings — are they tagged 'New Arrival'? (should be False) =="
curl -s "https://$DOMAIN/admin/api/2024-10/graphql.json" \
  -H "X-Shopify-Access-Token: $TOKEN" -H "Content-Type: application/json" \
  -d '{"query":"{ products(first:5, query:\"status:active product_type:Wallcovering\", sortKey:CREATED_AT, reverse:false){ edges{ node{ title createdAt tags } } } }"}' \
  | python3 -c "import sys,json; [print(n['node']['createdAt'][:10], 'NewArrival='+str('New Arrival' in n['node']['tags']), n['node']['title'][:50]) for n in json.load(sys.stdin)['data']['products']['edges']]"

echo
echo "EXPECTED: collection count ~586, native total ~500, oldest tagged=False."
echo "If the Boost storefront still shows ~27,726 -> Boost is not scoped to the collection (server-side index/scope bug)."