Skip to content

Commit bacfa8e

Browse files
sarg3ntclaude
andcommitted
fix(updates): always serialize is_held so client filter sees explicit false
Per Copilot review on PR #67: the dashboard's `_applyPkgViewFilter('updates')` applies a Tabulator filter of `is_held = false`, which uses strict equality. With `json:"is_held,omitempty"` the agent dropped the field when false, so rows from `/api/os-updates/packages/installed` arrived with `is_held === undefined` and got filtered out of the Updates view — making it incomplete after a full package-list load while `Update All (N)` kept counting them. Drop omitempty on both Package.IsHeld and InstalledPackage.IsHeld (agent + dashboard mirror) so the boolean is always on the wire. Adds ~14 bytes/package for a typical "All Packages" load (~10 KB on a 600-package list) — negligible vs the correctness fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 13ec351 commit bacfa8e

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

gearbox-agent/internal/gears/updates/updates.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ type Package struct {
3838
AvailableVersion string `json:"available_version"`
3939
Architecture string `json:"architecture"`
4040
IsSecurityUpdate bool `json:"is_security_update"`
41-
IsHeld bool `json:"is_held,omitempty"` // Package is held (pinned via apt-mark/dpkg) — apt will not upgrade it even though a newer version is available
41+
// Always serialize is_held — the dashboard filters on `is_held === false`,
42+
// so `omitempty` (dropping the field for false values) would cause those
43+
// rows to be filtered out by strict-equality checks on the client.
44+
IsHeld bool `json:"is_held"` // Package is held (pinned via apt-mark/dpkg) — apt will not upgrade it even though a newer version is available
4245
Priority string `json:"priority"` // low, medium, high, critical
4346
Repository string `json:"repository"`
4447
Size int64 `json:"size_bytes"` // Download size in bytes
@@ -58,7 +61,7 @@ type InstalledPackage struct {
5861
UpdateAvailable bool `json:"update_available,omitempty"`
5962
AvailableVersion string `json:"available_version,omitempty"`
6063
IsSecurityUpdate bool `json:"is_security_update,omitempty"`
61-
IsHeld bool `json:"is_held,omitempty"` // Package is held (pinned) by dpkg/apt-mark
64+
IsHeld bool `json:"is_held"` // Package is held (pinned) by dpkg/apt-mark — always serialized (see note on Package above)
6265
PackageURL string `json:"package_url,omitempty"` // Link to package info page
6366
}
6467

gearbox/internal/framework/agent/models.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ type Package struct {
666666
AvailableVersion string `json:"available_version"`
667667
Architecture string `json:"architecture"`
668668
IsSecurityUpdate bool `json:"is_security_update"`
669-
IsHeld bool `json:"is_held,omitempty"` // Held packages (apt-mark/dpkg pinned) won't be upgraded even when a newer version is available.
669+
IsHeld bool `json:"is_held"` // Held packages (apt-mark/dpkg pinned) won't be upgraded even when a newer version is available. Always serialized so the dashboard's strict-equality filter (`is_held === false`) sees the explicit value.
670670
Priority string `json:"priority"`
671671
Repository string `json:"repository"`
672672
Size int64 `json:"size_bytes"`
@@ -832,7 +832,7 @@ type InstalledPackage struct {
832832
UpdateAvailable bool `json:"update_available,omitempty"`
833833
AvailableVersion string `json:"available_version,omitempty"`
834834
IsSecurityUpdate bool `json:"is_security_update,omitempty"`
835-
IsHeld bool `json:"is_held,omitempty"`
835+
IsHeld bool `json:"is_held"` // Always serialized — see note on Package.IsHeld above.
836836
PackageURL string `json:"package_url,omitempty"`
837837
}
838838

0 commit comments

Comments
 (0)