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) andInstantSearchInitialResults(index + outlet filters) from the outlet page, then queriessearch.rituals.comfor 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_expensesfor rows stillNULL(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) viaattach_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¶
-
Redeploy service-omni and frontend (no new SQL for this patch).
-
Rituals: trigger manual scan or wait for cron — expect ~60–70 outlet products instead of 0.
-
Amazon returns: re-run import or wait for cron; backfill runs automatically on sync completion.
✅ Verify¶
- Rituals → manual scan → logs show
Algolia page 1/N returned … hitsandreplaced DB with … products; products list populated. - Analysis → expand a Main/Stock row → no Main share column; Share of combined % present; before-return-costs values in darker green.
- Main table Combined profit matches expand panel combined total for the same SKU/period.
- Amazon returns sync → log includes
refund_expenses backfill; rows from last 7 days getrefund_expenseswhen Finances data is available. - Tests:
pytest backend/service_omni/app/tests/test_amazon_returns.pypytest backend/service_omni/app/tests/test_plenty_order_enrichment.pypytest backend/service_multi-repricer/app/tests/test_article_stats.py
Files touched (high level)¶
service-omni — rituals_outlet_monitor.py, returns_enrichment.py, amazon.py, fee_estimation.py, order_enrichment.py
service-multi-repricer — article_stats.py (stock consumer rollups)
frontend — AnalysisStockExpandPanel.jsx, AnalysisArticles.jsx
docs — this 1.9.3 note
Related docs¶
- Rituals outlet monitor
- Profit imports, order economics & Analysis
- Article sales & profit statistics
- Patch 1.9.2 — prior release (orders economics, refund_expenses schema, Main/Stock expand API)