Advanced2 hr 10 min8 implementation labs5 hostile paths

Build iOS direction planning and navigation handoff

An eight-lab, source-bounded workshop for the complete route planning session lifecycle: exact commands and events, durable records, replay, concurrency, unknown outcomes, hostile fixtures, a maintained capstone, and production exit evidence.

Durable boundaryroute planning session · 8 states · 8 transitions · 8 event identities

Freeze the evidence boundary first

This curriculum teaches the durable host workflow around reviewed Mappls surfaces. It does not manufacture provider endpoints, callbacks, resource states, entitlement, or completion evidence.

The journey blueprint and application event contracts are implementation guidance, not Mappls provider payload specifications.Only linked normalized contracts and source guides may define provider request syntax; empty evidence is never backfilled.The simulator and maintained capstone operate in explicit fixture mode and make no entitlement claim.Credentials, precise production payloads, opaque native objects, and provider secrets stay outside workshop inputs and durable examples.
Lab 1 · 15 min

Model the lifecycle before the UI

Turn the route planning session blueprint into an explicit aggregate boundary owned by the application.

Build

draft: The host owns one route intent, traveler context, and revision before presenting provider UI.editing: One presented controller generation owns source, destination, via points, options, delegates, dismissal, and accessibility focus.calculating: The provider surface is resolving route alternatives for the current immutable location and option revision.candidates_ready: One or more provider route objects are visible for comparison but remain controller-scoped candidates.selected: The traveler selected an in-range route index and the adapter copied a bounded route handoff value plus the exact location revision.handoff_pending: The documented start-navigation callback requested a host-owned navigation action, but no target navigator acknowledgement exists yet.handed_off: The configured navigation adapter accepted the normalized route request and returned its own attributable session identity or acknowledgement.cancelled: The traveler dismissed or backed out and the host recorded one terminal cancellation without a route handoff.

Prove before continuing

Every persisted state exists in the reviewed blueprint.Terminal states reject ordinary forward commands.Recovery text is operational guidance, not another hidden state.
Lab 2 · 20 min

Implement every command and event pair

Make intent, actor authority, allowed source state, committed state, and emitted fact reviewable together.

Build

create_plan by Host application: new aggregate → draft; emit route_plan.created.open_direction_ui by Traveler: draft | selected → editing; emit route_plan.editor_opened.request_routes by Traveler: editing → calculating; emit route_plan.calculation_requested.receive_routes by MapplsDirectionUI: calculating → candidates_ready; emit route_plan.candidates_received.select_route by Traveler: candidates_ready → selected; emit route_plan.route_selected.request_navigation by Traveler: selected | candidates_ready → handoff_pending; emit route_plan.navigation_requested.confirm_handoff by Navigation adapter: handoff_pending → handed_off; emit route_plan.navigation_handed_off.cancel_plan by Traveler: draft | editing | calculating | candidates_ready | selected | handoff_pending → cancelled; emit route_plan.cancelled.

Prove before continuing

create_plan resolves to ios-direction-planning-handoff-route-plan-created without claiming a provider webhook payload.open_direction_ui resolves to ios-direction-planning-handoff-route-plan-editor-opened without claiming a provider webhook payload.request_routes resolves to ios-direction-planning-handoff-route-plan-calculation-requested without claiming a provider webhook payload.receive_routes resolves to ios-direction-planning-handoff-route-plan-candidates-received without claiming a provider webhook payload.select_route resolves to ios-direction-planning-handoff-route-plan-route-selected without claiming a provider webhook payload.request_navigation resolves to ios-direction-planning-handoff-route-plan-navigation-requested without claiming a provider webhook payload.confirm_handoff resolves to ios-direction-planning-handoff-route-plan-navigation-handed-off without claiming a provider webhook payload.cancel_plan resolves to ios-direction-planning-handoff-route-plan-cancelled without claiming a provider webhook payload.
Lab 3 · 15 min

Persist restart-safe records

Separate business identity, provider evidence, command receipts, immutable facts, audit, and downstream delivery.

Build

Route plan: Host-owned normalized stops, options, revision, lifecycle state, and optimistic version. Keys: planId, externalId, state, routeRevision, version, owner.Route handoff candidate: Bounded portable value copied from the active route selection without retaining provider UI objects. Keys: candidateId, routeRevision, selectedIndex, locationDigest, optionDigest, createdAt.Handoff attempt: Immutable request and target acknowledgement separating planning from navigation runtime. Keys: attemptId, candidateId, target, status, targetSessionRef, requestedAt.Audit and outbox: Attributable transitions and exactly-once-in-effect downstream notification. Keys: eventId, aggregateVersion, actor, idempotencyKey, outboxStatus.

Prove before continuing

Process restart restores the same aggregate version and command result.Opaque SDK or native UI objects are not durable records.Provider evidence and application decisions remain distinguishable.
Lab 4 · 15 min

Make concurrency and replay deterministic

Apply optimistic expected versions and aggregate-scoped idempotency before executing effects.

Build

Stops, options, route candidates, and selection share one explicit revision.A selected index is validated before dereferencing its Route candidate.The provider controller and opaque Route objects never become durable application records.The start-navigation callback expresses intent, not proof that navigation started or completed.One presentation generation produces at most one terminal handoff or cancellation.Credentials and unrestricted location histories never enter route-planning audit events.

Prove before continuing

An exact replay returns the first result without another event or version.A reused key with different intent conflicts.A stale expected version changes no durable truth.
Lab 5 · 15 min

Control effects and unknown outcomes

Commit outbox intent atomically, execute effects outside the transaction, and reconcile ambiguous results.

Build

