TopoloCommerce Resilience
Internal resilience architecture and current implementation status for cached venue operation, local outbox replay, and the phased path toward Venue Edge and controlled 5G rescue uplink.
What It Is
TopoloCommerce resilience is layered:
- cached local client state for the current production foundation
- venue-local authority through
Venue Edgein a later phase - constrained
5G rescue uplinkfor backlog drain and recovery, not as the primary operating model
The hard rule remains: a venue should continue operating as close to normal as possible even when cloud connectivity is degraded.
Architecture
The current implementation is phase-1 resilience plus the first cloud-side Venue Edge control-plane contract. It is still not full venue-edge offline authority.
Today:
apps/guest-webcaches venue lists, venue snapshots, guest sessions, and baskets in browser storageapps/guest-webqueues guest orders, service requests, and bookings in a local outbox when the cloud path is unavailableapps/guest-webattaches stableclientMutationIdvalues to queued guest writes so replay stays idempotent after connectivity returnsapps/guest-webreplays that outbox automatically when connectivity returnsapps/ops-webcaches org context and venue snapshots in browser storageapps/ops-webqueues ticket transitions, ticket assignments, team-section creation, team-member creation, and team-member updates in a local outbox when the cloud path is unavailableapps/ops-webattaches stableclientMutationIdvalues to queued staff writes so replay does not duplicate queue or team changesapps/ops-webreplays that outbox automatically when connectivity returnsapps/apirecords successful guest and staff mutations incommerce_mutation_journalkeyed by route plusclientMutationIdapps/apirecords append-only venue activity incommerce_venue_event_journalso cloud-side venue history exists beforeVenue Edgeis introducedapps/apinow persists enrolled Venue Edge nodes incommerce_venue_edge_nodesapps/apinow exposes cloud-side Venue Edge routes for node enrollment, bootstrap snapshots, cursor-based journal pull, and cursor acknowledgementapps/apifalls back to D1-derived live queue snapshots when the Durable Object queue cache is unavailable and does not fail persisted mutations just because queue fanout could not be refreshed immediately- both browser surfaces expose an explicit resilience banner so operators and guests can see when they are in cached local mode, degraded mode, or replay mode
apps/ops-webnow exposes a module-aware resilience route so staff can inspect the current event journal, recovery posture, and enrolled Venue Edge sync state for a venue
Runtime Surfaces
This foundation is implemented in:
PlatformApplications/TopoloCommerce/apps/guest-web/src/App.jsxPlatformApplications/TopoloCommerce/apps/ops-web/src/App.jsx
Current runtime behavior:
apps/guest-webkeeps cached venue snapshots, guest-session fallbacks, basket persistence, and a replay queue for guest actionsapps/ops-webkeeps cached org and venue snapshots plus a replay queue for staff actionsapps/apiremains the cloud source of truth and replay target in the current phaseapps/apinow de-duplicates replayed mutations for the current browser outbox contract instead of treating each retry as a fresh writeapps/apinow maintains a cloud-side venue event journal that futureVenue Edgereconciliation can replay againstapps/apinow also provides a cloud-side Venue Edge handshake so a future local runtime can enroll, bootstrap, pull journal pages, and acknowledge cursors against Commerce
API Reference
The current resilience foundation still relies on the existing guest and staff write routes for browser outbox replay, but it now also includes a dedicated cloud-side Venue Edge API family.
Current replay behavior:
- replay-safe routes accept an optional
clientMutationIdin the request body - when the same route and
clientMutationIdare replayed, the API returns the original successful response instead of creating a second record - the current replay-safe store is
commerce_mutation_journalin D1 - the current live queue cache remains a derived Durable Object projection, not the canonical write store
Current replay targets:
/api/orders/api/service-requests/api/bookings/api/venues/:venueId/ops/tickets/:ticketId/api/venues/:venueId/team/sections/api/venues/:venueId/team/members/api/venues/:venueId/team/members/:memberId
Current resilience read route:
/api/venues/:venueId/resilience/state
Current Venue Edge routes:
/api/venues/:venueId/edge/nodes/api/venues/:venueId/edge/bootstrap/api/venues/:venueId/edge/events/api/venues/:venueId/edge/ack
Current Venue Edge contract:
- staff enroll a node from ops and receive a one-time enrollment token
- an enrolled node bootstraps a venue snapshot plus the current journal cursor
- an enrolled node pages the append-only venue journal after a cursor
- an enrolled node acknowledges the highest fully-synced cursor back to Commerce
- edge auth currently uses
x-topolo-edge-tokenorAuthorization: Edge <token>
Auth and Permissions
Guest outbox replay continues to use guest-facing public write routes.
Ops outbox replay continues to use the existing staff auth contract:
@topolo/auth-clientin the browser@topolo/auth-middlewarein the API- the same Commerce role bundles already required for normal queue and team actions
Data Ownership
The current resilience foundation adds browser-local cached copies of:
- guest venue lists
- guest venue snapshots
- guest baskets and session fallbacks
- ops org context
- ops venue snapshots
- guest local outbox entries
- ops local outbox entries
TopoloCommerce remains the cloud owner of the canonical venue and queue state once replay succeeds.
TopoloCommerce also owns the current replay journal used to de-duplicate browser outbox retries:
commerce_mutation_journal
TopoloCommerce now also owns the current cloud-side venue event journal:
commerce_venue_event_journal
TopoloCommerce now also owns the current cloud-side Venue Edge node registry:
commerce_venue_edge_nodes
Deployments
The current phase does not change deployment topology. The resilience foundation ships inside the existing guest and ops browser surfaces:
https://guest.topolo.apphttps://commerce.topolo.app
Future local Venue Edge runtime and 5G rescue uplink work will require additional deployment and MDM planning. The current cloud-side control-plane contract ships inside the existing Commerce Worker and ops app.
Failure Modes
This phase does not yet make TopoloCommerce fully outage-resilient at the venue level.
Not yet implemented:
Venue Edgeas a local venue authority- venue-local SQLite event log
- venue-local websocket bus across multiple devices
- venue-local printer bridges
- venue-local payment reconciliation service
- controlled
5G rescue uplinkactivation policy - wearable notification delivery and acceptance flow
In the current phase, cached local browser operation protects the user experience on the current device and preserves queued actions for later replay. It does not yet guarantee full venue-wide multi-device operation during a total cloud outage.
The cloud-side event journal plus edge-node registry are a bridge to the next phase, not the end state. They improve auditability and future reconciliation readiness, but they are not a substitute for venue-local authority.
Planned Next Phase
The next resilience phase should introduce Venue Edge with:
- venue-local event authority
- local websocket updates across guest, ops, and staff devices
- append-only event journal with idempotent replay to cloud
- connectivity manager with explicit state transitions:
onlinedegradedoffline_localrescue_uplinkreconcilingrecovered
5G rescue uplink should be policy-driven and dormant by default. It should activate only after outage thresholds are crossed and should prioritize event replay over general venue traffic.
Debugging
- inspect
apps/guest-web/src/App.jsxwhen guest requests disappear after a connectivity blip or are expected to replay - inspect
apps/ops-web/src/App.jsxwhen operator actions are expected to queue locally or replay - inspect
apps/api/src/index.jswhen replayed guest or staff writes should resolve idempotently but appear to create duplicates - inspect
apps/api/src/index.jswhen resilience state or venue event history looks incomplete - inspect
apps/api/src/index.jspluscommerce_venue_edge_nodeswhen an enrolled edge node is not bootstrapping, syncing, or advancing its acknowledged cursor - inspect browser storage for the current
topolo_commerce_*keys when validating local snapshot and outbox behavior - inspect
commerce_mutation_journalin D1 when checking whether a replayed write should have returned a prior result - inspect
commerce_venue_event_journalin D1 when validating cloud-side venue event history and future reconciliation readiness - do not describe the current browser-storage foundation or the new cloud-side handshake as the final
Venue Edge; the local venue authority still does not exist yet
Change Log / Verification
- Added the canonical TopoloCommerce resilience document on 2026-04-10
- Verified on 2026-04-10 that guest-web and ops-web now persist cached snapshots and local outbox state so core venue interactions survive temporary cloud interruption and replay automatically when connectivity returns
- Verified on 2026-04-10 that replayed browser outbox writes now use stable
clientMutationIdvalues and D1-backed mutation journaling so duplicate guest orders, service requests, bookings, and staff actions are not created during retry - Verified on 2026-04-10 that Commerce now appends venue activity to
commerce_venue_event_journaland exposes a staff-facing resilience view backed by/api/venues/:venueId/resilience/state - Verified on 2026-04-10 that Commerce now stores enrolled Venue Edge nodes in
commerce_venue_edge_nodesand exposes node enrollment, bootstrap, journal pull, and cursor acknowledgement routes for the next local-authority phase