# Diagnose Replication, Partitions, and Repair

## When to use

Use this task for divergent member views, delayed remote values, incomplete repair, ChangeStream overflow, or unexpected post-partition results.

## Inspect first

- Capture runtime state, member views, collection identity, diagnostics, metrics, and traces.
- Preserve the incident state and record nodes, time window, network conditions, and operation order.
- Read the [propagation path](/en/11-delta-replication.html) and [repair selection](/en/12-repair.html).

## Required inputs

Obtain summaries from both replicas, gap range, replay availability, snapshot version, schema fingerprint, backpressure policy, and external response records.

## Implementation path

1. Separate local commit success from remote application.
2. Find the first inconsistent stage across encode, transport, validate, and apply.
3. Confirm divergence with a digest, then select replay, snapshot, or downgrade rejection.
4. Check whether the ChangeStream buffer and overflow policy affect only observation.
5. Inspect fencing or idempotency separately for external effects.

## Constraints

- Repair restores replica state and does not retract a response already returned during a partition.
- Membership is a local observation; a stable view needs explicit conditions.
- Diagnostics, metrics, and traces support only the scope they captured.

## Failure patterns

- Restarting before preserving incident evidence.
- Describing eventual convergence as synchronous remote visibility.
- Treating a lost subscription event as lost collection state.

## Validation

Reproduce the failure in a controlled two-node environment. Record summaries, source events, and final values before and after repair. Validate real networks and production topology separately.

## Evidence

- [Validation scopes](/agent/en/v/0.1.2/reference/validation-scopes.md)
- [Safe change boundaries](/agent/en/v/0.1.2/policies/safe-change-boundaries.md)
- [Pinned DSM source](https://github.com/xbdotl/dsm/tree/505e7557da94e3f74da84ecf75bc8a9282732e4f)
