Skip to content

feat: add a per-peer protocol switch and a cross-version test harness - #9608

Open
pjwerneck wants to merge 3 commits into
devfrom
pjwerneck/protocol-switch
Open

pjwerneck wants to merge 3 commits into
devfrom
pjwerneck/protocol-switch

Conversation

@pjwerneck

Copy link
Copy Markdown
Collaborator

Summary

A per-peer switch keeps behaviour from a later syft protocol off for a peer that does not speak it. Test fixtures pair a client on the released protocol with one on a test-only next protocol. Last item of "connsplit v1.2: Owner delivery".

Changes

  • ConnectionRouter.pair_speaks_protocol(): False for a peer with an unknown schema. No callers yet.
  • MigrationRegistry.infer_protocol_version_to_use() takes the peer's ProtocolSchema.
  • syft-migration exports protocol_version_at_least().
  • Fixtures next_protocol and pin_syft_protocol().
  • syft_settings.json carries a version; a later version is refused.

Testing

  • New test_protocol_skew_pair.py: job round trip with either side on the released protocol.
  • syft-migration, client migrations, syft-job, syft-datasets, root unit, syft-rds and syft-enclave pass.

Asana task

- ConnectionRouter.pair_speaks_protocol() says whether this client and a peer both speak a syft protocol version. A behaviour that a later protocol adds can then stay off for a peer that does not speak it. A peer with an unknown schema gets False.
- ConnectionRouter.negotiated_protocol_version_for_peer() returns the negotiated version. _downgrade_for_peer() uses the same negotiation.
- syft-migration exports protocol_version_at_least(), which compares versions as integers.
- The next_protocol and pin_syft_protocol test fixtures hold one client at the released protocol and run the other on a test-only next protocol. test_protocol_skew_pair.py runs a job round trip between them.
- The datasite settings file carries a format version. A file of another version is refused, as the key file is.
- The settings file's version is checked on the raw JSON before the fields are validated, so a later layout is refused by its version, not by a pydantic error. Only a later version is refused, as for checkpoints and rolling state. The key file keeps its own check.
- MigrationRegistry.infer_protocol_version_to_use() takes the peer's ProtocolSchema. The router, JobStorage and DatasetStorage pass the schema, and the router's wrapper is gone.
- The control test also checks that a pair speaks an earlier protocol, so an equality check fails it.
- pair_speaks_protocol() documents MigrationError, the pin_syft_protocol docstring says what it does not hold back, and the syft-migration README lists protocol_version_at_least().
- _peer() is now _peer_schema(), because it returns the schema a peer advertises.
- Four floor tests drop their articles, for example test_the_peer_floor_refuses_us() is now test_peer_floor_refuses_us().

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant