Technical Debt — Multi-Courier Fulfillment Gaps

By Engineering Team•October 2, 2026•4 min read
Metadata Details
System Multi-Courier Fulfillment
Document ID TD-2026-FUL-001
Author Engineering Team
Status Open

This document tracks known implementation gaps in shipment-service’s Shiprocket integration as first-class, ongoing debt items. SR-011 links here rather than restating gap detail, so the requirement text itself doesn’t quietly read as an already-met guarantee.


TD-01 — SSE tracking broker is single-instance, with no replay on scale-out

  • Status: Open
  • Severity: Medium — a correctness gap only once this service runs more than one replica, not a routine occurrence today.
  • Affected component: shipment-service — the in-memory, per-order SSE broker backing GET /shipment/api/v1/order/:id/stream.
  • Evidence: The broker is a buffered channel per order held in this service’s own process memory, with a non-blocking send on publish. A client connecting to a different instance than the one that received a given courier-scan webhook has no way to receive that scan — there is no shared, cross-instance event store behind the stream.
  • Impact: If shipment-service is ever scaled beyond a single instance, a customer watching the live tracking screen can silently miss a status update, and only a later catch-up reconnect to the same instance that held the missed event would surface it — not a guaranteed recovery.
  • Remediation direction: Move the broker’s event history to a shared store (e.g. the same MongoDB collection already holding scans[], read on catch-up and tailed for live updates) or a pub/sub-backed fan-out, rather than in-process channels — justified once this service actually needs to scale beyond one instance, not before.
  • Related requirement: SR-011 NFR-04

TD-02 — No automated non-delivery (NDR) or delivery-exception workflow

  • Status: Open
  • Severity: Medium — an operational gap, not a correctness bug; a failed delivery is still visible, just not actioned automatically.
  • Affected component: shipment-service’s tracking-webhook receiver and shipment_shiprocket_tracking collection.
  • Evidence: A non-delivery or delivery-exception status arriving via the Shiprocket webhook is recorded into scans[] like any other status and pushed onto the SSE stream, but nothing further happens — there is no automated retry scheduling, customer re-attempt notification, or operations queue triggered by this status the way a dedicated NDR workflow would provide.
  • Impact: A failed delivery depends on someone (operations staff or the customer) noticing the status manually; at meaningful order volume this does not scale and risks delivery exceptions going unresolved past a reasonable window.
  • Remediation direction: Add a status-transition handler in the webhook receiver that recognizes a non-delivery/exception status code and triggers a defined next action (an operations alert, an automated customer notification, or a scheduled re-attempt call to Shiprocket) — scope and exact trigger set is a product decision, not yet made.
  • Related requirement: SR-011 NFR-06

TD-03 — Single fixed pickup-location assumption

  • Status: Open
  • Severity: Low today — no known incident; becomes a real blocker only once the business operates more than one warehouse.
  • Affected component: shipment-service’s repository/shiprocket/shiprocket_create_order.go and its SHIPROCKET_PICKUP_LOCATION_NAME configuration.
  • Evidence: The pickup-location name sent on every CreateOrder call is a single, fixed value read from configuration at boot — there is no per-order or per-warehouse pickup-location selection.
  • Impact: The moment the business opens a second fulfillment location, every order would still be scheduled for pickup from the one configured location regardless of which warehouse actually has the stock, unless this is addressed first.
  • Remediation direction: Thread a warehouse/pickup-location identifier through from the order (or from inventory-service’s warehouse record for the fulfilling location) into CreateOrder’s request, rather than a single fixed configuration value — not yet justified while the business operates a single warehouse.
  • Related requirement: SR-011 NFR-02

