Skip to content

fix(os-updates): honor active-box cookie via resolveBoxIDFromRequest - #113

Merged
sarg3nt merged 1 commit into
mainfrom
fix/issue-112-os-updates-active-box
May 17, 2026
Merged

fix(os-updates): honor active-box cookie via resolveBoxIDFromRequest#113
sarg3nt merged 1 commit into
mainfrom
fix/issue-112-os-updates-active-box

Conversation

@sarg3nt

@sarg3nt sarg3nt commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace 33 open-coded r.URL.Query().Get("server")getDefaultServerID() fallbacks in internal/framework/handler/os_updates.go with the existing resolveBoxIDFromRequest helper.
  • Symptom this fixes: switching boxes in the header pill left the OS Updates page (and every action that fires from it — install, snapshot, reboot, pipx/pip, etc.) stuck on whichever box getDefaultServerID() happened to return. The fix routes through the same cookie/URL/default precedence every other gear page uses.

Phase 1 slice of #112.

Test plan

  • go vet ./... clean
  • go test -count=1 ./internal/framework/handler/... ./internal/gears/... clean (no test changes; covers os_updates_error_test.go)
  • On a live deployment with two boxes: click the header pill onto a non-default box, navigate to /os-updates, confirm packages/snapshots/etc. reflect the selected box without needing ?server= on the URL.

🤖 Generated with Claude Code

…112)

OSUpdatesPage and the 32 /api/os-updates/* handlers each open-coded
the same `r.URL.Query().Get("server")` → `getDefaultServerID()`
fallback, ignoring the gearbox_active_box cookie that the header pill
writes. The visible symptom was that switching boxes in the header
left the OS Updates page (and every package action that fires from it)
stuck on the default box.

Replace all 33 sites with the existing resolveBoxIDFromRequest helper,
which checks ?server= first, then the cookie, then the first enabled
server. No behavior change when ?server= is explicit; cookies now win
when it isn't.

Phase 1 of #112.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 05:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes OS Updates box-selection behavior by routing OS Updates page + API handlers through the shared resolveBoxIDFromRequest helper, ensuring the active box stored in the gearbox_active_box cookie is honored (consistent with other gear pages).

Changes:

  • Replaced open-coded ?server=getDefaultServerID() fallback logic throughout os_updates.go with resolveBoxIDFromRequest(r).
  • Ensures OS Updates actions (install/snapshot/reboot/pipx/pip/etc.) operate on the header pill’s active box when ?server= is not explicitly provided.

@sarg3nt
sarg3nt merged commit 6b2d801 into main May 17, 2026
26 checks passed
@sarg3nt
sarg3nt deleted the fix/issue-112-os-updates-active-box branch May 28, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants