fix(core): handle unsupported server error (#15164)

fix #15160
fix #15161
fix #15158
fix #15166


#### PR Dependency Tree


* **PR #15164** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a “server version too old” message for self-hosted servers,
including the required upgrade version.
* Sign-in and OAuth-related preflight steps now verify server
compatibility before proceeding.
* **Bug Fixes**
* Improved error handling for missing/invalid server version responses
and schema/type mismatches, mapping them to the upgrade instruction.
* **Tests**
* Added coverage for server version guarding and the resulting
user-friendly error payload.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-06-29 00:03:02 +08:00
committed by GitHub
parent 0a422aa158
commit 1b9e21f2de
13 changed files with 140 additions and 7 deletions
@@ -907,6 +907,14 @@ export const USER_FRIENDLY_ERRORS = {
message: ({ clientVersion, requiredVersion }) =>
`Unsupported client with version [${clientVersion}], required version is [${requiredVersion}].`,
},
unsupported_server_version: {
type: 'action_forbidden',
args: {
requiredVersion: 'string',
},
message: ({ requiredVersion }) =>
`This AFFiNE server is too old for this client. Please upgrade the server to ${requiredVersion}.`,
},
// Notification Errors
notification_not_found: {