Skip to content

Version pairing

The SDK and the API are paired: on its first request the client compares its own yousleep_common version with the server's and raises ClientConnectionError on any difference, patch releases included (strict_version_check=True, the default).

Both are pre-release software: until a stable version is declared they change quickly, and a new major version can arrive at any time.

The policy

  1. Exact pairing is the supported mode. Run the yousleep-common version the API reports (GET /status/version). Every release therefore asks every SDK user to upgrade in lockstep, and that cost is weighed before each one.
  2. Version numbers mean the following:
    • major: the meaning of something that already exists changes: removals, type changes, renamed fields and changed defaults. A changed default is a major because pairing hides it: both sides upgrade together, nothing mismatches, and code that omitted the field silently changes behaviour. The version check cannot catch this; the release discipline is the guard.
    • minor: additive surface: new endpoints, models, fields and enum members. This is safe because a conforming client is on the same version.
    • patch: fixes within the existing meaning.
  3. The escape hatch guarantees nothing. strict_version_check=False turns the mismatch into a warning. It is a short-lived bridge, for example to read data during an upgrade. On that path a mismatch can surface as a ValidationError in the middle of a call, far from its cause. Do not use it in automation.

What the check does not cover

  • A server that changes mid-session. Each client checks once, on its first request. A deployment that replaces the API under a long-lived client changes the server's version without a new check, and the mismatch can surface as parsing errors until a new client is created. Rolling deployments make this window ordinary, so for a long-lived process the check is necessary but not sufficient.
  • Changes of meaning that keep the shape. The check proves both sides agree on which contract, not that its meaning held. The rule that a changed default is a major exists for this.