fix(version): gate update banner on semver ordering, not string inequality (MAPPS-370) #430
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-370-update-banner-semver-compare"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes MAPPS-370.
The admin update banner prompted a backwards downgrade ("Client: 0.7.1 -> 0.7.0") in staging and self-host stacks.
VersionPair::update_available()(src/modules/system.rs) returned true wheneverlatest != running- a plain string inequality with no direction and no numeric ordering.get_version()sets the client'slatestto the server's running version, assuming mokosh-server and mokosh-www release in lockstep. The MAPPS-369 CSP hotfix broke that assumption: mokosh-www went to 0.7.1 while mokosh-server stayed 0.7.0, soclient.running= 0.7.1 andclient.latest= 0.7.0.0.7.0 != 0.7.1fired the banner and rendered the downgrade prompt. The string compare also mis-ordered multi-digit fields (0.7.10sorts below0.7.9).Fix
parse_semver()reduces a normalisedMAJOR.MINOR.PATCHstring to(u64, u64, u64); anything that is not exactly three integers returnsNone. No new crate dependency (plain X.Y.Z release strings do not need the fullsemvercrate in a WASM bundle).update_available()now returns true only when both sides parse andlatest > running. Unparseable input on either side fails closed (no banner) rather than risking a wrong prompt.client.latest = server versionmodel is unchanged: with a strict-greater compare a client ahead of the server stays quiet and clears once the server catches up, while a genuinely newer server still prompts.Verification
just pre-commitgreen (fmt + clippy + wasm check +cargo test --lib, 215 tests). New tests cover: the reported0.7.1 / 0.7.0 -> falsedowngrade case, a normal upgrade, multi-digit ordering (0.7.9vs0.7.10), equal,None, and malformed input; plus aparse_semvercase table.docs/versioning.mdsection "1. Cross-version update (the banner)" updated to describe the strict-greater semver compare and the server/client patch-divergence behavior.