Skip to content

fix(fleetops): drive the order activity cycle the way a client does - #40

Merged
roncodes merged 1 commit into
mainfrom
fix/order-activity-cycle
Aug 12, 2026
Merged

roncodes merged 1 commit into
mainfrom
fix/order-activity-cycle

Conversation

@roncodes

Copy link
Copy Markdown
Member

Complete an Order answered "Not all waypoints completed for order." — correctly. completeOrder requires every waypointMarker at COMPLETED, and nothing in the collection ever advanced them.

The pieces were all present but inert:

request what was wrong
Update Order Activity sent only {"skip_dispatch": false}. updateActivity reads $request->array('activity'), so with none supplied it could never advance a service stop.
Get Order Next Activity captured nothing, and was not scoped to a stop. getNextActivity resolves service-stop activities only when a waypoint is supplied; without one it returns the order-level lifecycle activity.
neither tracked the destination. Applying an activity that completes the current stop advances the order to the next one.

Now

  • Start an Order seeds {{current_waypoint_id}} from payload.current_waypoint.
  • Get Order Next Activity passes it as ?waypoint= and captures the first activity returned.
  • Update Order Activity sends that activity, and re-reads the destination the order advanced to.

This mirrors navigator-app exactly — getNextActivity({ waypoint: destination.id }) then updateActivity({ activity }), once per stop (src/screens/OrderScreen.tsx).

The collection's order carries four waypoints plus pickup and dropoff, so the contract run cycles the pair rather than calling it once; that ordering change is in fleetbase/fleetbase.

Sending the activity is what a real client sends, so the published example is now correct rather than merely harmless.

🤖 Generated with Claude Code

Complete an Order answered "Not all waypoints completed for order." — correctly.
completeOrder requires every waypointMarker at COMPLETED, and nothing in the
collection advanced them.

The pieces were all present but inert:

  Update Order Activity sent only {"skip_dispatch": false}. updateActivity reads
    $request->array('activity'), so with none supplied it could never advance a
    service stop. It now sends the activity, which is what navigator-app sends —
    order.updateActivity({ activity }) in OrderScreen.

  Get Order Next Activity captured nothing and was not scoped to a stop.
    getNextActivity resolves service-stop activities only when a `waypoint` is
    supplied; without one it returns the order-level lifecycle activity. It now
    passes the current destination and captures the first activity returned.

  Neither tracked the destination. Applying an activity that completes the current
    stop advances the order to the next, so Start an Order seeds
    {{current_waypoint_id}} from payload.current_waypoint and Update Order Activity
    re-reads it.

This mirrors navigator-app exactly: getNextActivity({ waypoint }) then
updateActivity({ activity }), once per stop. The collection's order carries four
waypoints plus pickup and dropoff, so the contract run cycles the pair — see the
runner change in fleetbase/fleetbase.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@roncodes
roncodes merged commit f8dd53c into main Aug 12, 2026
1 check passed
@roncodes
roncodes deleted the fix/order-activity-cycle branch August 12, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant