Skip to content

fix(customer-app): support real-time GPS tracking for truck marker with smooth interpolation #448#522

Merged
KanishJebaMathewM merged 5 commits into
KanishJebaMathewM:mainfrom
Rakshak05:issue-448
Jun 13, 2026
Merged

fix(customer-app): support real-time GPS tracking for truck marker with smooth interpolation #448#522
KanishJebaMathewM merged 5 commits into
KanishJebaMathewM:mainfrom
Rakshak05:issue-448

Conversation

@Rakshak05

@Rakshak05 Rakshak05 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Closes #448

#What

  • Replaced the static midpoint placeholder logic (_pointAlongRoute(0.5)) for the truck marker on the Customer App's Live Tracking screen with real-time GPS tracking coordinates. Now, when a driver is on a trip, their real GPS coordinates are streamed to the customer app and the truck marker updates dynamically on the map. If tracking data is unavailable, the placeholder is removed and the marker is hidden to ensure the customer doesn't see incorrect static positions.

How

  1. Supabase WebSocket Authentication:
  • Modified backend/api/src/sockets/tracker.js to decode and verify Supabase JWT tokens in the WebSocket upgrade authentication block. Previously, it only supported Firebase token verification, which blocked customer-side WebSocket connections.
  1. WebSocket Reconnection & Resubscription:
  • Updated ResilientWebSocket in apps/customer/lib/core/offline/websocket/resilient_websocket.dart to support an onConnect callback. This callback automatically resends the subscription message { "event": "subscribe_tracking", "data": { "order_display_id": ... } } on the initial handshake and whenever the socket reconnects.
  1. Smooth Marker Movement & Interpolation:
  • In apps/customer/lib/screens/live_tracking_screen.dart, replaced SingleTickerProviderStateMixin with TickerProviderStateMixin and added a _movementController to animate the transition from _previousPosition to _currentPosition over 1.5s for a smooth marker movement.
  • Updated the AnimatedBuilder on the map page to listen to both the heartbeat pulse animation and the new marker movement animation.

Summary by CodeRabbit

  • New Features

    • Real-time truck tracking with smooth interpolated movement on the map.
    • WebSocket tracking now accepts and validates multiple token types.
  • Improvements

    • More resilient connections with automatic reconnects and flexible tracking endpoints.
    • Cleaner resource teardown when leaving tracking screens.
    • Added metadata for the demand-forecast model.
  • Bug Fixes

    • Telemetry buffer capped to prevent unbounded memory growth.
  • Tests

    • Unit test enforcing telemetry buffer size limit.
  • Documentation

    • New comprehensive architecture, setup, ML, blockchain, and automation docs.

Copilot AI review requested due to automatic review settings June 12, 2026 19:19
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution! Your pull request has been received and will be reviewed shortly.

If you enjoy the project, please consider giving the repository a ⭐. You can also follow my GitHub profile to stay updated on future open-source projects.

Thanks for being part of the community! 🚀

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

![Review Change Stack [link removed for security]]([link removed for security])

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 71184b09-2c56-477d-8d20-2b821d52d042

📥 Commits

Reviewing files that changed from the base of the PR and between d5145e5 and b8de6e5.

📒 Files selected for processing (4)
  • docs/wiki/Architecture-&-Tech-Stack.md
  • docs/wiki/Blockchain-&-Trust-Layer.md
  • docs/wiki/Home.md
  • docs/wiki/Machine-Learning-Layer.md

📝 Walkthrough

Walkthrough

Adds an optional onConnect callback and urlFactory to ResilientWebSocket; updates LiveTrackingScreen to subscribe to a tracking WebSocket, parse location_update messages, and interpolate/animate truck position; and extends backend tracker auth to accept Supabase or Firebase tokens while capping telemetry buffer size.

Changes

Real-time Truck Tracking with Dual-Auth

