fix(updater): don't drop up-to-date apps from updates.json

The per-app object build used `available_version:($available_version|select(.!=""))`
to omit the field when empty. But in jq, a `{key: (empty)}` makes the WHOLE
object construction emit nothing — so every app with no available update (empty
available_version) produced no object and was silently dropped from updates.json.
Only apps WITH a pending update survived; an all-up-to-date fleet showed an empty
list. (Missed in P2's sandbox test because both fixture apps had updates.)

Emit an explicit null instead: `(if $available_version=="" then null else … end)`.
Verified: an up-to-date app (trivy, local==registry digest) now emits with
available_version:null; apps with updates still carry the string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-07-17 23:42:32 +01:00
parent 68e8fcccb1
commit d44a052a3e

View File

@ -212,7 +212,7 @@ webuiUpdaterScan() {
'{name:$name,displayName:$displayName,type:$type,channel:$channel,
current_image:$current_image,current_version:$current_version,current_digest:$current_digest,
available_image:$available_image,
available_version:($available_version|select(.!="")),
available_version:(if $available_version=="" then null else $available_version end),
available_digest:$available_digest,update_available:$update_available,
scanned:true,last_checked:$last_checked,services:$services}' \
>> "$objs" 2>/dev/null