1# @ajax/mesh-jobs-merge
23How a new leader of the job table merges a majority's answers to its pull. Any two majorities meet,
4so the merge holds every committed entry without matching logs, and the order of application decides
5between two results of one item:
671. The committed tables are applied first, the latest commit point first.
82. Then the entries not committed yet are applied, the latest leadership's first.
910A committed result is therefore never overwritten by one that was not committed, and between
11uncommitted entries the later leadership's wins (review finding 5). `mj_answer` is one member's
12answer as it arrives in numbered parts. `mj_answer_of` builds the new leader's own answer from its
13replica.
1415## Ported from
1617[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT):
18`crates/mesh-host/src/jobs.rs`: `Answer` (`of`), `merge`.
1920## Tests
2122`tests/merge.c`: 100 random merges of up to four answers (committed tables at random commit points,
23entries of random leaderships, a later answer from the same member replacing an earlier one), each
24giving the same table as the Rust's (golden hashes from the Rust), and an answer built from a replica.
2526## Licence
2728MIT. See the repository's LICENSE.