Zdůvodnění
Objevování říká, že někde v síti existuje klíč; neumí říct, že klíč právě odpovídá, obsluhuje stejný repozitář, mluví kompatibilním protokolem nebo patří někomu, komu tento repozitář důvěřuje. Mesh, který bere slyšení jako příslušnost k nám, nechá kteréhokoli hosta na segmentu vkládat nároky a předávky; mesh, jehož transporty, povrchy a testy mají každý vlastní představu, kdo je propojen, skončí tak, že Cockpit ukazuje zelenou tečku u runtime, o kterém CLI ví, že zmizel. ADR 0067 uzavírá obojí: přijetí je jeden handshake s typovanými odmítnutími, replikace je jeden podepsaný žurnál skládaný jednou čistou funkcí a každý povrch je jejich projekcí.
Pravidlo exkluzivity je slib produktu lidem, kteří provozují několik relací a několik strojů na jednom repozitáři: exkluzivní nárok vylučuje všude, nebo nikde. Dvě implementace — jedna pro lokální nástěnku, jedna pro vzdálené peery — by činily tento slib závislým na tom, kde zrovna běží druhý worker.
Požadované chování
-
A link is established only by
Cooperation::dialandCooperation::accept_hello. The hello checks, in the orderaccept_helloruns them — the first that fails decides the refusal, whatever else is wrong with the hello:- cooperation is running (
not_active); - the message is within the link message bound (
oversized); - it has the shape of a hello and a well-formed card (
malformed); - the Ed25519 signature verifies under the hello domain (
signature); - the timestamp is within the skew window (
stale); - the nonce is 32 hex characters (
malformed); - the protocol ranges meet (
protocol_unsupported); - the peer is not this runtime (
self_link); - a hello that names its recipient names this runtime (
misaddressed); - the peer's mesh repository id equals this runtime's (
repository_mismatch); - the peer's key is trusted by the declared policy (
untrusted); - the hello is no older than the one that made the peer's live link (
replay); - its nonce has not been answered before (
replay); - a new peer fits the peer table (
capacity).
Nothing a stranger says is believed before its signature, and the cheap checks run before the expensive ones. The recipient check precedes the replay checks so that a copy captured on its way to another runtime is refused without spending a nonce. The nonce cache is last of the checks a hello can fail on its own, because it holds only nonces of trusted keys of this repository: a stranger's hellos can neither fill it nor evict a real peer's nonce. The age check stands before it because a restart empties the cache, and a hello captured before the restart must not displace a link made since. The welcome a dialer receives is checked for its shape, its signature, the echoed nonce, its timestamp, the protocol, self, the repository and trust. Each failure is a
RefusalCode, counted and listed with its detail. - cooperation is running (
-
Id repozitáře v mesh se odvozuje z kořenových commitů repozitáře nebo se deklaruje jako
cooperation.repository; nikdy se neodvozuje z cesty v souborovém systému, adresy ani názvu hostitele. Runtimy s různými id repozitáře se nikdy nepropojí. -
Relace, tvrzení, předávky a review překračují runtimy jen jako
MeshEvent, podepsané klíčem uzlu svého původu. Relay ukládá a přeposílá bajty; událost, jejíž podpis, vazba klíče na stream, repozitář nebo meze neplatí, je odmítnuta u každého konzumenta. Události se identifikují pomocí(stream, seq), aplikují se v pořadí sekvence na stream a duplikát nezmění nic. -
Tvrzení rozhodují
mesh::state::foldaadmission_conflictsnad cestami, které se setkávají vpeers::claims_meet. Tvrzení žije, dokud není uvolněno, jeho relace je otevřená a tep jeho proudu stoupl v rámci vypršení; souběžná výhradní tvrzení se všude rozhodnou pro nejnižší(lamport, stream, seq)a ostatní jsou pojmenované konflikty. -
CLI, HTTP, OpenAPI, MCP i Cockpit čtou a zapisují kooperaci jen přes schopnosti
capability::builtin::mesh. Žádný povrch nedrží vlastní seznam peerů, stav spojení, nárok ani verdikt o životnosti; Cockpit vykreslujemesh.peers,mesh.stateamesh.cooperation. -
Nic, co propojený peer pošle, nic nespouští: žurnál nese metadata o práci; jediný soubor, jehož zapsání může vzdálená událost způsobit, je spotřebovaná předávka do adresáře předávek tohoto checkoutu, výslovným lokálním příkazem.
Chování při selhání
scripts/ci/mesh-check exits 10 naming a TCP link client or a link handler outside
src/mesh/ and the mesh capability module, a Journal constructed outside src/mesh/,
or a Cockpit page that renders mesh state without asking a mesh capability. What a static
check cannot see is held by apps/majordomus-cli/tests/mesh_cooperation.rs (separate
processes over TCP: links, isolation, trust refusal, crash expiry and restart, three-node
convergence, hostile messages, two worktrees) and test/mesh-lab/run (separate Linux
nodes on a real bridge: multicast discovery, partition and crash recovery), both run in CI.
The order of the hello checks is held by the unit test
mesh::cooperation::tests::the_hello_checks_run_in_the_order_the_rule_lists, which sends
hellos failing each check and each adjacent pair of checks, asserts the refusal of the
earlier one, and reads this rule and docs/MESH.md to assert that both list the checks
in that order.
Ověření
cargo test --manifest-path apps/majordomus-cli/Cargo.toml --lib mesh (deduplikace a řazení žurnálu, konvergence a exkluzivita foldu jako vlastnosti, odmítnutí handshaku, relay tří runtime, usmíření po rozdělení sítě přes in-process transport), cargo test --manifest-path apps/majordomus-cli/Cargo.toml --test mesh_cooperation a test/mesh-lab/run.