IF Commons GitHub

logical/conformance/merge

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0009-anyfs-merge-physical FR-011, 0009-anyfs-merge-physical FR-012

The conformance suite of a store that merges: the laws every replica obeys, written as cases that run against replicas a backend makes. They are the laws a SQL dump of such a database relies on: a merge is a union of rows, so it is the same in any order, however grouped and however often, and what a path holds is a function of the rows alone. A case needs replicas that trust one another, and the cases of refusal need one that does not; each failure is a sentence that says what differed. The suite is held by a test that runs it against deliberately broken replicas and sees each one fail.

import { runMergeConformance } from "./merge.ts";
// const report = await runMergeConformance(async (n, o) => replicasOfMyBackend(n, o))

Source: commons/anyfs/src/logical/conformance/merge.ts

3 of 7 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

MakeReplicastype
type MakeReplicas = (count: number, options: { readonly trusting: boolean }) => Promise<readonly MergeFace[]>;

What a backend gives the suite: that many new replicas that hold nothing, trusting one another or, where trusting is false, taking changes from themselves alone.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

MergeCasetypeno test imports it
type MergeCase = { readonly id: string; readonly title: string; readonly run: (make: MakeReplicas) => Promise<void> };

A case of the merge suite.

MergeCaseReporttypeno test imports it
type MergeCaseReport = { readonly id: string; readonly title: string; readonly failure?: string };

What one case did.

MergeFacetype
type MergeFace = {
  readonly store: Store<MergeFaceCapabilities>;
  readonly replica: ReplicaId;
  readonly siblings?: (path: Path) => readonly { readonly id: string }[];
};

A replica as the suite sees it: its store, who it is and, where it can say so, the heads of a path that did not win.

Imported by 11 tests of the run (11 passed, 0 failed): the library's results

MERGE_CASESconstno test imports it
const MERGE_CASES: readonly MergeCase[]

Every case of the merge suite.

runMergeCasefunctionno test imports it
function runMergeCase(c: MergeCase, make: MakeReplicas): Promise<MergeCaseReport>

Runs one case, and reports it with its failure as a sentence.

runMergeConformancefunction
function runMergeConformance(make: MakeReplicas): Promise<readonly MergeCaseReport[]>

Runs every case of the merge suite against replicas made by make, and reports each.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.