feat(app_dsl_service): Refines version compatibility logic

Updates logic to handle various version comparisons, ensuring
more precise status returns based on version differences.
Improves handling of older and newer versions to prevent
mismatches and ensure appropriate compatibility status.

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN- 2025-04-25 18:27:31 +08:00
parent 024f242251
commit 7d18e2a0ef
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

View File

@ -55,13 +55,19 @@ def _check_version_compatibility(imported_version: str) -> ImportStatus:
except version.InvalidVersion: except version.InvalidVersion:
return ImportStatus.FAILED return ImportStatus.FAILED
# Compare major version and minor version # If imported version is newer than current, always return PENDING
if current_ver.major != imported_ver.major or current_ver.minor != imported_ver.minor: if imported_ver > current_ver:
return ImportStatus.PENDING return ImportStatus.PENDING
if current_ver.micro != imported_ver.micro: # If imported version is older than current's major, return PENDING
if imported_ver.major < current_ver.major:
return ImportStatus.PENDING
# If imported version is older than current's minor, return COMPLETED_WITH_WARNINGS
if imported_ver.minor < current_ver.minor:
return ImportStatus.COMPLETED_WITH_WARNINGS return ImportStatus.COMPLETED_WITH_WARNINGS
# If imported version equals or is older than current's micro, return COMPLETED
return ImportStatus.COMPLETED return ImportStatus.COMPLETED