feat(FN-3960): add mesh replay outage contracts and runtime hooks
- Add core outage schema and mesh replay contract types, with CentralCore/CentralDB support for queue and snapshot persistence - Expose runtime replay hooks in engine health monitoring and peer exchange paths to drive outage recovery flows - Expand protocol and architecture docs for shared mesh replay behavior and finalized contract expectations - Add regression tests across core and engine for queue sequencing, snapshot contracts, and replay integration Fusion-Task-Id: FN-3960
This commit is contained in:
@@ -621,9 +621,9 @@ Implemented in `agent-heartbeat.ts`:
|
||||
- `MeshLeaseManager` (`mesh-lease-manager.ts`) — canonical abandoned-lease detection + recovery path
|
||||
|
||||
### Outage ownership boundaries (degraded reads + queued write replay)
|
||||
- `CentralCore` owns durable outage state in central persistence (`meshSharedSnapshots` + `meshWriteQueue`) and computes canonical degraded-read metadata (`MeshDegradedReadState`) for API consumers.
|
||||
- `PeerExchangeService` owns retryability classification for sync/apply failures, queue insertion for retryable failures, and replay execution after successful peer sync using queue ordering `(createdAt ASC, id ASC)`.
|
||||
- `NodeHealthMonitor` provides liveness transitions as replay hints only; `online` is a trigger to attempt replay, not proof that replay succeeded.
|
||||
- `CentralCore` owns durable outage state in central persistence (`meshSharedSnapshots` + `meshWriteQueue`) and exposes stable assertion methods: `recordMeshSnapshot`, `getLatestMeshSnapshot`, `enqueueMeshWrite`, `listPendingMeshWrites`, `markMeshWriteReplayStarted`, `markMeshWriteApplied`, `markMeshWriteFailed`, and `getMeshDegradedReadState`.
|
||||
- `PeerExchangeService` owns retryability classification for sync/apply failures, queue insertion for retryable failures, replay execution (`replayPendingWritesForNode(targetNodeId)`), and observable sync results (`queuedWriteId`, `replaySummary`) for partition/replay assertions.
|
||||
- `NodeHealthMonitor` provides liveness transitions as replay hints only via deterministic recovery callback `onNodeRecovered(nodeId, previousStatus)`; `online` is a trigger to attempt replay, not proof that replay succeeded.
|
||||
- Dashboard mesh routes (`register-mesh-routes.ts`) preserve `GET /api/mesh/state` array shape and attach per-node degraded `readState` metadata so stale fallback data is explicit during partitions.
|
||||
|
||||
### Mesh task lease ownership and recovery
|
||||
|
||||
@@ -165,6 +165,11 @@ Rules:
|
||||
|
||||
API behavior must never hide fallback mode: degraded reads are explicit so clients can distinguish stale last-known state from fresh cluster state.
|
||||
|
||||
Concrete exported/runtime surfaces:
|
||||
- Core types are exported from `@fusion/core`: `MeshSnapshotQuery`, `MeshSnapshotRecord`, `MeshSnapshotRecordInput`, `MeshWriteQueueStatus`, `MeshWriteQueueEntry`, `MeshWriteQueueInput`, `MeshWriteQueueFilter`, `MeshWriteApplyResult`, `MeshWriteFailureResult`, `MeshWriteReplaySummary`, and `MeshDegradedReadState`.
|
||||
- `CentralCore` persistence/assertion methods: `recordMeshSnapshot`, `getLatestMeshSnapshot`, `enqueueMeshWrite`, `listPendingMeshWrites`, `markMeshWriteReplayStarted`, `markMeshWriteApplied`, `markMeshWriteFailed`, and `getMeshDegradedReadState`.
|
||||
- Runtime replay/assertion methods: `PeerExchangeService.replayPendingWritesForNode(targetNodeId)` and `NodeHealthMonitor` recovery callback `onNodeRecovered(nodeId, previousStatus)`.
|
||||
|
||||
## 13. End-to-end v1 write path
|
||||
|
||||
1. **Intent creation**: Node creates write intent + envelope.
|
||||
|
||||
Reference in New Issue
Block a user