Route calculation fails or returns no alternatives: detect with The active controller reports an error or has no valid selected route for the current revision. Recover with Keep the editable draft, show a safe error, and allow option or stop revision before retry.A delegate callback arrives from an old controller: detect with The callback presentation generation differs from the aggregate's active generation. Recover with Ignore it, dispose its resources, and leave the current route revision unchanged.Selected route index is stale or invalid: detect with The index is outside the current route collection or belongs to a superseded calculation revision. Recover with Reject the handoff and require visible reselection from current candidates.Navigation target rejects or times out: detect with No target acknowledgement exists for the handoff identity inside the bounded deadline. Recover with Remain handoff pending, expose retry or return-to-selection, and do not claim an active navigation session.

Prove before continuing

A timeout remains an unknown outcome until identity-based reconciliation completes.Retries are bounded and preserve the original business and command identities.Dead-letter or manual review retains the entire attempt history.
Lab 6 · 15 min

Run all hostile fixture scenarios

Exercise the success path plus replay, concurrency, state, and response-loss failures without an account.

Build

Complete journey: Commit the shortest reviewed success path to the journey-specific operating target.Idempotent replay: Repeat one command identity and prove that version, event identity, and side effects do not duplicate.Stale version: Reject a command based on an outdated aggregate version without changing durable truth.Invalid transition: Reject a known command when the current state does not permit it.Unknown outcome recovery: Reconcile after a lost response, then replay the original command identity safely.

Prove before continuing

All fixture checks pass for all five scenarios.Rejected commands emit no event and do not increment version.The fixture makes zero provider calls and exposes no write tool.
Lab 7 · 20 min

Trace the Deep-link & Native UI Journey Host capstone

Follow the maintained source through domain rules, adapter seam, repository transaction, HTTP boundary, UI evidence, and restart test.

Build

Run the app's declared test suite (11 tests).Run fixture mode without a credential.Inspect audit and outbox evidence after each transition.Restart the process and continue the same aggregate.

Prove before continuing

The downloadable archive checksum verifies before execution.The capstone covers the journey target without inventing provider completion.Browser and HTTP surfaces report the same durable version.
Lab 8 · 15 min

Qualify the real integration boundary

Replace only reviewed adapter seams and collect independent production evidence without weakening application invariants.

Build

Editor presentation, dismissal, and terminal result by released component versionCalculation latency, failure, and zero-alternative rateStop and option revision count before selectionCandidate-to-selection and selection-to-handoff conversionInvalid index, stale generation, duplicate callback, and late callback rejectionHandoff acknowledgement latency and target rejection rateIdempotency replay and optimistic version conflict rate

Prove before continuing

Exact product entitlement and regional behavior are validated separately.Provider contract tests cover success, rejection, throttling, timeout, and unknown outcome.Security, privacy, operations, rollback, and product owners approve exact evidence.Fixture completion is never presented as provider or production completion.

Application-owned reliability scaffolds

The aggregate and SQL examples implement host truth; the fixture clients call the credential-free Journey Lab. Replace only the separately reviewed provider adapter seam.

iOS direction planning and navigation handoff workshop scaffolds
type State = "draft" | "editing" | "calculating" | "candidates_ready" | "selected" | "handoff_pending" | "handed_off" | "cancelled";
type CommandName = "create_plan" | "open_direction_ui" | "request_routes" | "receive_routes" | "select_route" | "request_navigation" | "confirm_handoff" | "cancel_plan";

type Command = {
  name: CommandName;
  aggregateId: string;
  expectedVersion: number;
  idempotencyKey: string;
};

const transitions = {
  "create_plan": { from: [null], to: "draft", event: "route_plan.created" },
  "open_direction_ui": { from: ["draft", "selected"], to: "editing", event: "route_plan.editor_opened" },
  "request_routes": { from: ["editing"], to: "calculating", event: "route_plan.calculation_requested" },
  "receive_routes": { from: ["calculating"], to: "candidates_ready", event: "route_plan.candidates_received" },
  "select_route": { from: ["candidates_ready"], to: "selected", event: "route_plan.route_selected" },
  "request_navigation": { from: ["selected", "candidates_ready"], to: "handoff_pending", event: "route_plan.navigation_requested" },
  "confirm_handoff": { from: ["handoff_pending"], to: "handed_off", event: "route_plan.navigation_handed_off" },
  "cancel_plan": { from: ["draft", "editing", "calculating", "candidates_ready", "selected", "handoff_pending"], to: "cancelled", event: "route_plan.cancelled" },
} as const;

export function decide(current: { state: State | null; version: number }, command: Command) {
  const rule = transitions[command.name];
  if (command.expectedVersion !== current.version) throw new Error("version_conflict");
  if (!rule.from.includes(current.state as never)) throw new Error("invalid_transition");
  return {
    state: rule.to as State,
    version: current.version + 1,
    event: rule.event,
    idempotencyKey: command.idempotencyKey,
  };
}

// Persist the result, immutable event, audit row, and outbox intent atomically.
// Store the first result by idempotencyKey before executing another effect.

Exit with reviewable evidence

All 8 reviewed transitions are implemented with actor and source-state checks.All 8 application event identities are immutable and versioned.Exact replay, idempotency conflict, stale version, invalid transition, and unknown outcome are tested.Aggregate, event, audit, command result, and outbox intent commit atomically.The Deep-link & Native UI Journey Host capstone passes 11 declared tests after archive checksum verification.Provider entitlement, payload, callback, completion, and production behavior remain independently evidenced.
Workshop completion is not production authority

Workshop completion proves an application-owned reliability design only. Production still requires issued entitlement, exact adapter contract tests, regional and quota validation, security/privacy review, operational drills, and independent release approval.

Trace every external claim to an indexed source

Break the application before connecting the provider.

Run all five hostile scenarios and the maintained capstone test suite. Then qualify the exact provider seam under independently reviewed non-production entitlement.