fix: use semver comparison for extension version upgrades

Previously the system used simple string inequality to detect available
updates, causing downgrades to appear as upgrades (e.g. 2.5.1 → 2.5.0).
Now both backend (SQL) and frontend (JS) compare version tuples properly.
Also fixes latest_version in DB on registry sync startup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 15:05:15 +00:00
parent 3cee3abfeb
commit d0b87b16dc
2 changed files with 14 additions and 3 deletions
+2 -1
View File
@@ -456,7 +456,8 @@ function CustomerDetail({ customerId, onDelete }) {
<tbody className="divide-y divide-slate-50">
{sorted.map(e => {
const installed = e.installed_version
const hasUpdate = installed && e.latest_version && installed !== e.latest_version
const semverGt = (a, b) => { const pa = a.split('.').map(Number), pb = b.split('.').map(Number); for (let i = 0; i < Math.max(pa.length, pb.length); i++) { if ((pa[i]||0) > (pb[i]||0)) return true; if ((pa[i]||0) < (pb[i]||0)) return false; } return false }
const hasUpdate = installed && e.latest_version && semverGt(e.latest_version, installed)
const missingDeps = (deps[e.name] || []).filter(d => !installedNames.has(d))
const blocked = !installed && missingDeps.length > 0
return (