CROP
ProjectsCROP Frontend

Tire Implementation: Deployment Plan

The tire pages are broken because:

Tire Implementation: Deployment Plan

Problem Summary

The tire pages are broken because:

  1. Search service not deployed - Revision search-service-00310-mrr is missing the multi-index fix (commit 77744e8)
  2. ES tire slugs use OLD format - Index has kmt-* slugs but frontend expects ct-kmt-*

Evidence

# Tire index EXISTS and has 7091 documents:
curl 'https://api.crop-dev.app/ready' | jq '.indices.tires'
# → { alias: "tires_current", target: "tires_v2026_01_21", docCount: 7091 }

# Search works with manufacturer=KMT:
curl 'https://api.crop-dev.app/api/search?manufacturer=KMT&limit=1' | jq '.parts[0]'
# → { id: "...", slug: "kmt-04493560000", partNumber: "04493560000" }

# BUT parts endpoint returns 404 (even for OLD slug format):
curl 'https://api.crop-dev.app/api/parts/kmt-04493560000'
# → {"error":"not_found"}

# Deployed revision is OUTDATED:
curl 'https://api.crop-dev.app/ready' | jq '.revision'
# → "search-service-00310-mrr"

Root Cause

The /api/parts/:id endpoint in deployed revision uses only env.SEARCH_INDEX_NAME (parts index), not getAllSearchIndices() which searches both indices. The fix exists in commit 77744e8 but is NOT deployed.

Deployment Steps

Step 1: Deploy Search Service (CRITICAL)

cd /Users/vova/Code/CROP/CROP-parts-services

# Deploy to stage
gcloud run deploy search-service \
  --source . \
  --region us-east1 \
  --project noted-bliss-466410-q6

# Verify deployment
curl 'https://api.crop-dev.app/ready' | jq '.revision'
# Should show new revision number

# Test parts endpoint
curl 'https://api.crop-dev.app/api/parts/kmt-04493560000' | jq '{found: (.part != null), slug: .part.slug}'
# Should return: { found: true, slug: "kmt-04493560000" }
cd /Users/vova/Code/CROP/CROP-parts-services

# Run the GCP rebuild script
bash services/search/scripts/gcp-rebuild-tires-index.sh

# Verify new slugs
curl 'https://api.crop-dev.app/api/search?manufacturer=KMT&limit=1' | jq '.parts[0].slug'
# Should return: "ct-kmt-04493560000"

Step 3: Verify End-to-End

# Test tire detail page via parts endpoint
curl 'https://api.crop-dev.app/api/parts/ct-kmt-04493560000' | jq '{found: (.part != null)}'

# Open in browser
open 'http://localhost:3000/tires/ct-kmt-04493560000'

Timeline

StepActionTimeBlocker
1Deploy search service~5 minNone
2Rebuild tires index~15 minStep 1
3Verify frontend~2 minSteps 1, 2

Rollback Plan

If deployment causes issues:

# Rollback to previous revision
gcloud run services update-traffic search-service \
  --to-revisions search-service-00310-mrr=100 \
  --region us-east1 \
  --project noted-bliss-466410-q6

Summary

Why tire pages show "Tire not found":

  1. Frontend calls /api/parts/ct-kmt-04493560000
  2. Backend (old revision) only searches parts_current index
  3. Tire exists in tires_current index with slug kmt-04493560000
  4. Backend returns 404 because it doesn't search tire index
  5. Frontend fallback tries kmt-04493560000 but also fails (same reason)

After deployment:

  1. Frontend calls /api/parts/ct-kmt-04493560000
  2. Backend (new revision) searches BOTH parts_current AND tires_current
  3. Tire found in tires_current (with OLD slug kmt-04493560000)
  4. Frontend shows tire page!

Notes

  • MongoDB migration already done (7091 tires have new slugs ct-kmt-*)
  • ES index rebuild will sync slugs between MongoDB and ES
  • Frontend has fallback for OLD slug format (temporary, until ES rebuild)

On this page