Layer / File(s) Summary
ResilientWebSocket connection callback
apps/customer/lib/core/offline/websocket/resilient_websocket.dart
Constructor accepts optional onConnect and urlFactory; _connectOnce uses urlFactory() when present and calls onConnect after connection setup.
Live tracking UI: lifecycle, subscription, interpolation
apps/customer/lib/screens/live_tracking_screen.dart
Adds imports and _movementController, _previousPosition/_currentPosition, _trackingWebSocket/_trackingSubscription; subscribes to tracking WS using a Supabase token; parses location_update messages to update positions and trigger interpolation animation; modifies marker construction and AnimatedBuilder listenable; and cleans up websocket/subscription/controllers on dispose.
Backend tracker: dual-auth token verification & buffer guard
backend/api/src/sockets/tracker.js
Adds jsonwebtoken import; decodes token to choose Supabase (supabase.auth.getUser + profiles.id) or Firebase (firebaseAdmin.auth().verifyIdToken + profiles.firebase_uid) verification and profile lookup; sets ws.user/ws.driverId on success; and enforces MAX_BUFFER_SIZE by dropping oldest telemetry entry when full.
Telemetry buffer test & model metadata
backend/api/test/unit/tracker.test.js, backend/ml/models_storage/demand_forecast_meta.json
Adds a Vitest test verifying telemetry buffer FIFO cap behavior and a demand forecast model metadata JSON.
Docs / Wiki pages
docs/wiki/*
Adds/updates Architecture-&-Tech-Stack, Automation-&-Voice-AI, Blockchain-&-Trust-Layer, Database-Schema, Getting-Started-&-Local-Setup, Home, and Machine-Learning-Layer with diagrams and procedural documentation.

Sequence Diagram

sequenceDiagram
  participant Screen as LiveTrackingScreen
  participant WS as ResilientWebSocket
  participant Backend as TrackerSocket
  participant UI as MarkerLayer

  Screen->>WS: connect(tracking URL + token)
  WS->>Backend: WebSocket handshake / subscribe_tracking
  Backend->>Backend: jwt.decode(token) -> determine issuer
  Backend->>Backend: verify token (Supabase OR Firebase)
  Backend-->>WS: auth success (assign ws.user, ws.driverId)
  WS->>Screen: onConnect callback
  Backend->>WS: send location_update {lat,lng}
  WS->>Screen: deliver location_update message
  Screen->>Screen: _updateTruckPosition(previous <- current, current <- new)
  Screen->>Screen: _movementController.forward(from:0.0)
  Screen->>UI: buildTruckMarkers() -> interpolated position
  UI-->>Screen: render animated truck marker
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A marker once stuck at the middle line,
Now hops and follows each fresh lat-long sign.
Tokens checked by Supabase or Firebase light,
WebSocket whispers turn still dots to flight.
The truck slides smooth, and I nibble on delight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: replacing hardcoded truck marker placement with real-time GPS tracking and smooth interpolation, directly matching the primary objective from issue #448.
Linked Issues check ✅ Passed All acceptance criteria from issue #448 are met: real tracking data drives marker position (ResilientWebSocket + tracking subscription), smooth interpolation is implemented (_movementController), midpoint logic is removed, and marker hides gracefully when tracking data unavailable.
Out of Scope Changes check ✅ Passed Minor documentation additions (6 new wiki pages) and a telemetry buffer fix with accompanying test are tangentially related but not core to issue #448; however, they support the overall system integrity and are reasonable infrastructure improvements for a major tracking feature.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

⚠️ Security Notice: Links posted by non-contributors have been automatically removed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds resilient live tracking over WebSockets on the customer app, and updates the backend WebSocket auth flow to support Supabase tokens in addition to Firebase.

Changes:

  • Backend: detect Supabase vs Firebase tokens and validate accordingly before loading user profiles.
  • Customer app: connect to a tracking WebSocket, subscribe to location updates, and animate marker movement.
  • Core: add an onConnect hook to ResilientWebSocket to send subscription messages on (re)connect.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
backend/api/src/sockets/tracker.js Adds Supabase-token path + keeps Firebase path for WebSocket authentication/profile lookup.
apps/customer/lib/screens/live_tracking_screen.dart Connects to tracking WS, parses location events, and animates truck marker movement.
apps/customer/lib/core/offline/websocket/resilient_websocket.dart Extends resilient WS wrapper with onConnect callback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/api/src/sockets/tracker.js Outdated
Comment thread backend/api/src/sockets/tracker.js Outdated
Comment thread apps/customer/lib/screens/live_tracking_screen.dart Outdated
Comment thread apps/customer/lib/screens/live_tracking_screen.dart Outdated
…destructuring, safe URI builder, and redacted logs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
backend/api/src/sockets/tracker.js (1)

174-179: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Do not grant non-drivers a telemetry publisher identity.

This now authenticates customer sockets too, but still sets ws.driverId = profile.id for every role. handleLocationPing() later treats any socket with ws.driverId as an authorized publisher and never checks ws.user.role, so an authenticated customer can open /ws/tracking, send location_ping for an order_display_id, and broadcast/store fake truck positions.

🔒 Suggested direction
         ws.user = {
           id: profile.id,
           uid: profile.firebase_uid,
           role: profile.role,
         };
-        ws.driverId = profile.id;
+        ws.driverId = profile.role === 'driver' ? profile.id : null;

Also reject location_ping unless ws.user?.role === 'driver' before accepting or broadcasting telemetry.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/api/src/sockets/tracker.js` around lines 174 - 179, The code
incorrectly assigns ws.driverId to every authenticated user, allowing
non-drivers to publish telemetry; only set ws.driverId when profile.role ===
'driver' and remove or avoid setting it for other roles (change the assignment
around ws.driverId to be conditional on profile.role === 'driver'), and add an
explicit authorization check in handleLocationPing() to reject/ignore incoming
'location_ping' events unless ws.user?.role === 'driver' (and/or ws.driverId is
present) before accepting, storing, or broadcasting telemetry for an
order_display_id.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/customer/lib/screens/live_tracking_screen.dart`:
- Line 77: The current debugPrint calls leak sensitive data by printing the full
wsUrl (which includes the Supabase access token) and the raw tracking payload;
update the logging in live_tracking_screen.dart to redact tokens and avoid
printing full payloads: when logging wsUrl (the wsUrl variable) build and log a
redacted endpoint (e.g., remove or replace the access_token query param or log
only the origin + path), and when logging incoming messages (the raw tracking
payload at the second debugPrint) log only non-sensitive metadata such as the
event type or a sanitized summary (e.g., payload['event'] or payload['type']),
not the full location or token fields; replace the two debugPrint calls at the
locations shown with these redacted/sanitized logs.
- Around line 433-449: AnimatedBuilder is still listening to _truckController
and forcing FlutterMap rebuilds each tick even though _buildTruckMarkers() no
longer reads _truckController; change the widget tree so the map is not rebuilt
unnecessarily by either (a) replacing the AnimatedBuilder that uses
_truckController with one that uses _movementController (the controller actually
driving marker interpolation) or (b) remove the AnimatedBuilder/_truckController
entirely and only rebuild markers via a smaller builder around the marker layer
(or use a ValueListenableBuilder tied to the actual value used). Locate the
AnimatedBuilder that wraps FlutterMap and stop listening to _truckController (or
move the animation listening down to the marker creation) so FlutterMap is not
repainted on every _truckController tick while keeping _buildTruckMarkers,
_movementController and marker interpolation logic unchanged.
- Around line 127-131: The marker jumps because on receiving newPosition you set
_previousPosition = _currentPosition (the last target) instead of the marker's
current rendered/interpolated position; compute the current rendered position by
interpolating between _previousPosition and _currentPosition using
_movementController.value (or treat value as 0 if controller is dismissed) and
assign that interpolated LatLng to _previousPosition before setting
_currentPosition = newPosition, then restart _movementController.forward(from:
0.0); apply this change in the update path that currently sets
_previousPosition/_currentPosition and calls _movementController.forward.
- Around line 68-80: _subscribeToTracking currently builds a wsUrl with a
one-time snapshot of Supabase.instance.client.auth.currentSession?.accessToken
and passes it to ResilientWebSocket, causing reconnects to reuse a stale JWT;
change the code so reconnects request a fresh token (either by passing a
reconnect/url-provider callback to ResilientWebSocket or by recreating
_trackingWebSocket inside an auth-change listener) instead of storing the
original wsUrl in _trackingWebSocket. Also remove or redact inbound payloads
from the debugPrint line that logs "Tracking WebSocket message received:
$message" to avoid leaking location data. Fix the interpolation jump in
_updateTruckPosition by setting _previousPosition to the last
rendered/interpolated position (not the last target) and avoid restarting the
animation from t=0; instead update the animation target while preserving
progress or use forward(from: currentValue) so movement is smooth. Finally, stop
unnecessary rebuilds by having the AnimatedBuilder that calls _buildTruckMarkers
listen to _movementController (the controller driving marker interpolation)
rather than _truckController so only marker-related UI updates rebuild.

---

Outside diff comments:
In `@backend/api/src/sockets/tracker.js`:
- Around line 174-179: The code incorrectly assigns ws.driverId to every
authenticated user, allowing non-drivers to publish telemetry; only set
ws.driverId when profile.role === 'driver' and remove or avoid setting it for
other roles (change the assignment around ws.driverId to be conditional on
profile.role === 'driver'), and add an explicit authorization check in
handleLocationPing() to reject/ignore incoming 'location_ping' events unless
ws.user?.role === 'driver' (and/or ws.driverId is present) before accepting,
storing, or broadcasting telemetry for an order_display_id.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 21c85281-9c42-4329-b2d1-9f28400f8345

📥 Commits

Reviewing files that changed from the base of the PR and between 7d1fdd5 and 54e306f.

📒 Files selected for processing (3)
  • apps/customer/lib/core/offline/websocket/resilient_websocket.dart
  • apps/customer/lib/screens/live_tracking_screen.dart
  • backend/api/src/sockets/tracker.js

Comment thread apps/customer/lib/screens/live_tracking_screen.dart Outdated
Comment thread apps/customer/lib/screens/live_tracking_screen.dart Outdated
Comment thread apps/customer/lib/screens/live_tracking_screen.dart
Comment thread apps/customer/lib/screens/live_tracking_screen.dart

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/customer/lib/screens/live_tracking_screen.dart (1)

417-439: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove unused _pointAlongRoute method.

The pipeline reports _pointAlongRoute is unreferenced. This method computed a position along the route polyline, but the PR replaced that logic with real-time GPS positioning via _currentPosition/_previousPosition. Remove this dead code to clear the warning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/customer/lib/screens/live_tracking_screen.dart` around lines 417 - 439,
Remove the unused dead method _pointAlongRoute from the class: delete the entire
function definition (including its use of _routePoints, _interpolatePoint,
_fallbackPickupPoint, and _fallbackDropPoint) since routing now uses
_currentPosition/_previousPosition; ensure no other code references
_pointAlongRoute and run analyzer to confirm the warning is gone.

Source: Pipeline failures

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/customer/lib/screens/live_tracking_screen.dart`:
- Around line 417-439: Remove the unused dead method _pointAlongRoute from the
class: delete the entire function definition (including its use of _routePoints,
_interpolatePoint, _fallbackPickupPoint, and _fallbackDropPoint) since routing
now uses _currentPosition/_previousPosition; ensure no other code references
_pointAlongRoute and run analyzer to confirm the warning is gone.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ec9601bf-9beb-487e-bf06-aa0987a74a80

📥 Commits

Reviewing files that changed from the base of the PR and between 54e306f and 89f16d8.

📒 Files selected for processing (2)
  • apps/customer/lib/screens/live_tracking_screen.dart
  • backend/api/src/sockets/tracker.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/api/src/sockets/tracker.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/customer/lib/screens/live_tracking_screen.dart (1)

55-60: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Cancel the tracking stream before disposing _movementController.

_trackingSubscription still drives _updateTruckPosition(), and that path reads _movementController. Disposing the controller first leaves a teardown window where an in-flight websocket event can hit a disposed controller while the state is still mounted.

Proposed fix
  `@override`
  void dispose() {
-   _movementController.dispose();
    _ordersChannel?.unsubscribe();
-   _trackingSubscription?.cancel();
-   _trackingWebSocket?.close();
+   unawaited(_trackingSubscription?.cancel());
+   unawaited(_trackingWebSocket?.close());
+   _movementController.dispose();
    super.dispose();
  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/customer/lib/screens/live_tracking_screen.dart` around lines 55 - 60,
Dispose currently disposes _movementController before cancelling
_trackingSubscription, which allows in-flight websocket events to call
_updateTruckPosition() and access a disposed controller; change the order in
dispose() so that _trackingSubscription is cancelled (call
_trackingSubscription?.cancel()) before disposing _movementController, keeping
the other teardown steps (_ordersChannel?.unsubscribe(),
_trackingWebSocket?.close(), super.dispose()) but ensuring cancellation of
_trackingSubscription happens prior to calling _movementController.dispose() so
no callbacks run against the disposed controller.
🧹 Nitpick comments (2)
apps/customer/lib/screens/live_tracking_screen.dart (1)

64-72: Fix websocket path construction to match /ws/tracking exactly: backend/api/src/sockets/tracker.js upgrades only when pathname === '/ws/tracking', but live_tracking_screen.dart builds the client path as baseUri.path + '/ws/tracking'. This will fail if TRUXIFY_API_BASE_URL includes a path prefix (e.g. /api), because the client would connect to /api/ws/tracking instead. Default defaultApiBaseUrl is host-only (http://localhost:5000), so it works in that config; still, make the builder force wsPath = '/ws/tracking' (or otherwise strip any existing baseUri.path).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/customer/lib/screens/live_tracking_screen.dart` around lines 64 - 72,
The websocket path construction in live_tracking_screen.dart currently appends
baseUri.path to '/ws/tracking' which breaks when TRUXIFY_API_BASE_URL has a path
prefix; update the logic that sets wsPath (variables apiBaseUrl, baseUri,
wsScheme, wsPath) to always use the exact pathname '/ws/tracking' (i.e., set
wsPath = '/ws/tracking') or strip any existing baseUri.path before appending so
the client connects to '/ws/tracking' exactly.
docs/wiki/Automation-&-Voice-AI.md (1)

15-40: ⚡ Quick win

Unlabeled fenced diagrams need a language tag. All of these blocks are plain diagrams, so markdownlint flags them until they declare a language. Use text if you want to keep the ASCII art, or mermaid where you want rendered flowcharts.

  • docs/wiki/Automation-&-Voice-AI.md#L15-L40: label the first diagram fence.
  • docs/wiki/Automation-&-Voice-AI.md#L64-L81: label the second diagram fence.
  • docs/wiki/Blockchain-&-Trust-Layer.md#L23-L40: label the contract-flow fence.
  • docs/wiki/Home.md#L26-L47: label the system-overview fence.
  • docs/wiki/Machine-Learning-Layer.md#L84-L103: label the retraining-flow fence.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/wiki/Automation-`&-Voice-AI.md around lines 15 - 40, Label each
unlabeled fenced diagram by changing the opening ``` to include a language tag;
for these ASCII art diagrams prefer ```text (or convert to a mermaid flowchart
and use ```mermaid if you want rendering). Specifically: in
docs/wiki/Automation-&-Voice-AI.md lines 15-40 change the opening fence to
```text (or ```mermaid if converting), in docs/wiki/Automation-&-Voice-AI.md
lines 64-81 change the opening fence to ```text (or ```mermaid), in
docs/wiki/Blockchain-&-Trust-Layer.md lines 23-40 change the opening fence to
```text (or ```mermaid), in docs/wiki/Home.md lines 26-47 change the opening
fence to ```text (or ```mermaid), and in docs/wiki/Machine-Learning-Layer.md
lines 84-103 change the opening fence to ```text (or ```mermaid); leave the
closing fences as-is.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/wiki/Architecture-`&-Tech-Stack.md:
- Around line 167-170: Update the security section to document the tracker
WebSocket's dual JWT path: keep the Firebase Auth description (phone/OTP → JWT →
Authorization: Bearer <token>) and the Node.js auth.js middleware flow, then add
a new bullet that the tracker WebSocket upgrade handler also accepts and
verifies Supabase JWTs (in addition to Firebase tokens) during the WebSocket
handshake and binds the resulting user/role to the socket context; note that
Supabase verification uses the SUPABASE_SERVICE_ROLE_KEY for server-side
validation and that both JWTs are treated as valid authentication sources for
API/socket access.

In `@docs/wiki/Blockchain-`&-Trust-Layer.md:
- Line 64: Fix the typos in the sentence that currently reads "If a driver
alters a document scan on their phone or if an database entry is modified, the
file's hash will not match the on-chain registry, flaggin the account." Change
"an database" to "a database" and "flaggin" to "flagging" so the sentence reads
correctly (preserve the rest of the wording).

In `@docs/wiki/Home.md`:
- Line 17: The document uses both "decentralized" and "decentralised"; choose
one spelling and make it consistent across the wiki—e.g., replace
"decentralised" with "decentralized" in the line "* **[Blockchain & Trust
Layer](Blockchain-&-Trust-Layer)**: Trustless escrow, document hash integrity,
decentralised ratings, and Polygon/Solidity smart contracts." and run a
repo-wide search/replace for the alternate spelling to update every occurrence.

In `@docs/wiki/Machine-Learning-Layer.md`:
- Around line 55-67: Update the docs for the POST /train/demand endpoint to
match the trainer contract: state that the trainer uses synthetic data only
(remove or reword the claim about archived MongoDB telemetry logs) and update
the example JSON response to include the feature_names field returned by the
trainer (e.g., add "feature_names": [...]) alongside status and metrics; ensure
the text and sample response under the POST /train/demand section reflect these
exact changes so the documentation matches the trainer behavior.

---

Outside diff comments:
In `@apps/customer/lib/screens/live_tracking_screen.dart`:
- Around line 55-60: Dispose currently disposes _movementController before
cancelling _trackingSubscription, which allows in-flight websocket events to
call _updateTruckPosition() and access a disposed controller; change the order
in dispose() so that _trackingSubscription is cancelled (call
_trackingSubscription?.cancel()) before disposing _movementController, keeping
the other teardown steps (_ordersChannel?.unsubscribe(),
_trackingWebSocket?.close(), super.dispose()) but ensuring cancellation of
_trackingSubscription happens prior to calling _movementController.dispose() so
no callbacks run against the disposed controller.

---

Nitpick comments:
In `@apps/customer/lib/screens/live_tracking_screen.dart`:
- Around line 64-72: The websocket path construction in
live_tracking_screen.dart currently appends baseUri.path to '/ws/tracking' which
breaks when TRUXIFY_API_BASE_URL has a path prefix; update the logic that sets
wsPath (variables apiBaseUrl, baseUri, wsScheme, wsPath) to always use the exact
pathname '/ws/tracking' (i.e., set wsPath = '/ws/tracking') or strip any
existing baseUri.path before appending so the client connects to '/ws/tracking'
exactly.

In `@docs/wiki/Automation-`&-Voice-AI.md:
- Around line 15-40: Label each unlabeled fenced diagram by changing the opening
``` to include a language tag; for these ASCII art diagrams prefer ```text (or
convert to a mermaid flowchart and use ```mermaid if you want rendering).
Specifically: in docs/wiki/Automation-&-Voice-AI.md lines 15-40 change the
opening fence to ```text (or ```mermaid if converting), in
docs/wiki/Automation-&-Voice-AI.md lines 64-81 change the opening fence to
```text (or ```mermaid), in docs/wiki/Blockchain-&-Trust-Layer.md lines 23-40
change the opening fence to ```text (or ```mermaid), in docs/wiki/Home.md lines
26-47 change the opening fence to ```text (or ```mermaid), and in
docs/wiki/Machine-Learning-Layer.md lines 84-103 change the opening fence to
```text (or ```mermaid); leave the closing fences as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 11bb5c61-65d9-4953-a1d8-e8e02e0c9aa0

📥 Commits

Reviewing files that changed from the base of the PR and between 814867e and d5145e5.

⛔ Files ignored due to path filters (1)
  • backend/ml/models_storage/demand_forecast.pkl is excluded by !**/*.pkl
