fix: route Fiesta-tenant orders through queue.workolik.com to Fiesta's own backend

jupiter and Fiesta are separate applications (separate repos, separate
binaries) that happen to share one Postgres instance. The previous fix
(661a08d) repointed queue.workolik.com's createorder from jupiter's v1 to
jupiter's v3 handler to stop items being silently dropped - that worked
because they share a database, but it was never the right target: jupiter
has no item-required guard, no atomic order-number allocation, no
stock-insufficient check, because none of that was ever written for
jupiter. Fiesta's own CreateOrderv3 already has all of it.

Added explicit tenant-based routing in worker.py: FIESTA_TENANT_IDS (seeded
with 1147/R mart and 1135/Suriya Store, the two confirmed so far) forces
createorder for those tenants to FIESTA_BASE_URL instead of jupiter's
mapping. Explicit allowlist rather than a DB heuristic, since jupiter and
Fiesta share one `tenants` table with no single column that cleanly
separates the two populations (checked: tenanttype/moduleid/categoryid/
configid are all inconsistent across the tenants that are known to belong
to each app). Non-Fiesta tenants keep going to jupiter's v3 endpoint
(661a08d), unaffected.

Verified live through the real queue.workolik.com path:
- Zero-item order (tenant 1147): worker log shows "Routing tenant 1147
  createorder to Fiesta backend", Fiesta correctly returns 400 "Order must
  contain at least one item", no phantom order created.
- Order with items (tenant 1147): itemcount=1, detail_count=1, product 7076
  stock ledger moved 25->24, then restored to 25 on cancel.

Expand FIESTA_TENANT_IDS as more Fiesta tenants are identified - there's no
programmatic way to auto-detect them from the shared tenants table.
This commit is contained in:
Suriya
2026-07-29 18:15:24 +05:30
parent 661a08d0b7
commit 58448f5faa
2 changed files with 50 additions and 7 deletions

View File

@@ -98,6 +98,14 @@ spec:
optional: true
- name: EXTERNAL_BASE_URL
value: "http://jupiter.nearle"
- name: FIESTA_BASE_URL
value: "http://fiesta.nearle"
# Known Fiesta tenants (R mart=1147, Suriya Store=1135, confirmed
# 2026-07-29). Expand as more are identified - see worker.py's
# FIESTA_TENANT_IDS comment for why this is an explicit list rather
# than a DB heuristic.
- name: FIESTA_TENANT_IDS
value: "1147,1135"
resources:
requests:
memory: "128Mi"