Urgent.News

What's breaking now, across hundreds of outlets.

Tech

A delivery web app still ships its route-optimizer heuristic to every driver

Delivery and field-service web apps love to show an optimized stop list the moment a driver opens the shift. That snappy UX usually means the scoring heuristic — distance, time windows, vehicle capacity, priority flags, and the little penalties that decide who gets visited first — is running in the browser. If it runs in the browser, every driver (and every competitor) can download it. This post…

Modern delivery and field-service web apps often display an optimized stop list as soon as a driver opens their shift. This snappy user experience relies on a scoring heuristic that calculates travel time estimates, traffic multipliers, parking/delay constants, and various constraints for each stop. This heuristic, which determines route orders and priorities, is typically run in the browser, making it accessible to every driver and potential competitor.

When you open Develop Tools on a modern dispatch Progressive Web App (PWA), you'll usually find several key components in the driver bundle, including cost functions, constraint checks, time-window scoring, local search moves, and tie-breakers. These elements reflect the promises made to enterprise customers regarding Service Level Agreements (SLAs).

The specific numbers used in these functions are not theoretical; they are directly tied to the SLAs promised to enterprise clients. For instance, variables like cfg.wLate, cfg.vipBonus, and others represent the product's revenue. Searching for these variables will help you locate them within the code.

While it's true that the Vehicle Routing Problem (VRP) is NP-hard and the heuristic used is approximate, this does not mean the heuristic is worthless to competitors. A rival logistics software-as-a-service (SaaS) can copy the weights from your bundle, reverse-engineer priorities using historical stop lists, or even modify the scoring function to give their test driver an easy route during debugging. Obfuscation may make this process more difficult, but it does not ensure trustworthy decision-making.

If a shipment's final committed route, driver pay calculations, or VIP must-be-first business rules are affected, these critical components must be computed or re-validated on the server side. For the client heuristic, it's recommended to bundle the optimizer separately from the map UI and apply VM-based obfuscation to critical functions like scoreInsert and weight tables.

This makes copied code bytecode rather than readable JavaScript. Additionally, leaving pure distance lookups or using a Wasm matrix for lighter computations on low-end phones can help maintain performance.

To protect the client heuristic, bundle it separately from the map UI, apply VM-based obfuscation, and strip source maps from the public driver Progressive Web App. Include a hash of the heuristic version with each accepted route so the server can reject unknown builds. Ensure that money and SLA-related logic is computed on the server, and label client scoring as advisory in product documentation and code comments. Finally, make sure performance on mid-range Android devices is measured after implementing these protections.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

6 Common Data Import Errors in GBase Database and How to Troubleshoot Them

The same data file imports successfully in test but fails in production. This is a common database migration and data import problem.

  • Delimiter mismatch causes column count errors
  • Date format inconsistencies lead to incorrect date interpretation
  • Character encoding mismatches result in garbled non-ASCII characters

Text vs Binary Export in GBase Database: A Reproducible Performance Comparison

Which database export method is faster: text or binary? There are plenty of performance comparisons online, but their results rarely apply directly to your environment.

  • Text export provides visibility and flexibility for selective review
  • Binary export is faster but less transparent and has compatibility constraints
  • Verification effort and artifact size differ between text and binary methods

How to Operate Private File Uploads: Signed Downloads with Tenant Isolation

Short answer: Use a private file upload architecture in which the app assigns every e-commerce training artifact a tenant-scoped object storage key, then gives the browser separate signed upload and…

  • Assign tenant-scoped object storage key to each e-commerce training artifact.
  • Control plane manages region, validation state, and deletion deadline.
  • Separate upload artifacts into quarantine, then promote to ready for downloads.

More from Tuesday 24 November →