Skip to content

RFP: replicas, declared bidirectional replication over the transmit family #50

Open

Description

@cardmagic

Summary

Give bidirectional replication a first-class surface: two runtimes declare a replica pair, each stages transmits for the operations the other mirrors, and each ingests the other's envelopes. The transmit family (#47, #48, shipped in #49 with the engine route) provides the mechanism; this proposal names the missing declaration. This is the feature that earns the "replica" name.

On origin/main (80523e7) this is still not implemented. docs/roadmap.md and docs/transmission.md both say bidirectional replication with echo suppression is a separate feature, and that the declaration API does not exist. No code suppresses an echo. The golden envelopes in compatibility/transmit-envelopes.json have no origin field.

Why this is deferred

Wiring register_transmit at both ends of a pair already works today, but only for one direction at a time. Point both directions at each other and the pair loops. Transmission.receive enqueues the mirrored operation as an internal message whose idempotency key is transmit: plus the envelope's effectId. When that message runs, the actor's operation can call Actor#transmit, which emits solid-objects.transmit with no prefix check. An operation can also emit "solid-objects.transmit" directly, as the increment_mirror fixture in test/integration/transmit_staging_test.rb does. Either path stages another envelope, and the mirrored apply transmits straight back. Echo suppression is the design problem, and it deserves its own review rather than a rider on #49.

The JavaScript runtime uses the same transmit: prefix (transmit:<effectId>) and also stages the transmit effect from transmit() with no prefix check.

Design questions

  1. Echo suppression. Decided (Lucas, 29 Nov 2026): stage nothing when the current turn applies a message whose idempotency key carries the transmit: prefix, so a replayed operation never re-transmits. The check lives at staging time for any solid-objects.transmit effect, not only inside Actor#transmit. A check only inside Actor#transmit would not see a direct emit "solid-objects.transmit". A multi-hop topology (A → B → C) then needs an explicit forwarding override, because suppression at B would stop the chain. This does not add an origin field; that remains Design question 5.
  2. Declaration API. What form earns the name: a class-level replicate_to on the actor, or a runtime-level pairing that wires register_transmit, the engine route policy, and the resolver in one declaration?
  3. Identity. A replica pair needs a bijective actor type mapping. The current resolve_actor_type / transmission_actor_type_resolver are one-way; a pair declaration should derive both directions from one mapping.
  4. Conflict posture. Per-actor ordered replay gives last-writer-wins in arrival order. Document single-writer-per-actor as the supported convention first; divergence detection (periodic state digest exchange) is a separate follow-up.
  5. Wire contract. Loop prevention across more than two runtimes likely needs an origin field in the envelope. That is a contract revision, so it lands in compatibility/transmit-envelopes.json and both runtimes together.

Plan

  1. Prototype the echo suppression rule behind the existing transmit tests, and prove a two-runtime pair converges instead of looping.
  2. Settle the declaration API against a real pair (the Rails QA app and a Node runtime already exercise both directions one way at a time).
  3. Revise the fixture file if origin lands, with consuming tests in both repositories.
  4. Documentation, roadmap, parity ledger, both changelogs, both suites green.

References

#47 and #48 (closed RFPs), #49 (merged; the shipped transmit family and engine route), solid-objects-js#17 (closed), and solid-objects-js#18 (merged).

Activity

  1. sharmis-tp commented on Oct 27, 2026

    @sharmis-tp

    You can trace the loop in the code. Transmission.receive enqueues the mirrored operation with an idempotency key of IDEMPOTENCY_PREFIX plus the effectId. The handler then runs, and the dispatcher in Actor#transmit calls emit(Transmission::EFFECT_NAME, ...) unconditionally, so the envelope goes straight back.

    I'd take only step 1 of the plan as a scoped first PR: echo suppression keyed on the transmit: prefix, with no declaration API and no envelope change. I'd start with a failing test in the style of transmit_staging_test.rb, where two actor types transmit to each other and the ingesting side must stage nothing. Questions 2–5 stay with you.

    One thing to settle first: should suppression live in Actor#transmit or at staging time? The increment_mirror fixture calls emit "solid-objects.transmit" directly, so a check inside transmit would never see it.

    Could you assign me? The PR would be up within 1–2 days.

  2. cardmagic commented on Nov 29, 2026

    @cardmagic
    OwnerAuthor

    Design question 1 is decided. Stage nothing when the current turn applies a message whose idempotency key carries the transmit: prefix, so a replayed operation never re-transmits. The check lives at staging time for any solid-objects.transmit effect, not only inside Actor#transmit. A multi-hop topology (A → B → C) still needs an explicit forwarding override, because suppression at B would stop the chain. This does not add an origin field; that remains Design question 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions