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 backingGET /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-serviceis 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 andshipment_shiprocket_trackingcollection. - 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’srepository/shiprocket/shiprocket_create_order.goand itsSHIPROCKET_PICKUP_LOCATION_NAMEconfiguration. - Evidence: The pickup-location name sent on every
CreateOrdercall 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) intoCreateOrder’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’sinfrastructure/config.go(per-endpointSHIPROCKET_*_BASE_URLvalues) andprovider-auth-service’s seededSHIPROCKET_LOGIN_ENDPOINT_OVERRIDE. - Evidence: Per ADR-00023, routing a given endpoint to mock-service instead of the live Shiprocket API is a manual
.envedit (or aprovider-auth-servicereseed, for login) plus a container restart. No code ordocker-compose.ymlwiring inspects “which environment is this” to pick mock vs. live automatically — each environment’s.envis 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|liveread 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’sservice/documentaudit/documentaudit_masking.rs::PII_KEYS, as exercised byshipment-service’screate_orderaudit event (service/shipment/shipment_crud.svc.go’spublishAuditEvent(ctx, tenantID, "create_order", req.OrderID, req, ...), both the success and failure call sites). - Evidence:
domain/shipment.go’sShipmentAddress/CreateShipmentRequeststructs carry no JSON struct tags, so Go’s defaultencoding/jsonmarshaling serializesreq.ShippingAddress/req.BillingAddressusing the exact Go field names (City,State,Pincode, alongsideFirstName/LastName/Phone/AddressLine1/AddressLine2).document-service’sPII_KEYSset already contains the lowercased forms of the latter five (firstname,lastname,phone,addressline1,addressline2) but has nocity,state, orpincodeentry —mask_object’s per-key lookup leaves those three fields untouched while it recurses into the nestedShippingAddress/BillingAddressobjects. - Impact: every
create_orderaudit 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"toPII_KEYSindocumentaudit_masking.rs, per the audit trail standard’s “Extending the masked-field set” rule —document-serviceis 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’srepository/shiprocketorder/and theshipment_shiprocket_orderscollection it writes. - Evidence: every step of
CreateShipmentpersists its outcome intoshipment_shiprocket_orders(shiprocketorder_crud_rep.go’sCreate/UpdateAssignAWBSection/RecordGenerateLabelResult/RecordGenerateInvoiceResult/RecordSchedulePickupResult), but neithershipment.proto’sShipmentServicenor any REST route exposes a method to read that document back byorder_id. The only consumer of this data today isIShiprocketOrderRepository.ExistsForTenant, which is a boolean ownership gate for the SSE tracking stream, not a status read. - Impact:
order-service’s Temporal saga learns of aCreateShipmentfailure 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 againstshipment-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 toshipment.proto, backed by a new read method onIShiprocketOrderRepository, returning the parentorder_statusplus each recorded section’sAPIoutcome — not yet justified while no caller has needed this visibility. - Related requirement: SR-011 FR-13
Related Documents
- BRD-010 — Nationwide Fulfillment That Scales With Order Volume
- SR-011 — Multi-Courier Fulfillment via Shiprocket: System Requirements
- ADR-00022 — Courier Aggregator vs. Direct Per-Courier API Integration
- ADR-00023 — Internal Mock Service vs. Direct Live API for Non-Production Shiprocket Calls
- Architecture: Multi-Courier Fulfillment via Shiprocket
- shipment-service
- provider-auth-service
- pii-service
- document-service
- mock-service