Technical Debt — Warehouse Master Gaps
| Metadata | Details |
|---|---|
| System | inventory-service — Warehouse Master |
| Document ID | TD-2026-INV-003 |
| Author | Engineering Team |
| Status | Open |
Gaps referenced from SR-022 and Architecture-00017.
TD-01 — No Admin Surface for Reassigning is_main
Status: Open
Severity: Medium
Affected component: inventory-service’s warehouse table (is_main column); transport/api/warehouse/, WarehouseFormPage.tsx
Evidence: "inventory-service".warehouse enforces uq_warehouse_tenant_main (exactly one row with is_main = true per tenant), but no endpoint or form field exists to view which warehouse currently holds that flag or to transfer it to another.
Impact: The single main warehouse — the one checkout’s GST/Shiprocket resolution falls back to — can currently only have been set by whatever seeded or first-created the row; a tenant cannot correct this through the admin console without a direct database write.
Remediation direction: Add a read-only “Main warehouse” indicator to WarehousePage.tsx’s list, plus a POST /inventory/admin/api/v1/warehouses/:id/set-main endpoint that atomically unsets the previous main warehouse and sets the new one in a single transaction.
Related requirement: SR-022 FR-11
TD-02 — Backend Validation Weaker Than Frontend
Status: Open
Severity: Medium
Affected component: service/warehouse/, WarehouseFormController.ts
Evidence: Required-field and format checks (phone-number shape, pincode format, non-empty address lines) run only in WarehouseFormController.ts’s client-side validation; service/warehouse/Create/Update accept whatever pii-service’s UpsertAttributes accepts, which performs no field-shape validation of its own.
Impact: A direct API call that bypasses the admin UI (a script, a future bulk-import path, a malformed retry) can persist a warehouse with a missing or malformed address/contact field, since nothing server-side rejects it.
Remediation direction: Port WarehouseFormController.ts’s required/format rules into a domain/warehouse_validation.go rule set that service/warehouse/Create/Update runs before calling pii-service, mirroring the pattern Package Master’s FR-06 already uses for its own fields.
Related requirement: SR-022 FR-05
TD-03 — Unretried Compensating DeleteAttributes Call
Status: Open
Severity: Low
Affected component: service/warehouse/Delete
Evidence: service/warehouse/Delete deletes the local Postgres row first, then calls pii-service’s DeleteAttributes as a compensating step; if that second call fails (network blip, pii-service unavailable), the error is returned to the caller but the local row is already gone — there is no retry, outbox, or reconciliation job.
Impact: A failed compensating delete leaves orphaned PII rows in pii-service keyed to a warehouse UUID that no longer exists anywhere else, with no automated path to detect or clean them up.
Remediation direction: Either reorder the two calls (delete PII first, local row second, so a failure leaves the local row intact and retryable) or introduce an outbox-pattern retry for the compensating call — consistent with how other cross-service compensating writes in this monorepo are expected to be hardened.
Related requirement: SR-022 FR-10