1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! The version handshake: what this server is, and the oldest CAD app it
//! serves.
//!
//! Both are semver strings, `MAJOR.MINOR.PATCH`, and both ride `/api/me`
//! (`server_version`, `min_client_version`) so the CAD app checks them right
//! after sign-in and refuses to connect on a mismatch, naming both
//! (plm-cad-integration-todo §2 P1). This file is their single source: every
//! route that reports them (`/api/me`, and `GET /cad/config` when it lands)
//! reads these constants — through `ServerConfig::min_client_version`, which
//! is [`MIN_CLIENT_VERSION`] unless `serve --min-client-version` raised it.
//!
//! # Who compares what
//!
//! The CAD app compares its OWN version (`BREP_app`'s `Cargo.toml` version,
//! `CARGO_PKG_VERSION` there) against [`MIN_CLIENT_VERSION`]: an app older
//! than it is refused. The server does not see the client's version, so the
//! refusal is the client's; [`serves`] is the comparison, written once here
//! so a test on either side can pin the same rule.
//!
//! # Bumping [`MIN_CLIENT_VERSION`]
//!
//! Only when this server stops honouring a contract an older app relies on —
//! a route removed or reshaped, a field renamed, a refusal that changes
//! meaning (the contracts are plm-cad-integration-todo §4). Adding a route or
//! a field never bumps it. Set it to the first `BREP_app` version that speaks
//! the new contract, in the same commit as the change that breaks the old
//! one, and say so in that commit's validation record.
/// This server's version: `BREP_plm`'s own `Cargo.toml` version.
pub const SERVER_VERSION: &str = env!;
/// The oldest CAD app (`BREP_app` version) this server serves. `0.4.0` is the
/// app's version when the handshake was built, before any app spoke to a PLM.
pub const MIN_CLIENT_VERSION: &str = "0.4.0";
/// What this server can do beyond the contracts every served client may
/// assume, by name. It rides `/api/me` and `GET /cad/config` as `features`.
///
/// A client reads it to tell an old server from a new one where the
/// difference is otherwise invisible: a server without `attribute-filters`
/// ignores `attr.*` query parameters and answers UNFILTERED, which looks
/// exactly like a filter every part matched.
///
/// Add a name in the commit that adds the capability. A name is never
/// removed or renamed without bumping [`MIN_CLIENT_VERSION`] (an older app may
/// rely on it). The names are listed in plm-cad-integration-todo §4.
pub const FEATURES: & = &;
/// `MAJOR.MINOR.PATCH` as numbers. A pre-release or build suffix
/// (`-rc.1`, `+abc`) is ignored — the handshake compares releases.
/// Whether a client at `client_version` is served by a server whose oldest
/// served client is `min_client_version`. A version that does not parse is
/// not served: the app would otherwise connect on a guess.
/// Check a `--min-client-version` floor: a version, and not below
/// [`MIN_CLIENT_VERSION`] — lowering it would claim to serve apps that speak
/// a contract this server no longer honours.