fix(version): sanitise error bodies, warn on bad versions, test network path #194
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-238-self-hosted-version-check"
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?
Addresses the remaining review nits on the update-check endpoint.
The error response body no longer interpolates the raw reqwest/serde error. A reqwest error can embed the request URL (and thus any credentials in MOKOSH_UPDATE_CHECK_URL), which would undo the pre-sanitised display URL the body is supposed to use. The raw detail now goes to tracing::warn! only; the body references just the sanitised display URL plus a category (request failed / status N / invalid manifest).
parse_version now warns when a version component fails to parse instead of silently degrading it to 0, so a misconfigured publishing side (typo, calendar versioning) is visible rather than quietly never advertising an update. is_newer documents that pre-release/build metadata is stripped, so a pre-release build compares equal to its final release.
fetch_update_check takes (client, url, display) instead of the global probe, so the network path is unit-testable without a mock-server dependency. Four new tests drive it through a one-shot loopback HTTP server: update-available with release_url, up-to-date for an older manifest, error on non-2xx status, and a regression test asserting the error body never contains the raw upstream URL.
#PMS-238
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com