Harden workstation tier handling

This commit is contained in:
Jino Jose committed 2026-07-08 15:21:05 +05:30
1 parent 10b66569b6
commit 9a1d52230d
3 files changed
+33 -12

No files matched your search

+15 -5
View File
@@ -1950,9 +1950,15 @@ async def readiness_report(admin: dict = Depends(admin_only)):
entitlement = _entitlement_summary(feasibility)
readiness = _readiness_score(feasibility, license_payload)
recommended_tier = (feasibility.get("recommendation") or {}).get("recommended_tier", "starter")
current_rank = list(TIER_MATRIX.keys()).index(entitlement.get("licensed_tier") or license_payload["tier"])
recommended_rank = list(TIER_MATRIX.keys()).index(_normalize_tier(recommended_tier))
commercial_fit = "matched" if current_rank >= recommended_rank else "license_upgrade_recommended"
current_tier = entitlement.get("licensed_tier") or license_payload["tier"]
if license_payload.get("category") == CATEGORY_WORKSTATION or tier_category(current_tier) == CATEGORY_WORKSTATION:
commercial_fit = "workstation_category"
commercial_fit_note = "Workstation is a standalone product category, so Server S/M/L/Max upgrade guidance does not apply directly."
else:
current_rank = list(TIER_MATRIX.keys()).index(current_tier)
recommended_rank = list(TIER_MATRIX.keys()).index(_normalize_tier(recommended_tier))
commercial_fit = "matched" if current_rank >= recommended_rank else "license_upgrade_recommended"
commercial_fit_note = "Current license covers the recommended deployment." if commercial_fit == "matched" else "Quote a higher tier or reduce enabled features for this hardware."
return {
"schema": "cezen.readiness_report.v1",
"generated_at": utcnow(),
@@ -1963,10 +1969,10 @@ async def readiness_report(admin: dict = Depends(admin_only)):
"readiness": readiness,
"commercial_fit": {
"status": commercial_fit,
"current_tier": entitlement.get("licensed_tier") or license_payload["tier"],
"current_tier": current_tier,
"provisioned_tier": entitlement.get("provisioned_tier"),
"recommended_tier": _normalize_tier(recommended_tier),
"note": "Current license covers the recommended deployment." if commercial_fit == "matched" else "Quote a higher tier or reduce enabled features for this hardware.",
"note": commercial_fit_note,
},
"proposal_summary": [
f"Recommended Cezen profile: {(feasibility.get('recommendation') or {}).get('recommended_profile', 'core')}",
@@ -2070,6 +2076,10 @@ async def get_branding():
result["license_support_until"] = license_record.get("support_until", "")
result["license_status"] = entitlement.get("license_status", "missing")
result["provisioned_tier"] = entitlement.get("provisioned_tier", "")
tier = result.get("tier_slug")
if tier in TIER_MATRIX:
result["tier_commercial_label"] = TIER_MATRIX[tier].get("commercial_label", TIER_MATRIX[tier]["label"])
result["tier_category"] = TIER_MATRIX[tier].get("category", CATEGORY_SERVER)
return result
@app.put("/api/settings/branding")