From 88dbeba73fa88d08feb39fea8f2933068ccb39c1 Mon Sep 17 00:00:00 2001 From: Kinflou Date: Tue, 17 Nov 2026 00:00:02 +0800 Subject: [PATCH] comline@2: conformance cases for a Hello that lists a subset of the package's protocols (specification#13) (0.12) New handshake-comline2 cases: hello-subset (the exact bytes), offer-subset-offered, offer-subset-local, conclude-subset, conclude-answer-beyond-offer, symmetric-subset-local and finish-refused-unlisted. No existing case changes; hello stays the default Hello that lists every protocol. Calls outside the Hello, providing outside it and the no-Hello case are runtime behaviour the ops can't ask about; the changes entry says so. --- README.md | 34 +- VERSION | 2 +- rust/src/catalog.rs | 2 +- vectors/handshake-comline2.json | 711 ++++++++++++++++++++++++++++---- 4 files changed, 662 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 542b501..9e30e07 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ proven, the formats of these files, and the catalog of names they share. A runti tool implements against this repository, and pins it like any other dependency. Comline's own runtimes do the same. -Version: **0.11** ([`VERSION`](VERSION)). While Comline is in its early days +Version: **0.12** ([`VERSION`](VERSION)). While Comline is in its early days (0.x), a minor version may change anything, and the change is named in the pull request that makes it and in [the changes](#changes) below. @@ -229,6 +229,38 @@ What an implementation answers, and how its answers are judged: ### Changes +- **0.12:** `comline@2` cases for a Hello that lists a subset of the package's + protocols (named connections, specification#13): an end provides some of the + package's protocols and calls some of the other side's, and its Hello lists + exactly those. No existing case changes. New cases, all in + `handshake-comline2`: + - `hello-subset`: the `hello` case's bytes with protocol 0's entry gone and + the count one. `hello` is the default, a Hello that lists every protocol on + the package's connection: its bytes are what they were. + - `offer-subset-offered`: the offer lists protocol 0 alone, and the responder, + which also has protocol 1, answers only what was offered. Under + `scope = protocol` its result has protocol 1 refused on its own + (`unknown_protocol`): calls to it fail locally. + - `offer-subset-local`: the responder lists protocol 1 alone and the offer + both, so protocol 0 is refused (`unknown_protocol`) in the answer and the + responder's result has no protocol 0. + - `conclude-subset`: the initiator offered protocol 0 alone and the answer + takes it. `conclude-answer-beyond-offer`: an answer that also names + protocol 1, which the offer didn't list, is `malformed`. + - `symmetric-subset-local`: an end listing protocol 0 alone, against a peer + that lists both: its verdict refuses protocol 1, and its result has no + protocol 1. + - `finish-refused-unlisted`: the peer's verdict refuses protocol 1, which this + end never listed, and what this end agreed doesn't change. + + A protocol a result doesn't hold, and one it holds as refused, are the ones + whose calls fail locally (`Unavailable`) and that `provide` refuses on a + connection that ran a Hello. That behaviour is the runtime's, not a message or + a negotiation step, so no case states it: the ops have nothing to ask a + runtime about a call or about providing (runtime#124 holds it in the + runtime's own tests, and + [specification#13](https://github.com/ComlineProject/specification/issues/13) + the question of whether the corpus should). - **0.11:** a framing states `protocol`: `named`, when a request's frame names the protocol it calls into, by number or wire id, so several protocols can share one transport, or `unnamed`, when it doesn't and a call names only its function. A diff --git a/VERSION b/VERSION index 51176c7..c43e105 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11 +0.12 diff --git a/rust/src/catalog.rs b/rust/src/catalog.rs index f46585c..3e7c461 100644 --- a/rust/src/catalog.rs +++ b/rust/src/catalog.rs @@ -5,7 +5,7 @@ use crate::{ SeqSize, Sizes, Status, StringSize, StructSize, Value, Width, }; -pub const SPEC_VERSION: &str = r#"0.11"#; +pub const SPEC_VERSION: &str = r#"0.12"#; /// Every guarantee, in the catalog's order. pub const GUARANTEES: &[Guarantee] = &[ diff --git a/vectors/handshake-comline2.json b/vectors/handshake-comline2.json index 848264f..4b320a9 100644 --- a/vectors/handshake-comline2.json +++ b/vectors/handshake-comline2.json @@ -133,6 +133,52 @@ }, "bytes": "434f0201010123456789abcdef0123456789abcdef01c801f0a204056465762e320300111111111111111111111111111111110122222222222222222222222222222222023333333333333333333333333333333303000100000101010101010101010101010101010100ac0201c801000202020202020202020202020202020204007f8001ffff03ffff03000001030303030303030303030303030303030105" }, + { + "id": "handshake-comline2/hello-subset", + "op": "comline2_message", + "input": { + "message": { + "encodings": [ + { + "kind": "format", + "param_hash": "11111111111111111111111111111111" + }, + { + "kind": "framing", + "param_hash": "22222222222222222222222222222222" + }, + { + "kind": "handshake", + "param_hash": "33333333333333333333333333333333" + } + ], + "exchange": "offer", + "package_id": "0123456789abcdef0123456789abcdef", + "protocols": [ + { + "functions": [ + 0, + 1 + ], + "line": { + "major": 0, + "minor": 1, + "patch": 0 + }, + "number": 1, + "shape_hash": "b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0" + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } + }, + "type": "hello" + }, + "bytes": "434f0201000123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330101000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" + }, { "id": "handshake-comline2/hello-empty", "op": "comline2_message", @@ -1728,7 +1774,7 @@ "bytes": "434f0201000123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330107000300c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00100" }, { - "id": "handshake-comline2/offer-package-mismatch", + "id": "handshake-comline2/offer-subset-offered", "op": "comline2_negotiate", "input": { "local": { @@ -1791,25 +1837,60 @@ }, "reply": { "message": { - "refuse": { - "reason": "package_mismatch", - "side": "responder" + "accept": { + "protocols": [ + { + "number": 0, + "status": { + "accepted": { + "missing": [], + "shape_differs": false + } + } + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } } }, "type": "answer" }, "result": { - "refused": { - "reason": "package_mismatch", - "side": "responder" + "accepted": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 0, + "state": { + "accepted": { + "peer_lacks": [] + } + } + }, + { + "number": 1, + "state": { + "refused": { + "reason": "unknown_protocol" + } + } + } + ] } }, "step": "answer_offer" }, - "bytes": "434f020100eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" + "bytes": "434f0201000123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330100000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a003000102" }, { - "id": "handshake-comline2/offer-encoding-mismatch", + "id": "handshake-comline2/offer-subset-local", "op": "comline2_negotiate", "input": { "local": { @@ -1830,20 +1911,6 @@ "exchange": "offer", "package_id": "0123456789abcdef0123456789abcdef", "protocols": [ - { - "functions": [ - 0, - 1, - 2 - ], - "line": { - "major": 0, - "minor": 2, - "patch": 0 - }, - "number": 0, - "shape_hash": "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" - }, { "functions": [ 0, @@ -1872,25 +1939,60 @@ }, "reply": { "message": { - "refuse": { - "reason": "encoding_mismatch", - "side": "responder" + "accept": { + "protocols": [ + { + "number": 0, + "status": { + "refused": { + "reason": "unknown_protocol" + } + } + }, + { + "number": 1, + "status": { + "accepted": { + "missing": [], + "shape_differs": false + } + } + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } } }, "type": "answer" }, "result": { - "refused": { - "reason": "encoding_mismatch", - "side": "responder" + "accepted": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 1, + "state": { + "accepted": { + "peer_lacks": [] + } + } + } + ] } }, "step": "answer_offer" }, - "bytes": "434f0201000123456789abcdef0123456789abcdef00030000030012121212121212121212121212121212012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" + "bytes": "434f0201000123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" }, { - "id": "handshake-comline2/offer-exchange-mismatch", + "id": "handshake-comline2/offer-package-mismatch", "op": "comline2_negotiate", "input": { "local": { @@ -1954,7 +2056,7 @@ "reply": { "message": { "refuse": { - "reason": "exchange_mismatch", + "reason": "package_mismatch", "side": "responder" } }, @@ -1962,16 +2064,16 @@ }, "result": { "refused": { - "reason": "exchange_mismatch", + "reason": "package_mismatch", "side": "responder" } }, "step": "answer_offer" }, - "bytes": "434f0201010123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" + "bytes": "434f020100eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" }, { - "id": "handshake-comline2/offer-malformed", + "id": "handshake-comline2/offer-encoding-mismatch", "op": "comline2_negotiate", "input": { "local": { @@ -2035,7 +2137,7 @@ "reply": { "message": { "refuse": { - "reason": "malformed", + "reason": "encoding_mismatch", "side": "responder" } }, @@ -2043,16 +2145,16 @@ }, "result": { "refused": { - "reason": "malformed", + "reason": "encoding_mismatch", "side": "responder" } }, "step": "answer_offer" }, - "bytes": "68656c6c6f" + "bytes": "434f0201000123456789abcdef0123456789abcdef00030000030012121212121212121212121212121212012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" }, { - "id": "handshake-comline2/offer-handshake-version", + "id": "handshake-comline2/offer-exchange-mismatch", "op": "comline2_negotiate", "input": { "local": { @@ -2116,7 +2218,7 @@ "reply": { "message": { "refuse": { - "reason": "handshake_version", + "reason": "exchange_mismatch", "side": "responder" } }, @@ -2124,16 +2226,16 @@ }, "result": { "refused": { - "reason": "handshake_version", + "reason": "exchange_mismatch", "side": "responder" } }, "step": "answer_offer" }, - "bytes": "434f010100000000000000e6960a06851063366b50a199ba43a44400000000" + "bytes": "434f0201010123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" }, { - "id": "handshake-comline2/conclude-accept", + "id": "handshake-comline2/offer-malformed", "op": "comline2_negotiate", "input": { "local": { @@ -2196,45 +2298,25 @@ }, "reply": { "message": { - "accept": { - "refused": [] + "refuse": { + "reason": "malformed", + "side": "responder" } }, - "type": "verdict" + "type": "answer" }, "result": { - "accepted": { - "peer_version": { - "major": 0, - "minor": 3, - "patch": 0 - }, - "protocols": [ - { - "number": 0, - "state": { - "accepted": { - "peer_lacks": [] - } - } - }, - { - "number": 1, - "state": { - "accepted": { - "peer_lacks": [] - } - } - } - ] + "refused": { + "reason": "malformed", + "side": "responder" } }, - "step": "conclude_answer" + "step": "answer_offer" }, - "bytes": "434f0202000003000002000000010000" + "bytes": "68656c6c6f" }, { - "id": "handshake-comline2/conclude-degrade", + "id": "handshake-comline2/offer-handshake-version", "op": "comline2_negotiate", "input": { "local": { @@ -2297,22 +2379,204 @@ }, "reply": { "message": { - "accept": { - "refused": [] + "refuse": { + "reason": "handshake_version", + "side": "responder" } }, - "type": "verdict" + "type": "answer" }, "result": { - "accepted": { - "peer_version": { - "major": 0, - "minor": 2, - "patch": 1 + "refused": { + "reason": "handshake_version", + "side": "responder" + } + }, + "step": "answer_offer" + }, + "bytes": "434f010100000000000000e6960a06851063366b50a199ba43a44400000000" + }, + { + "id": "handshake-comline2/conclude-accept", + "op": "comline2_negotiate", + "input": { + "local": { + "encodings": [ + { + "kind": "format", + "param_hash": "11111111111111111111111111111111" }, - "protocols": [ - { - "number": 0, + { + "kind": "framing", + "param_hash": "22222222222222222222222222222222" + }, + { + "kind": "handshake", + "param_hash": "33333333333333333333333333333333" + } + ], + "exchange": "offer", + "package_id": "0123456789abcdef0123456789abcdef", + "protocols": [ + { + "functions": [ + 0, + 1, + 2 + ], + "line": { + "major": 0, + "minor": 2, + "patch": 0 + }, + "number": 0, + "shape_hash": "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" + }, + { + "functions": [ + 0, + 1 + ], + "line": { + "major": 0, + "minor": 1, + "patch": 0 + }, + "number": 1, + "shape_hash": "b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0" + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } + }, + "params": { + "exchange": "offer", + "newer_consumer": "degrade", + "same_version_differs": "refuse", + "scope": "protocol" + }, + "reply": { + "message": { + "accept": { + "refused": [] + } + }, + "type": "verdict" + }, + "result": { + "accepted": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 0, + "state": { + "accepted": { + "peer_lacks": [] + } + } + }, + { + "number": 1, + "state": { + "accepted": { + "peer_lacks": [] + } + } + } + ] + } + }, + "step": "conclude_answer" + }, + "bytes": "434f0202000003000002000000010000" + }, + { + "id": "handshake-comline2/conclude-degrade", + "op": "comline2_negotiate", + "input": { + "local": { + "encodings": [ + { + "kind": "format", + "param_hash": "11111111111111111111111111111111" + }, + { + "kind": "framing", + "param_hash": "22222222222222222222222222222222" + }, + { + "kind": "handshake", + "param_hash": "33333333333333333333333333333333" + } + ], + "exchange": "offer", + "package_id": "0123456789abcdef0123456789abcdef", + "protocols": [ + { + "functions": [ + 0, + 1, + 2 + ], + "line": { + "major": 0, + "minor": 2, + "patch": 0 + }, + "number": 0, + "shape_hash": "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" + }, + { + "functions": [ + 0, + 1 + ], + "line": { + "major": 0, + "minor": 1, + "patch": 0 + }, + "number": 1, + "shape_hash": "b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0" + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } + }, + "params": { + "exchange": "offer", + "newer_consumer": "degrade", + "same_version_differs": "refuse", + "scope": "protocol" + }, + "reply": { + "message": { + "accept": { + "refused": [] + } + }, + "type": "verdict" + }, + "result": { + "accepted": { + "peer_version": { + "major": 0, + "minor": 2, + "patch": 1 + }, + "protocols": [ + { + "number": 0, "state": { "accepted": { "peer_lacks": [ @@ -2909,6 +3173,154 @@ }, "bytes": "434f0202010501" }, + { + "id": "handshake-comline2/conclude-subset", + "op": "comline2_negotiate", + "input": { + "local": { + "encodings": [ + { + "kind": "format", + "param_hash": "11111111111111111111111111111111" + }, + { + "kind": "framing", + "param_hash": "22222222222222222222222222222222" + }, + { + "kind": "handshake", + "param_hash": "33333333333333333333333333333333" + } + ], + "exchange": "offer", + "package_id": "0123456789abcdef0123456789abcdef", + "protocols": [ + { + "functions": [ + 0, + 1, + 2 + ], + "line": { + "major": 0, + "minor": 2, + "patch": 0 + }, + "number": 0, + "shape_hash": "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } + }, + "params": { + "exchange": "offer", + "newer_consumer": "degrade", + "same_version_differs": "refuse", + "scope": "protocol" + }, + "reply": { + "message": { + "accept": { + "refused": [] + } + }, + "type": "verdict" + }, + "result": { + "accepted": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 0, + "state": { + "accepted": { + "peer_lacks": [] + } + } + } + ] + } + }, + "step": "conclude_answer" + }, + "bytes": "434f0202000003000001000000" + }, + { + "id": "handshake-comline2/conclude-answer-beyond-offer", + "op": "comline2_negotiate", + "input": { + "local": { + "encodings": [ + { + "kind": "format", + "param_hash": "11111111111111111111111111111111" + }, + { + "kind": "framing", + "param_hash": "22222222222222222222222222222222" + }, + { + "kind": "handshake", + "param_hash": "33333333333333333333333333333333" + } + ], + "exchange": "offer", + "package_id": "0123456789abcdef0123456789abcdef", + "protocols": [ + { + "functions": [ + 0, + 1, + 2 + ], + "line": { + "major": 0, + "minor": 2, + "patch": 0 + }, + "number": 0, + "shape_hash": "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } + }, + "params": { + "exchange": "offer", + "newer_consumer": "degrade", + "same_version_differs": "refuse", + "scope": "protocol" + }, + "reply": { + "message": { + "refuse": { + "reason": "malformed", + "side": "initiator" + } + }, + "type": "verdict" + }, + "result": { + "refused": { + "reason": "malformed", + "side": "initiator" + } + }, + "step": "conclude_answer" + }, + "bytes": "434f0202000003000002000000010000" + }, { "id": "handshake-comline2/conclude-malformed", "op": "comline2_negotiate", @@ -3598,6 +4010,92 @@ }, "bytes": "434f0201010123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330100000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a003000102" }, + { + "id": "handshake-comline2/symmetric-subset-local", + "op": "comline2_negotiate", + "input": { + "local": { + "encodings": [ + { + "kind": "format", + "param_hash": "11111111111111111111111111111111" + }, + { + "kind": "framing", + "param_hash": "22222222222222222222222222222222" + }, + { + "kind": "handshake", + "param_hash": "33333333333333333333333333333333" + } + ], + "exchange": "symmetric", + "package_id": "0123456789abcdef0123456789abcdef", + "protocols": [ + { + "functions": [ + 0, + 1, + 2 + ], + "line": { + "major": 0, + "minor": 2, + "patch": 0 + }, + "number": 0, + "shape_hash": "a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" + } + ], + "version": { + "major": 0, + "minor": 3, + "patch": 0 + } + }, + "params": { + "exchange": "symmetric", + "newer_consumer": "degrade", + "same_version_differs": "refuse", + "scope": "protocol" + }, + "reply": { + "message": { + "accept": { + "refused": [ + { + "number": 1, + "reason": "unknown_protocol" + } + ] + } + }, + "type": "verdict" + }, + "result": { + "accepted": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 0, + "state": { + "accepted": { + "peer_lacks": [] + } + } + } + ] + } + }, + "side": "initiator", + "step": "judge_hello" + }, + "bytes": "434f0201010123456789abcdef0123456789abcdef00030000030011111111111111111111111111111111012222222222222222222222222222222202333333333333333333333333333333330200000200a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a00300010201000100b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0020001" + }, { "id": "handshake-comline2/symmetric-same-version-differs-warn", "op": "comline2_negotiate", @@ -3987,6 +4485,51 @@ }, "bytes": "434f020300010008" }, + { + "id": "handshake-comline2/finish-refused-unlisted", + "op": "comline2_negotiate", + "input": { + "pending": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 0, + "state": { + "accepted": { + "peer_lacks": [] + } + } + } + ] + }, + "result": { + "accepted": { + "peer_version": { + "major": 0, + "minor": 3, + "patch": 0 + }, + "protocols": [ + { + "number": 0, + "state": { + "accepted": { + "peer_lacks": [] + } + } + } + ] + } + }, + "side": "initiator", + "step": "finish" + }, + "bytes": "434f020300010109" + }, { "id": "handshake-comline2/finish-refused", "op": "comline2_negotiate",