Build against an explicit contract
A fleet desk needs actionable zone exceptions without turning GPS jitter into hundreds of incidents.
Define the user and system contract
A fleet desk needs actionable zone exceptions without turning GPS jitter into hundreds of incidents. Record the region, data freshness, latency budget, privacy purpose, credential owner, and fallback before choosing an SDK or endpoint.
Publish versioned geometry
Validate coordinate order, closure, self-intersection, size, asset scope, schedule, and provider rule identity before activation.
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);
});
}Keep raw evidence, derive cases
Append every eligible enter/exit observation, order by event time, apply hysteresis and dwell policy, and suppress duplicates only in the derived exception view.
Own resolution
Assign each open case, retain acknowledgement SLA, require resolution evidence, and retire provider rules without deleting historical activity.
Prove the production behavior
Automate the happy path and every named failure. The release is ready only when boundary jitter opens at most one case; late observations cannot erase a newer state; retired rules preserve prior evidence. 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-angular-sample-webSDK-RESTmapmyindia-geoanalytics-api-webmapmyindia-interactive-map-js-api7 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.