Fulfillment โ€“ Daily Changelog โ€“ September 25, 2025

sdgadfgasetGADZHSDFSDFGAE

2025-09-25 – Shipping Address Badge Reliability

Address Updated Badge False Positives

Problem Identified

  • Issue: The orders index was showing the ๐Ÿ“ Address Updated badge for nearly every order.
  • Impact: Team members lost trust in the badge, burned time double-checking shipping details, and worried that the sync/webhook pipeline was still broken.
  • History: Multiple prior “fixes” only disabled parts of the pipeline; the underlying comparison treated re-sent Shopify payloads as changes and kept flipping shipping_updated_at.bgrf

Solution Implemented

  • Deterministic Comparison: Normalize incoming and stored shipping records (trimming, lowercasing null-equivalents, JSON ordering) before comparing any fields.
  • True Change Detection: Exit early unless at least one normalized field actually changes; only then update the row and timestamp.
  • Safer Sync Refresh: Re-enabled the order-sync shipping refresh with guarded JSON parsing so existing records only move when Shopify genuinely edits the address.
  • Verbosity for Audits: Added focused debug logs enumerating the specific fields that changed to simplify future investigations.

Follow-Up & Monitoring

  • Let natural traffic run; no manual address edit needed to validate the fix.
  • Tomorrow morning, spot-check the orders page to confirm badges only appear on the handful of orders with legitimate address edits.
  • If any badge still misbehaves, pull the associated DB row and webhook payload for a quick diff using the new logging breadcrumbs.

QuickBooks Invoice Error

Problem Identified

  • Issue: Session lookups started selecting users.customer_id, which isnโ€™t in production, causing /api/auth/session to 500 while invoices were being pushed to QuickBooks.
  • Impact: The UI briefly showed โ€œApplication Errorโ€ after creating invoices; logs filled with column u.customer_id does not exist noise.

Solution Implemented

  • Join Table Restoration: Updated NextAuth JWT/session queries to pull store/customer context from user_stores โ†’ fulfillment_stores โ†’ customers, matching the live schema.
  • Shared Store Helper: Added a normalizeStores utility and rewired hooks/APIs (useCustomer, orders/products endpoints) to respect multi-store associations without relying on the missing column.
  • Type Safety: Extended next-auth typings so session consumers get structured store data in addition to the derived primary customer fields.

Follow-Up & Monitoring

  • After deployment, re-run the QuickBooks invoice flow to confirm no auth/session errors surface.
  • Keep an eye on Heroku logs for any lingering column ... does not exist messagesโ€”should be silent now.
  • Schedule the real users.customer_id migration separately, once weโ€™re ready to support parallel store assignments without regressions.