TD-04 — Mock-vs-live Shiprocket routing is a manual per-endpoint .env edit, not environment-aware

  • Status: Open
  • Severity: Medium — a misconfiguration risk rather than a functional gap; nothing is broken today, but nothing prevents a wrong setting either.
  • Affected component: shipment-service’s infrastructure/config.go (per-endpoint SHIPROCKET_*_BASE_URL values) and provider-auth-service’s seeded SHIPROCKET_LOGIN_ENDPOINT_OVERRIDE.
  • Evidence: Per ADR-00023, routing a given endpoint to mock-service instead of the live Shiprocket API is a manual .env edit (or a provider-auth-service reseed, for login) plus a container restart. No code or docker-compose.yml wiring inspects “which environment is this” to pick mock vs. live automatically — each environment’s .env is simply whatever was last set by hand.
  • Impact: A base-URL override left pointed at the mock after a deploy would silently route real traffic to a non-existent service in that environment; conversely, forgetting to set the override in CI would route automated test runs at the live API, reintroducing the wallet-deduction and phantom-order cost ADR-00023 chose the mock specifically to avoid. Neither failure mode is detected automatically today.
  • Remediation direction: Derive the mock/live choice from an explicit environment flag (e.g. a single SHIPROCKET_MODE=mock|live read once at boot, fanning out to all six per-endpoint base URLs) rather than six independently-settable values with no built-in environment awareness — not yet justified while the number of environments this matters for stays small enough to configure by hand without incident.
  • Related requirement: SR-011 NFR-02

TD-05 — Resolved address city/state/pincode leak unmasked into the audit trail

  • Status: Open
  • Severity: Medium — a confidentiality/compliance gap in the audit-trail’s masking contract, not a functional break; the leaked fields are quasi-identifying (city, state, postal code) rather than directly identifying — name, phone, and the two address lines are already masked correctly on the same object.
  • Affected component: document-service’s service/documentaudit/documentaudit_masking.rs::PII_KEYS, as exercised by shipment-service’s create_order audit event (service/shipment/shipment_crud.svc.go’s publishAuditEvent(ctx, tenantID, "create_order", req.OrderID, req, ...), both the success and failure call sites).
  • Evidence: domain/shipment.go’s ShipmentAddress/CreateShipmentRequest structs carry no JSON struct tags, so Go’s default encoding/json marshaling serializes req.ShippingAddress/req.BillingAddress using the exact Go field names (City, State, Pincode, alongside FirstName/LastName/Phone/AddressLine1/AddressLine2). document-service’s PII_KEYS set already contains the lowercased forms of the latter five (firstname, lastname, phone, addressline1, addressline2) but has no city, state, or pincode entry — mask_object’s per-key lookup leaves those three fields untouched while it recurses into the nested ShippingAddress/BillingAddress objects.
  • Impact: every create_order audit event — success and failure alike — persists a customer’s city, state, and postal code as plaintext inside the otherwise-masked JSON object uploaded to GCS, even though the audit trail standard’s masking contract commits to masking every PII-shaped field exactly once before persistence.
  • Remediation direction: add "city", "state", and "pincode" to PII_KEYS in documentaudit_masking.rs, per the audit trail standard’s “Extending the masked-field set” rule — document-service is the only place this fix belongs; shipment-service’s publisher must keep sending the raw, unmasked request unchanged.
  • Related requirement: SR-011 NFR-07

TD-06 — No query surface for per-order fulfillment status

  • Status: Open
  • Severity: Low — an operational-visibility gap, not a correctness bug; the status is durably and correctly recorded, just not retrievable except by a direct database query.
  • Affected component: shipment-service’s repository/shiprocketorder/ and the shipment_shiprocket_orders collection it writes.
  • Evidence: every step of CreateShipment persists its outcome into shipment_shiprocket_orders (shiprocketorder_crud_rep.go’s Create/UpdateAssignAWBSection/RecordGenerateLabelResult/RecordGenerateInvoiceResult/RecordSchedulePickupResult), but neither shipment.proto’s ShipmentService nor any REST route exposes a method to read that document back by order_id. The only consumer of this data today is IShiprocketOrderRepository.ExistsForTenant, which is a boolean ownership gate for the SSE tracking stream, not a status read.
  • Impact: order-service’s Temporal saga learns of a CreateShipment failure only via that call’s own synchronous error return; nothing downstream (a support tool, an admin screen, a later reconciliation job) can ask “what is this order’s current fulfillment status, and which step failed” without a raw Mongo query against shipment-service’s own database — a boundary violation this service’s own gRPC-only design otherwise avoids.
  • Remediation direction: add a GetOrderFulfillmentStatus (or similarly named) RPC to shipment.proto, backed by a new read method on IShiprocketOrderRepository, returning the parent order_status plus each recorded section’s API outcome — not yet justified while no caller has needed this visibility.
  • Related requirement: SR-011 FR-13