Build against an explicit contract
A customer tracking page must show a useful ETA while the operations system retains authoritative trip state and late telemetry evidence.
Define the user and system contract
A customer tracking page must show a useful ETA while the operations system retains authoritative trip state and late telemetry evidence. Record the region, data freshness, latency budget, privacy purpose, credential owner, and fallback before choosing an SDK or endpoint.
Create a durable trip identity
Bind order, route revision, provider trip, vehicle, and customer-safe tracking token before telemetry begins.
type AssetEvent = {
id: string;
assetId: string;
occurredAt: string;
type: "position" | "ignition" | "geofence.entered" | "geofence.exited";
position?: { latitude: number; longitude: number; speedKph?: number };
};
export async function handleAssetEvent(event: AssetEvent) {
// Idempotency matters: delivery may be retried.
if (await events.exists(event.id)) return;
await events.transaction(async () => {
await events.record(event);
await assets.apply(event.assetId, event);
});
}Process observations by event time
Deduplicate source events, store event and receipt time, reject state regression, map-match bounded fixes, and derive a new ETA revision only from eligible evidence.
Separate customer view from control state
Expose coarse progress and freshness without driver secrets or full history. Route exceptions to an owned operations queue before changing the promise.
Prove the production behavior
Automate the happy path and every named failure. The release is ready only when duplicate telemetry has one effect; late evidence remains auditable without rewinding progress; closure requires provider acknowledgement and delivery proof. Capture provider request identity without logging credentials or unnecessary precise location.
Failure modes you must exercise
Fail fast with a typed, user-safe outcome and preserve the original request identity.
Keep the last verified state, mark freshness honestly, and retry only within the documented idempotency boundary.
Reconcile durable local and provider evidence before declaring success or issuing a compensating command.
Timeout after a stateful command is an unknown outcome. Query by provider/idempotency identity or wait for authoritative events; do not blindly retry a new command.
Definition of done
REST production checks
Continue from source, contracts, and a full app
These links resolve to repository-derived evidence; unsupported package names and endpoints are not filled in from guesswork.
mapmyindia-interactive-map-js-apimapmyindia-intouch-rest-apismapmyindia-intouch-web-plugins7 verified testsRun it, break it, then observe it
Start with fixture credentials, execute the failure plan, and use request logs, usage, webhook evidence, and operational metrics before promoting traffic.