📒 Files selected for processing (12)
  • apps/customer/lib/core/offline/websocket/resilient_websocket.dart
  • apps/customer/lib/screens/live_tracking_screen.dart
  • backend/api/src/sockets/tracker.js
  • backend/api/test/unit/tracker.test.js
  • backend/ml/models_storage/demand_forecast_meta.json
  • docs/wiki/Architecture-&-Tech-Stack.md
  • docs/wiki/Automation-&-Voice-AI.md
  • docs/wiki/Blockchain-&-Trust-Layer.md
  • docs/wiki/Database-Schema.md
  • docs/wiki/Getting-Started-&-Local-Setup.md
  • docs/wiki/Home.md
  • docs/wiki/Machine-Learning-Layer.md
✅ Files skipped from review due to trivial changes (3)
  • docs/wiki/Database-Schema.md
  • backend/ml/models_storage/demand_forecast_meta.json
  • docs/wiki/Getting-Started-&-Local-Setup.md

Comment thread docs/wiki/Architecture-&amp;-Tech-Stack.md Outdated
Comment thread docs/wiki/Blockchain-&amp;-Trust-Layer.md Outdated
Comment thread docs/wiki/Home.md Outdated
Comment thread docs/wiki/Machine-Learning-Layer.md Outdated
@KanishJebaMathewM KanishJebaMathewM merged commit dd19313 into KanishJebaMathewM:main Jun 13, 2026
5 of 6 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution!

Your pull request has been merged successfully. We appreciate your work and look forward to your future contributions. 🚀

@Rakshak05 Rakshak05 deleted the issue-448 branch June 16, 2026 04:35
KanishJebaMathewM added a commit that referenced this pull request Jun 23, 2026
fix(customer-app): support real-time GPS tracking for truck marker with smooth interpolation #448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Customer-App] Truck Marker Is Hardcoded at Midpoint Instead of Following Real GPS

3 participants