8000 minvmd: the egress gate's hand-over and withdrawal should wait for the publish relays they admitted · Issue #3903 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

minvmd: the egress gate's hand-over and withdrawal should wait for the publish relays they admitted #3903

Backlog

Description

@bryan-minimal

The publish ledger decides on a publish when it is admitted, but the relay writes it to the switch later, and nothing ties that write to what the gate decides in between. PR #3779 review left three cases open:

  1. Settling a claim on a publish that has not been written yet (fix(minvmd): recognise the switch's whole answer for a listener it already holds #3779, egress_gate.rs:2972). A HeldClaimed publish is noted before its write on purpose, so that a bind can never arrive before its note. As a result, an already-bound answer to the claim's expose can settle the claim while that publish is still being written and might never land.
  2. A publish written after its row's withdrawal (fix(minvmd): recognise the switch's whole answer for a listener it already holds #3779, :3360). revocation_pending is checked at decision time. A publish admitted before the withdrawal and written after the withdrawal's unexpose can still bind once the address is released, and the forward then serves the next box at that address. This affects every relayed publish (Noted, Held, HeldClaimed), not only the hand-over.
  3. A relay's take-back lands on whatever record is there now (fix(minvmd): recognise the switch's whole answer for a listener it already holds #3779, :3303). note_unrelayed matches on listener and address. If the record is settled and a new one is filed for the same pair while a relay is still open, that relay's late refusal subtracts from the new record.

Proposal: keep a count of open relays per address and listener in the ledger. The count goes up at admission and down when the relay's write fails or its answer is read. Each relay also carries a token naming the record (or claim generation) it noted on. apply_waiting decides an already-bound answer only when no relay of the claim is open, and otherwise waits briefly for them to finish. revoke_box_forwards does not release an address while relays admitted at it are still open. note_unrelayed takes back a note only from the record its token names.

Tests: one in-crate test per case. Each drives the interleaving through relay_control with a stand-in switch, and each fails on the current code.


This is a residual of epic #1437 (NET).

Activity

  1. bryan-minimal commented on Nov 30, 2026

    @bryan-minimal
    MemberAuthor

    A fourth case, from the review of #3779 (egress_gate.rs, release_claim):

    1. A refused final expose releases the attribution while a relayed publish is still open. When the host's last expose for a claim is refused, release_claim removes the applied entry for the listener. A publish of the claimed forward that was already relayed can still bind after that and return 200. Its success does not pass through admit_publish again, so nothing restores the entry, and a later withdrawal finds no applied entry to unexpose. The switch can then keep the forward live while the address goes to another box.

    The proposal above covers it: release_claim keeps the attribution while relays admitted for that listener and address are open, and releases it when the last one fails or is answered. Test: a counted publish still open, the claim's final expose refused, then the publish binds; the withdrawal must still send the unexpose.

  2. added
    priority:should-have
    on Dec 4, 2026
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

    priority:should-have

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0