fix(os-updates): honor active-box cookie via resolveBoxIDFromRequest - #113
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
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 throughoutos_updates.gowithresolveBoxIDFromRequest(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.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
r.URL.Query().Get("server")→getDefaultServerID()fallbacks ininternal/framework/handler/os_updates.gowith the existingresolveBoxIDFromRequesthelper.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 ./...cleango test -count=1 ./internal/framework/handler/... ./internal/gears/...clean (no test changes; coversos_updates_error_test.go)/os-updates, confirm packages/snapshots/etc. reflect the selected box without needing?server=on the URL.🤖 Generated with Claude Code