# Changelog

## 3.5.0 (2026-11-28)

### Upgrading
Syn 3.5 nodes don't sync with nodes running Syn 3.4 or earlier. A cluster that runs both versions behaves as two
separate clusters, and the same name can be registered once on each side. See
[Upgrading to 3.5 from an earlier version](README.md#upgrading-to-35-from-an-earlier-version) in the README.

A 3.5 node logs a warning with the event `incompatible_version` for every message it gets from a node running another
version.

### Fixed
* After a net split in which some nodes still saw each other, a name could stay missing on one node while every other
  node had it ([#96](https://github.com/ostinelli/syn/issues/96), [#92](https://github.com/ostinelli/syn/issues/92)).
  Every node keeps the registrations that each of the other nodes sent it. When the process it shows for a name goes
  away, for any reason, it shows the next one.
* An unregistration that arrived late could remove a more recent registration of the same name made on another node.
  A node only applies what comes from the node that runs the process.
* A registration or a group join called for a process on another node could be undone by an older snapshot of that
  node.
* Syncing with a node that holds many entries was slow: the time grew with the square of their number
  ([#90](https://github.com/ostinelli/syn/pull/90)).

### Changed
* Conflict resolution, order of the arguments. `resolve_registry_conflict/4` gets the two registrations in the same
  order on both nodes. The first one is the registration of the process running on the node whose name sorts first.
  In 3.4 the first one was the other node's and the second one the local node's. A custom resolution that relies on
  the position of the local process gives different results.
* Conflict resolution, who acts. The node whose process loses drops it and tells the other nodes. The node whose
  process wins does nothing, and the time of its registration doesn't change. In 3.4 that node gave the registration
  a new time and sent it again.
* Callbacks, when two nodes hold the same name. A node that runs neither process shows the most recent registration.
  If that one goes away, it shows the other one, and `on_process_registered/5` for it gets the same reason as
  `on_process_unregistered/5` for the one that went.
* Callbacks, when a node leaves. Its entries are out of the registry by the time `on_process_unregistered/5` runs for
  them. A lookup from the callback doesn't return them.
* Calls for a process on another node. The node that runs the process does the registration, update, unregistration,
  join or leave. The calling node applies the result in order with everything else that node sends it, before the
  call returns.
* Hidden nodes take no part in syncing. A call from a hidden node for a process on another node works, but the
  hidden node doesn't show the result.
* A node that stops reading from its connections, for example during a long pause, doesn't slow down what the other
  nodes send each other.
* When a scope process restarts, the other nodes drop the data of the old one as soon as the new one contacts them.
* Tested on OTP 27, 28 and 29.

## 3.4.2 (2026-06-22)

### Fixed
* When two nodes sync, a node drops the entries it had from the other node that the other node doesn't hold anymore,
  in the registry and in process groups. The callbacks for them get the reason
  `{syn_remote_scope_node_up, Scope, Node}`.

## 3.4.1 (2026-03-22)

### Fixed
* `update_registry/3` returns `{error, undefined}` for a name that isn't registered on the process' node. It returned
  a value in another format.
* When two registrations in conflict have the same time, the default resolution keeps the same process on both
  nodes.
* A scope process logs and ignores a cast it doesn't know, instead of crashing.
* When `syn_backbone` crashes, the scope processes restart after it, since they depend on its tables.
* Corrections to specs and to the documentation.

### Changed
* Broadcasts to the other nodes build a smaller message.

## 3.4.0 (2026-02-13)

### Fixed
* `lookup/2` doesn't return a process of the local node that died and whose entry isn't removed yet
  ([#48](https://github.com/ostinelli/syn/issues/48), [#83](https://github.com/ostinelli/syn/pull/83)).
* A node could keep an entry for a process that had died while the two nodes were syncing. The data a node sends when
  syncing and the changes that follow go through the same process, so that they arrive in the order they were sent
  ([#87](https://github.com/ostinelli/syn/pull/87)).
* A node could keep an entry for a process that lost a conflict during a sync. The node whose process loses tells the
  other nodes. Found by Graham Hay with a TLA+ model.
* Corrections to specs ([#77](https://github.com/ostinelli/syn/pull/77),
  [#79](https://github.com/ostinelli/syn/pull/79)) and to the documentation
  ([#82](https://github.com/ostinelli/syn/pull/82)).

### Changed
* Logs go through Erlang's `logger`, as reports.

### Added
* Property tests for the registry and for process groups, and a TLA+ model of the registry in `test/tla`.

## 3.3.0 (2022-04-19)

### Added
* The callbacks `on_registry_process_updated/6` and `on_group_process_updated/6`, which also get the previous
  metadata.

## 3.2.2 (2022-02-23)

### Added
* `member_count/2`, `member_count/3` and `local_member_count/2`
  ([#69](https://github.com/ostinelli/syn/pull/69)).

## 3.2.1 (2022-01-08)

### Added
* Via tuples can carry metadata ([#68](https://github.com/ostinelli/syn/pull/68)).

### Fixed
* Registering a process again with the same metadata returns `ok`. It failed with a missing clause.
* An error in the function passed to `update_registry/3` or `update_member/4` is raised in the calling process.
* The update callbacks aren't called when the update doesn't change the metadata.

## 3.2.0 (2021-12-18)

### Added
* `update_registry/3` and `update_member/4`, to update the metadata of a registered process or of a group member with
  a function.
* `member/3`.

## 3.1.0 (2021-12-10)

### Added
* The `strict_mode` option. See [Options](OPTIONS.md).

## 3.0.1 (2021-11-01)

### Fixed
* The specs of the registry callbacks.

## 3.0.0 (2021-10-24)
First v3 commit.
