Repository navigation
facts: Hello entries per protocol - #160
Merged
Merged
Conversation
`facts::hello_parts` gives what a comline@2 Hello is built from, kept apart: the exchange, the package's id and version and the connection's encodings once, and one entry per protocol on the connection (number, line, shape hash, function numbers, and the provider for the generated code). `HelloParts::assemble` puts any subset of the entries in canonical order, so generated accept / connect can build the Hello of the protocols actually provided and called. With every protocol it is `facts::hello`'s output, byte for byte; `hello` is unchanged and the generators keep using it until they switch over. The corpus gains connections_subset: two applications in one package, a protocol per side in each. A test checks, for every fixture in the corpus with a Hello, that all entries assemble to `hello`'s bytes, and for every subset of connections_subset that the assembled Hello is the package-wide Hello of a package of just those protocols. No existing golden changes; the generators bless the new fixture when they pin this. Refs #153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #153. Part of the smaller step in core#288 (named connections, decided). Adds facts only: nothing a generator emits today changes.
The change
facts::hellobuilds one Hello for the package's whole connection, which the generators embed asHELLO.facts::hello_partsgives what that Hello is built from, kept apart, so generatedaccept/connectcan build the Hello of the protocols actually provided and called (runtime#124, comline-rust#133, comline-typescript#173).HelloParts, once per connection:exchange(offer/symmetric),package(the id, 16 bytes),versionandpre;encodings:HelloEncoding { kind, hash }(0 format, 1 framing, 2 handshake), the connection's, the same whichever protocols a Hello lists;protocols: oneHelloEntryper protocol on the package connection.HelloEntry, per protocol:namespace,name,number,line(as the facts spell it) andrelease(as numbers),shape_hash(16 bytes),functions(name and wire number, in declaration order, for comments and lookups) withfunction_numbers()(ascending, once each, as the wire lists them), andprovider(@provider). A Hello entry carries no direction on the wire;provideris for the generated code, which checks that a side provides only what it provides (settled on runtime#124).HelloParts::assemble(entries)puts any subset in canonical order: encodings ascending by kind then hash, protocols ascending by wire number, function numbers ascending. The order the protocols are given in, and a protocol given twice, don't reach the wire.assemble_all()lists every entry.What stays
facts::helloand its output are unchanged: no line of it is touched, andhello_partsis a second path to the same bytes, with the same refusals in the same words. The generators keep usinghellountil comline-rust#133 and comline-typescript#173 switch over; it can go then.Byte identity
conformance/tests/hello_entries.rs, on the request each generator gets (Rust and TypeScript encodings alike):comline@2,hello_parts(..).assemble_all()ishello(..)'s exact bytes, and the same protocols with the same numbers, lines and functions;hello's output for a package of just those protocols, which keep their wire numbers. That compares against the old code, not against itself. It also checks that the encodings come out the same bytes in every Hello, and that order and repeats don't matter.The subset case
New corpus fixture
connections_subset: two applications in one package,Chat/EventsinconformanceandAdmin/Alertsinconformance/admin, a protocol per side in each, all on the defaults (datagram@3,comline@2). The generators bless it when they pin this.Goldens
No existing golden changes. I checked it against both generators: each of comline-rust (
22110d8) and comline-typescript (671f27e) built against this branch through a local[patch], then blessed. The only differences are the newconnections_subsetgoldens and the "proven by" lists in theirFEATURES.md/features.json, which now count the new fixture. Theircorpus_matches_goldenandsupport_is_provenfail until they bless it, which is what a corpus change does (generation#159).