Skip to content

1.9.3

⚙️ Patch 1.9.3 — Rituals outlet Algolia scrape, Analysis expand UX & refund backfill

🚀 Summary

Rituals outlet monitor

  • Rituals migrated the outlet to Next.js + Algolia; legacy HTML selectors (js-total-products, product-tile) no longer exist and the monitor returned 0 products.
  • Scraper now reads PUBLIC_CONFIG (Algolia app/key/proxy) and InstantSearchInitialResults (index + outlet filters) from the outlet page, then queries search.rituals.com for all hits and upserts as before.
  • Structured logging added for manual/cron runs (page diagnostics, Algolia pagination, new-item alerts).

Analysis (Main/Stock expand)

  • Removed the Main share € column from the composition table (confusing vs full bundle P&L); Share of combined % kept for rollup attribution.
  • Before return costs profit column uses a darker green (success.dark) to distinguish it from net profit.
  • Articles tab filters: Type (Main / Bundle / Bundle shell / Bundle item / Single) and Has Details → Plenty (Shopify ∪ Kaufland ∪ Otto ∪ FBM, excludes FBA).

Amazon returns

  • After each FBA returns sync, a 7-day backfill re-fetches Finances refund_expenses for rows still NULL (Finances API often lags ~48h).

Plenty order enrichment

  • 1:1 Otto bundle fee sync only copies fee/profit from a peer when that peer has Otto channel rates (otto_provision_pct > 0), not merely any FBM fee data.

Analysis table rollups

  • Main/Stock table rows now show combined_period_profit (single + bundle attribution) via attach_stock_supplier_rollups, matching the expand panel total.

✨ Details

Area Behavior
Rituals scrape GET /de-de/outlet → parse config → Algolia query with outlet filters → map tradeCode, productTitle_de, slug_de, displayPrice, inStockEcom
Rituals fallback Legacy product-tile HTML path retained if Algolia bootstrap is absent
Rituals logging Manual scan start/finish; missing legacy selectors; Algolia page hits / nbHits
Analysis expand Bundle rows show full SKU profit (net); share % still buy-weight based for combined rollup
Amazon backfill backfill_missing_refund_expenses(db, creds, days=7) after _do_sync_amazon_returns
Plenty fee sync fee_context_has_channel_rates() is channel-specific (Otto / Shopify / Kaufland / Amazon FBM)
Analysis Main row period_profit on table = combined net profit; tooltip/raw single profit unchanged in API where exposed

🔧 Deploy

  1. Redeploy service-omni and frontend (no new SQL for this patch).

  2. Rituals: trigger manual scan or wait for cron — expect ~60–70 outlet products instead of 0.

  3. Amazon returns: re-run import or wait for cron; backfill runs automatically on sync completion.

✅ Verify

  1. Rituals → manual scan → logs show Algolia page 1/N returned … hits and replaced DB with … products; products list populated.
  2. Analysis → expand a Main/Stock row → no Main share column; Share of combined % present; before-return-costs values in darker green.
  3. Main table Combined profit matches expand panel combined total for the same SKU/period.
  4. Amazon returns sync → log includes refund_expenses backfill; rows from last 7 days get refund_expenses when Finances data is available.
  5. Tests:
  6. pytest backend/service_omni/app/tests/test_amazon_returns.py
  7. pytest backend/service_omni/app/tests/test_plenty_order_enrichment.py
  8. pytest backend/service_multi-repricer/app/tests/test_article_stats.py

Files touched (high level)

service-omnirituals_outlet_monitor.py, returns_enrichment.py, amazon.py, fee_estimation.py, order_enrichment.py

service-multi-repricerarticle_stats.py (stock consumer rollups)

frontendAnalysisStockExpandPanel.jsx, AnalysisArticles.jsx

docs — this 1.9.3 note