Skip to main content

directional_merge_rules_compose

Function directional_merge_rules_compose 

Source
pub async fn directional_merge_rules_compose<F: IngestFixture>(
    open: impl AsyncFn() -> F,
) -> Result<RuleOutcome, Violation>
Expand description

SY-10: the runner may give each direction of one edge its own merge rule, and a store takes what each direction hands it, judging nothing itself.

Two walks over two stores each, both played by one runner that holds a merge rule per direction. Every claim is decided under the guard “no claim on this seat”, and travels with it only where a real runner would send it: a local append records no guard (SY-6), so an end’s own claim travels unguarded, and an ingested claim keeps the guard it arrived under (SY-30). The hub adjudicates by fact family (SY-35), never by a guard.

  • Hub and spoke, in the shipped Edge::step’s order, pull before push. The hub holds another spoke’s claim, ingested under its origin’s guard. The spoke appends its own. It pulls the other claim, whose guard its own log breaks, and takes it unjudged: one event, no reversal. It pushes its own and the hub adjudicates it, writing the claim with its reversal (SY-7). The spoke pulls the reversal. Both logs end with the two claims and the hub’s one reversal, and the spoke still holds its own claim under its own identity (E2E-45).
  • Peer to peer. Each peer appends its own claim. Neither adjudicates the family on this edge, so each takes the other’s claim unjudged. Both logs end with the two claims and no reversal.

Every ingest’s counts must be what the runner handed the store, and every log is compared by type and bytes, never decoded (SY-35).

§Rejects

A store with the merge rule built in: it answers a group whose travelling guard its log breaks with a reversal of its own, in the same write. As a spoke it judges the guarded claim the hub sends, which is SY-10’s falsifier, and writes a reversal no direction asked for. tests/wrong_ingest_stores.rs carries it.

And a store that gives up its own fact when a peer’s claim on the same seat arrives, as an upsert keyed by the fact family does: it re-mints its own claim under a new identity, so every log still compares equal by type and bytes, and only the check that each end still holds its own claim under its own identity sees it. tests/wrong_ingest_stores.rs carries it too.

§Does not reject

A runner that forces one rule on both directions. The rule plays the runner, mounting each direction’s merge rule through the shipped runner::Adjudicate hook, and always honours each direction’s. That configuration, the hub’s rule on the spoke, is the clause’s falsification test, in this crate’s own tests: it leaves no claim to the seat standing. The shipped runner’s half is checked in happenstance-sync’s tests/runner/wrong_runners.rs (#450): an edge judges only what it pulls, by the rule it was given, and never what it pushes; a StoreSyncPeer judges what it is pushed.

A spoke rolled back on a refused push (SY-34). The walk plays no refusal (SY-33), because the store is never told of one: a declined push is the far peer’s answer to SyncPeer::push, and every port the runner holds over the store only adds events, so the rollback cannot be written through them and no store could fail a check at the refusal. The runner’s half is held in happenstance-sync’s runner tests: tests/runner/directions.rs, whose declined step keeps the spoke’s own claim, and tests/runner/main.rs’s a_refused_push_keeps_the_log_and_the_watermark_and_records_the_class.

§Errors

A Violation of SY-10 if the fixture gives both stores of an edge one identity, if a store cannot say who it is, refuses its own claim or an ingest, miscounts one, or ends holding other facts than its edge’s rules leave, or without its own claim.