{"schemaVersion":"mappls.journey-workshop.v1","slug":"offline-automotive-release","journeySlug":"offline-automotive-release","title":"Build Offline automotive release","summary":"An eight-lab, source-bounded workshop for the complete device release lifecycle: exact commands and events, durable records, replay, concurrency, unknown outcomes, hostile fixtures, a maintained capstone, and production exit evidence.","duration":"2 hr 10 min","level":"Advanced","productSlug":"offline-automotive","stateModel":"stateful","aggregate":"device release","actorCount":4,"stateCount":7,"transitionCount":7,"eventCount":7,"sourceGuideSlugs":[],"contractSlugs":[],"relatedTutorialSlugs":[],"sample":{"slug":"offline-release-control","name":"Offline Release Control","downloadPath":"/downloads/offline-release-control.zip","checksumPath":"/downloads/offline-release-control.zip.sha256","verifiedTestCount":10,"runCommand":"npm test --workspace @mappls-example/offline-release-control"},"labs":[{"slug":"model-lifecycle","title":"Model the lifecycle before the UI","duration":"15 min","objective":"Turn the device release blueprint into an explicit aggregate boundary owned by the application.","build":["manufactured: Hardware identity, target architecture, software edition, and vehicle configuration are recorded.","activated: The device has a scoped entitlement and trusted activation identity.","installed: A verified compatible runtime, configuration, voice set, and base map package are staged.","operational: The active slot passed startup, route, search, positioning, audio, storage, and health checks.","updating: A cohort release is downloading, verifying, staging, switching, and qualifying under a durable plan.","recovering: Watchdog or health policy selected rollback, repair, or safe degraded operation.","retired: Activation is revoked and the device no longer receives protected packages or service."],"prove":["Every persisted state exists in the reviewed blueprint.","Terminal states reject ordinary forward commands.","Recovery text is operational guidance, not another hidden state."]},{"slug":"command-event-contract","title":"Implement every command and event pair","duration":"20 min","objective":"Make intent, actor authority, allowed source state, committed state, and emitted fact reviewable together.","build":["register_device by Manufacturing system: new aggregate → manufactured; emit device.registered.","activate by Fleet release manager: manufactured → activated; emit license.activated.","stage_base_release by Vehicle runtime: activated → installed; emit release.installed.","qualify by Vehicle runtime: installed | recovering → operational; emit release.qualified.","start_update by Fleet release manager: operational → updating; emit release.update_started.","rollback by Vehicle runtime: updating | operational → recovering; emit release.rollback_started.","retire by Fleet release manager: manufactured | activated | installed | operational | recovering → retired; emit device.retired."],"prove":["register_device resolves to offline-automotive-release-device-registered without claiming a provider webhook payload.","activate resolves to offline-automotive-release-license-activated without claiming a provider webhook payload.","stage_base_release resolves to offline-automotive-release-release-installed without claiming a provider webhook payload.","qualify resolves to offline-automotive-release-release-qualified without claiming a provider webhook payload.","start_update resolves to offline-automotive-release-release-update-started without claiming a provider webhook payload.","rollback resolves to offline-automotive-release-release-rollback-started without claiming a provider webhook payload.","retire resolves to offline-automotive-release-device-retired without claiming a provider webhook payload."]},{"slug":"durable-records","title":"Persist restart-safe records","duration":"15 min","objective":"Separate business identity, provider evidence, command receipts, immutable facts, audit, and downstream delivery.","build":["Device identity: Manufacturing, vehicle, activation, and hardware trust mapping. Keys: deviceId, hardwareId, vehicleId, edition, activationState.","Release manifest: Signed compatibility unit for runtime, data, configuration, and assets. Keys: manifestId, digest, target, components, signature, compatibility.","Update plan: Durable per-device progress through download, verify, stage, switch, and qualify. Keys: planId, campaignId, deviceId, targetManifest, phase, checkpoint.","Health incident: Watchdog evidence, recovery action, and support context. Keys: incidentId, activeManifest, signal, action, outcome, occurredAt."],"prove":["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."]},{"slug":"concurrency-replay","title":"Make concurrency and replay deterministic","duration":"15 min","objective":"Apply optimistic expected versions and aggregate-scoped idempotency before executing effects.","build":["Runtime, map data, configuration, and voice assets are qualified as one compatible manifest.","Only a verified inactive slot may replace the active slot.","Power loss at any update point leaves one bootable known-good slot.","Activation identity and secrets are distinct from vehicle business identity.","Retirement revokes protected access without erasing support and release history."],"prove":["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."]},{"slug":"effects-reconciliation","title":"Control effects and unknown outcomes","duration":"15 min","objective":"Commit outbox intent atomically, execute effects outside the transaction, and reconcile ambiguous results.","build":["Power loss during update: detect with Boot control sees an incomplete plan and unchanged or unqualified target slot. Recover with Boot the known-good slot and resume or discard staging from the durable checkpoint.","Runtime and map package are incompatible: detect with Manifest compatibility or startup qualification fails. Recover with Reject before activation and report exact component constraints.","Activation cannot refresh while offline: detect with Entitlement is near expiry and network is unavailable. Recover with Apply the licensed offline grace policy visibly; never extend entitlement by changing device time.","New release causes route or crash regression: detect with Cohort health breaches automated rollout thresholds. Recover with Halt the campaign, roll affected devices back, and retain incident-linked diagnostic bundles."],"prove":["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."]},{"slug":"hostile-scenarios","title":"Run all hostile fixture scenarios","duration":"15 min","objective":"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":["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."]},{"slug":"maintained-capstone","title":"Trace the Offline Release Control capstone","duration":"20 min","objective":"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 (10 tests).","Run fixture mode without a credential.","Inspect audit and outbox evidence after each transition.","Restart the process and continue the same aggregate."],"prove":["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."]},{"slug":"production-exit","title":"Qualify the real integration boundary","duration":"15 min","objective":"Replace only reviewed adapter seams and collect independent production evidence without weakening application invariants.","build":["Fleet distribution by active and target manifest","Download, verification, switch, and qualification duration","Interrupted and resumed update phase","Activation refresh health and offline grace usage","Crash, watchdog, routing, positioning, and storage health by cohort","Rollback cause, success, and last-known-good age"],"prove":["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."]}],"codeSamples":[{"language":"typescript","label":"TypeScript aggregate boundary","code":"type State = \"manufactured\" | \"activated\" | \"installed\" | \"operational\" | \"updating\" | \"recovering\" | \"retired\";\ntype CommandName = \"register_device\" | \"activate\" | \"stage_base_release\" | \"qualify\" | \"start_update\" | \"rollback\" | \"retire\";\n\ntype Command = {\n  name: CommandName;\n  aggregateId: string;\n  expectedVersion: number;\n  idempotencyKey: string;\n};\n\nconst transitions = {\n  \"register_device\": { from: [null], to: \"manufactured\", event: \"device.registered\" },\n  \"activate\": { from: [\"manufactured\"], to: \"activated\", event: \"license.activated\" },\n  \"stage_base_release\": { from: [\"activated\"], to: \"installed\", event: \"release.installed\" },\n  \"qualify\": { from: [\"installed\", \"recovering\"], to: \"operational\", event: \"release.qualified\" },\n  \"start_update\": { from: [\"operational\"], to: \"updating\", event: \"release.update_started\" },\n  \"rollback\": { from: [\"updating\", \"operational\"], to: \"recovering\", event: \"release.rollback_started\" },\n  \"retire\": { from: [\"manufactured\", \"activated\", \"installed\", \"operational\", \"recovering\"], to: \"retired\", event: \"device.retired\" },\n} as const;\n\nexport function decide(current: { state: State | null; version: number }, command: Command) {\n  const rule = transitions[command.name];\n  if (command.expectedVersion !== current.version) throw new Error(\"version_conflict\");\n  if (!rule.from.includes(current.state as never)) throw new Error(\"invalid_transition\");\n  return {\n    state: rule.to as State,\n    version: current.version + 1,\n    event: rule.event,\n    idempotencyKey: command.idempotencyKey,\n  };\n}\n\n// Persist the result, immutable event, audit row, and outbox intent atomically.\n// Store the first result by idempotencyKey before executing another effect."},{"language":"sql","label":"SQL durability skeleton","code":"CREATE TABLE journey_offline_automotive_release (\n  aggregate_id text PRIMARY KEY,\n  state text NOT NULL,\n  version bigint NOT NULL CHECK (version > 0),\n  updated_at timestamptz NOT NULL DEFAULT now()\n);\n\nCREATE TABLE journey_offline_automotive_release_commands (\n  aggregate_id text NOT NULL REFERENCES journey_offline_automotive_release(aggregate_id),\n  idempotency_key text NOT NULL,\n  request_hash text NOT NULL CHECK (length(request_hash) = 64),\n  committed_version bigint NOT NULL,\n  result_json jsonb NOT NULL,\n  PRIMARY KEY (aggregate_id, idempotency_key)\n);\n\nCREATE TABLE journey_offline_automotive_release_outbox (\n  event_id text PRIMARY KEY,\n  aggregate_id text NOT NULL,\n  aggregate_version bigint NOT NULL,\n  event_type text NOT NULL,\n  payload jsonb NOT NULL,\n  published_at timestamptz\n);\n\n-- In one transaction: lock aggregate, compare version, decide, append audit/event,\n-- insert the outbox row, and remember the exact command result."},{"language":"curl","label":"Complete fixture journey","code":"curl --request POST 'https://developer.mappls.com/api/journey-simulator' \\\n+  --header 'content-type: application/json' \\\n+  --data '{\"journey\":\"offline-automotive-release\",\"scenario\":\"complete-journey\"}'"},{"language":"curl","label":"Unknown-outcome drill","code":"curl --request POST 'https://developer.mappls.com/api/journey-simulator' \\\n+  --header 'content-type: application/json' \\\n+  --data '{\"journey\":\"offline-automotive-release\",\"scenario\":\"unknown-outcome\"}'\n\n# Reconcile devicerelease identity and the original idempotency key.\n# Never mint a replacement key merely because the response was lost."},{"language":"json","label":"First command envelope","code":"{\n  \"command\": \"register_device\",\n  \"aggregateId\": \"fixture-offline-automotive-release-001\",\n  \"expectedVersion\": 0,\n  \"idempotencyKey\": \"cmd_offline-automotive-release_001\",\n  \"evidenceBoundary\": \"application-owned-workshop\"\n}"}],"simulationScenarios":[{"slug":"complete-journey","title":"Complete journey","outcome":"Commit the shortest reviewed success path to the journey-specific operating target.","href":"/tools/journey-lab?journey=offline-automotive-release&scenario=complete-journey#lab"},{"slug":"idempotent-replay","title":"Idempotent replay","outcome":"Repeat one command identity and prove that version, event identity, and side effects do not duplicate.","href":"/tools/journey-lab?journey=offline-automotive-release&scenario=idempotent-replay#lab"},{"slug":"stale-version","title":"Stale version","outcome":"Reject a command based on an outdated aggregate version without changing durable truth.","href":"/tools/journey-lab?journey=offline-automotive-release&scenario=stale-version#lab"},{"slug":"invalid-transition","title":"Invalid transition","outcome":"Reject a known command when the current state does not permit it.","href":"/tools/journey-lab?journey=offline-automotive-release&scenario=invalid-transition#lab"},{"slug":"unknown-outcome","title":"Unknown outcome recovery","outcome":"Reconcile after a lost response, then replay the original command identity safely.","href":"/tools/journey-lab?journey=offline-automotive-release&scenario=unknown-outcome#lab"}],"acceptance":["All 7 reviewed transitions are implemented with actor and source-state checks.","All 7 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 Offline Release Control capstone passes 10 declared tests after archive checksum verification.","Provider entitlement, payload, callback, completion, and production behavior remain independently evidenced."],"sourceBoundary":["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."],"releaseBoundary":"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.","websitePath":"/journeys/offline-automotive-release/workshop","apiPath":"/api/journey-workshops?journey=offline-automotive-release","providerCalls":0,"writesExposed":false}