|
15 | 15 | subclass's body is what takes effect. |
16 | 16 |
|
17 | 17 | A normal client (Python ``Client`` or the C++ extension) declares |
18 | | -``protocol_version = "1.0.0"`` and sends it on every request. Because this |
19 | | -worker enforces ``"99.0.0"``, the major versions differ and the dispatch |
20 | | -boundary raises ``ProtocolVersionError`` with a directional "upgrade the |
21 | | -client" message that round-trips back to the caller. |
| 18 | +``protocol_version = "3.1.0"`` and sends it on every request. Because this |
| 19 | +worker defaults to ``"99.0.0"``, the major/minor versions differ and the |
| 20 | +dispatch boundary raises ``ProtocolVersionError`` with a directional upgrade |
| 21 | +message that round-trips back to the caller. Tests may override the worker to |
| 22 | +``"3.0.0"`` to exercise the real previous-minor rollout boundary. |
22 | 23 |
|
23 | 24 | Otherwise this is a drop-in replacement for ``vgi-fixture-worker``: it |
24 | 25 | inherits every function and the catalog from :class:`ExampleWorker`, so any |
|
30 | 31 |
|
31 | 32 | from __future__ import annotations |
32 | 33 |
|
| 34 | +import os |
33 | 35 | from typing import ClassVar |
34 | 36 |
|
35 | 37 | from vgi._test_fixtures.worker import ExampleWorker |
36 | 38 | from vgi.protocol import VgiProtocol |
37 | 39 |
|
38 | | -# A major-version bump guarantees a mismatch against any real client's |
39 | | -# "1.0.0" (vgi-rpc compares major+minor exactly, ignoring patch). Declared on |
| 40 | +# A major-version bump guarantees a mismatch against any real client. Tests can |
| 41 | +# override this with a previous minor (for example 3.0.0 versus 3.1.0) to prove |
| 42 | +# that the production rolling-upgrade boundary is enforced too. Declared on |
40 | 43 | # this class body so ``vars(BadProtocol)["protocol_version"]`` resolves to it. |
41 | | -BAD_PROTOCOL_VERSION = "99.0.0" |
| 44 | +BAD_PROTOCOL_VERSION = os.environ.get("VGI_BAD_PROTOCOL_VERSION", "99.0.0") |
42 | 45 |
|
43 | 46 |
|
44 | 47 | class BadProtocol(VgiProtocol): |
|
0 commit comments