Advanced2 hr 10 min8 implementation labs5 hostile paths

Build Application-owned widget selection

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

Durable boundarywidget selection session · 7 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 widget selection session blueprint into an explicit aggregate boundary owned by the application.

Build

draft: Host-owned address or place intent exists without an active provider surface or committed Mappls identity.widget_open: One launch generation owns the provider surface, lifecycle callbacks, focus, cancellation, and timeout.fallback_active: The provider surface is unavailable and a bounded manual or search-assisted host path remains operable.candidate_received: An exact-origin or native-adapter result passed schema validation but is not yet a business selection.selected: The user deliberately committed a normalized Mappls Pin and label against the current host draft version.submitted: Host text and committed selection form one immutable, attributable business record with an outbox event.cancelled: A named actor ended the journey without submission and with a recorded reason.

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_session by Host application: new aggregate → draft; emit host.session_created.open_widget by Application user: draft | fallback_active → widget_open; emit widget.opened.activate_fallback by Platform adapter: widget_open → fallback_active; emit widget.fallback_activated.receive_candidate by Platform adapter: widget_open | fallback_active → candidate_received; emit location.candidate_received.accept_selection by Application user: candidate_received → selected; emit location.selected.edit_host_text by Application user: draft | widget_open | fallback_active | candidate_received | selected → draft; emit host.text_edited.submit by Application user: selected → submitted; emit host.submitted.cancel by Application user: draft | widget_open | fallback_active | candidate_received | selected → cancelled; emit host.cancelled.

Prove before continuing

create_session resolves to widget-selection-session-host-session-created without claiming a provider webhook payload.open_widget resolves to widget-selection-session-widget-opened without claiming a provider webhook payload.activate_fallback resolves to widget-selection-session-widget-fallback-activated without claiming a provider webhook payload.receive_candidate resolves to widget-selection-session-location-candidate-received without claiming a provider webhook payload.accept_selection resolves to widget-selection-session-location-selected without claiming a provider webhook payload.edit_host_text resolves to widget-selection-session-host-text-edited without claiming a provider webhook payload.submit resolves to widget-selection-session-host-submitted without claiming a provider webhook payload.cancel resolves to widget-selection-session-host-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

Selection session: Current host draft, lifecycle state, launch generation, candidate, selection, and optimistic version. Keys: sessionId, externalId, state, version, launchGeneration, hostText.Normalized selection: Application-owned portable place identity independent of provider UI lifetime. Keys: schemaVersion, mapplsPin, label, source, selectedAt, selectedBy.Audit event: Attributable state transition and recovery history. Keys: eventId, aggregateVersion, type, actor, idempotencyKey, occurredAt.Transactional outbox: Exactly-once-in-effect notification and downstream form processing. Keys: outboxId, eventId, status, attempts, nextAttemptAt.

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

A provider callback or browser message creates only a candidate, never a submitted business record.Every browser message matches the exact reviewed origin and a versioned allow-listed schema.Only a six-character alphanumeric Mappls Pin and bounded printable label enter durable selection state.A host-text edit invalidates every candidate and committed selection from the previous draft version.One launch generation produces at most one terminal adapter outcome; late callbacks are ignored.Credentials, provider controllers, native views, bridge objects, and opaque response payloads are never persisted.

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

Widget fails, is denied, or times out: detect with The active generation reaches a typed failure without a valid terminal candidate. Recover with Dispose it, restore focus, record the reason, and activate a useful host-owned fallback.Message arrives from a wrong origin or with unknown fields: detect with Exact origin or narrow schema validation fails before domain processing. Recover with Reject without changing aggregate state and emit a safe rejection metric without storing opaque content.Callback arrives after screen disposal or a newer launch: detect with Owner is inactive or result generation differs from the current session generation. Recover with Ignore the late result and clean up its provider resources without committing state.User edits the address after selecting a place: detect with Host draft version changes while a candidate or selection exists. Recover with Clear both values, return to draft, and require a new selection before submission.Submit response is lost: detect with Client lacks acknowledgement but retains session and idempotency identity. Recover with Repeat the same command key or read the session; never create a second business record.

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 Widget 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 (8 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

Widget launch, time-to-active, and terminal outcome by platform and component versionOrigin and schema rejection counts without raw payload retentionFallback activation, completion, and abandonment rateCandidate-to-selection and selection-to-submit conversionStale selection invalidation after host editsDuplicate, late, and superseded callback countIdempotency replay and optimistic version conflict rateOutbox backlog, retry, and dead-letter age

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.

Application-owned widget selection workshop scaffolds
type State = "draft" | "widget_open" | "fallback_active" | "candidate_received" | "selected" | "submitted" | "cancelled";
type CommandName = "create_session" | "open_widget" | "activate_fallback" | "receive_candidate" | "accept_selection" | "edit_host_text" | "submit" | "cancel";

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

const transitions = {
  "create_session": { from: [null], to: "draft", event: "host.session_created" },
  "open_widget": { from: ["draft", "fallback_active"], to: "widget_open", event: "widget.opened" },
  "activate_fallback": { from: ["widget_open"], to: "fallback_active", event: "widget.fallback_activated" },
  "receive_candidate": { from: ["widget_open", "fallback_active"], to: "candidate_received", event: "location.candidate_received" },
  "accept_selection": { from: ["candidate_received"], to: "selected", event: "location.selected" },
  "edit_host_text": { from: ["draft", "widget_open", "fallback_active", "candidate_received", "selected"], to: "draft", event: "host.text_edited" },
  "submit": { from: ["selected"], to: "submitted", event: "host.submitted" },
  "cancel": { from: ["draft", "widget_open", "fallback_active", "candidate_received", "selected"], to: "cancelled", event: "host.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 Widget Journey Host capstone passes 8 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.