Public surface of the registry: a derived node plus mutators that commit changes to the resolution Input.

interface ConflictRegistry<T> {
    node: DerivedNode<readonly Conflict<T>[]>;
    ignore(graph: ConflictRegistryWriteGraph, id: string): void;
    prune(graph: ConflictRegistryWriteGraph): number;
    read(graph: ConflictRegistryReadGraph): readonly Conflict<T>[];
    resolve(
        graph: ConflictRegistryWriteGraph,
        id: string,
        resolution?: unknown,
    ): void;
    subscribe(
        graph: ConflictRegistryReadGraph,
        observer: (conflicts: readonly Conflict<T>[]) => void,
    ): () => void;
    supersede(
        graph: ConflictRegistryWriteGraph,
        id: string,
        bySupersedingId: string,
    ): void;
}

Type Parameters

  • T

    Application payload type carried by the conflict.

Properties

node: DerivedNode<readonly Conflict<T>[]>

Derived node carrying the public conflict stream with statuses overlaid. Subscribable like any other engine node.

Methods

  • Reclaim resolution records that no longer govern a live open episode, and report how many were dropped.

    Returns number

    The number of resolution records dropped.

    The resolution Input is otherwise append-only — a record recorded for a conflict id persists even after that id leaves the open set, so a long-running registry over churning ids accumulates records forever (issue #156). prune drops every record that is either (a) for an id absent from the current open set, or (b) for an id present under a DIFFERENT episode (raisedAt mismatch — the record belongs to a prior, already-cleared episode of a re-raised id).

    Records that still govern a live episode (the id is open under the same raisedAt the record resolved) are retained, so a resolved / ignored / superseded conflict that remains in the open set keeps its terminal status across the prune.

    Pruning is host-driven and explicit: it commits at most once (only when at least one record is dropped), advancing GraphTime by one tick like any other mutation. It is idempotent — a second call with no intervening change drops nothing and returns 0 without committing. The parameter is narrowed to ConflictRegistryWriteGraph.

  • Mark a conflict as resolved. The resolution is opaque to the registry and surfaced on the kind: 'resolved' variant's resolution member.

    Parameters

    Returns void

    The parameter is narrowed to ConflictRegistryWriteGraph — the mutator only needs read (statechart guard), commit (patch the resolution Input), and now (GraphTime stamp).

  • Mark a conflict as superseded by another conflict id.

    Parameters

    Returns void