Stateful journeys/InTouch Telematics
hybridgeofence draft aggregate

iOS geofence draft and publication boundary

Present the Mappls geofence editor, normalize circle or polygon output into a versioned application draft, validate geometry and policy, and stop at a review-ready artifact until a separately documented provider publication contract is selected.

Every state means something operational

A state is not a UI label. It determines which actor may act, what evidence exists, what may be retried, and how recovery proceeds.

01
draft

Draft

The host owns name, purpose, subject scope, rule intent, and geometry revision before opening the editor.

02
editing

Editing

One view and delegate generation owns mode, handles, slider, style, callbacks, dismissal, and cleanup.

03
candidate

Candidate

Circle or polygon output has been copied into a portable geometry schema but is not yet an operational rule.

04
review_pending

Review pending

Valid geometry, purpose, scope, schedule intent, and policy version await an attributable application review.

05
approved_draftterminal

Approved draft

The application has a review-approved portable artifact ready for a separately selected and entitled rule-publication contract.

06
cancelledterminal

Cancelled

The author ended editing without approving a new geometry revision and the UI lifecycle is fully disposed.

Transitions are attributable and retry-safe

Commands express intent. The aggregate validates current state and invariants, commits one new version, and emits a fact in the same transaction.

Command & actorAllowed fromResultIdempotency strategy
create_geofence_draftHost application
new aggregate
draftgeofence_draft.created

One external rule intent maps to one draft aggregate across retries.

open_editorOperations author
draftreview_pending
editinggeofence_draft.editor_opened

One command opens one view/delegate generation tied to the current draft revision.

receive_geometryMapplsGeofenceUI
editing
candidategeofence_draft.geometry_received

Normalize one terminal geometry result per generation and hash its canonical coordinate order.

submit_for_reviewOperations author
candidate
review_pendinggeofence_draft.review_requested

The geometry hash, purpose, scope, and policy version create at most one review case.

approve_draftGeofence reviewer
review_pending
approved_draftgeofence_draft.approved

Commit reviewer, decision, exact geometry revision, audit event, and outbox atomically.

cancel_editOperations author
drafteditingcandidatereview_pending
cancelledgeofence_draft.cancelled

Repeated cancellation disposes the editor once and preserves the last committed draft revision.

Persist enough to recover and explain

Keep provider responses, business identity, state, events, and side-effect delivery distinct so each can be reconciled safely.

Geofence draft

Host-owned intent, current revision, lifecycle state, policy, and optimistic version.

draftIdexternalIdpurposescopestategeometryRevisionversion

Geometry revision

Immutable canonical circle or polygon independent of UI lifetime.

geometryIdmodecoordinatesradiusMeterscanonicalHashsourceGeneration

Review decision

Attributable approval or rework request for an exact geometry and policy version.

reviewIdgeometryIdreviewerdecisionreasondecidedAt

Publication boundary

Selection record for a future provider rule adapter without inventing a rule ID.

draftIdadapterStatusentitlementReferencerequiredContractselectedAt

Protect truth at the aggregate boundary

  1. 1

    Editor output is an application candidate, not evidence of a published provider rule.

  2. 2

    Only canonical validated circle or polygon geometry enters review.

  3. 3

    Each geometry revision is immutable and linked to the editor generation that produced it.

  4. 4

    Purpose, subject scope, schedule intent, and policy version travel with geometry review.

  5. 5

    Publishing requires a separately documented, entitled rule contract and creates a separate provider identity mapping.

  6. 6

    Provider views, delegates, map layers, credentials, and opaque callback objects are never persisted.

Know what to do before it breaks

Recovery changes durable truth only through the same rules as normal operation. A timeout is an unknown outcome, not evidence that nothing happened.

Editor returns invalid or unsafe geometry

Detect

Canonical validation finds missing points, self-intersection, invalid radius, excessive area, or policy bounds failure.

Recover

Keep the candidate uncommitted, explain the exact constraint, and reopen a new editor generation.

Callback arrives after view disposal

Detect

The delegate generation is inactive or differs from the aggregate's editor generation.

Recover

Ignore it and clean up provider resources without changing the current draft.

Two authors edit the same draft

Detect

The submitted geometry references an older aggregate or geometry revision.

Recover

Return a conflict with the current revision and require an intentional new edit.

No authoritative publication contract is available

Detect

The selected environment lacks a documented provider command, entitlement, response, or rule identity contract.

Recover

Keep the artifact approved_draft and route contract selection to an administrator; never fabricate publication success.

Observe the journey, not merely HTTP status

Measure state age, event health, retries, reconciliation, and sensitive-data access alongside latency and error rate.

  • Editor open, cancel, and result by component version and geometry mode
  • Validation failures by bounded reason
  • Geometry revision count and review turnaround
  • Stale generation and optimistic version conflicts
  • Approved drafts awaiting publication-contract selection
  • Publication adapter outcome only after a separate authoritative contract is configured
  • Audit and outbox delivery health

Contracts, repositories, workshops, tutorials, and runnable evidence

Only explicitly indexed evidence is linked. Empty sections are not backfilled with invented endpoints or package names.