Skip to content

feat: thread context through Client request methods - #374

Merged
zeroshade merged 2 commits into
mainfrom
feat/client-context
May 5, 2026
Merged

feat: thread context through Client request methods#374
zeroshade merged 2 commits into
mainfrom
feat/client-context

Conversation

@zeroshade

Copy link
Copy Markdown
Member

Summary

  • Accept context.Context on dbc.Client methods that issue HTTP requests (Search, Download, Install) and the internal helpers (makeRequest, getDriverListFromIndex, downloadPackage).
  • makeRequest now threads the passed context into http.NewRequestWithContext rather than using context.Background().
  • Uninstall is unchanged — it makes no network calls.
  • Existing callers (drivers.GetDriverList, cmd/dbc/main.getDriverRegistry, tests) pass context.Background() / t.Context().

Test plan

  • go build ./...
  • go vet ./...
  • go test ./...

Accept a context.Context on dbc.Client methods that issue HTTP requests
(Search, Download, Install) and the internal helpers (makeRequest,
getDriverListFromIndex, downloadPackage), so callers can cancel in-flight
requests and propagate deadlines/tracing. Uninstall is unchanged as it
makes no network calls.
Accept a context.Context on Credential.Refresh, Credential.GetAuthToken,
auth.FetchColumnarLicense, auth.GetOpenIDConfig, refreshOauth, and the
internal fetch helper so requests for license fetch and token refresh
honor the caller's cancellation alongside makeRequest. Legacy makereq in
drivers.go and cmd/dbc/auth.go TUI callers still pass context.Background
/ context.TODO since they have no caller-provided context yet.
@zeroshade
zeroshade merged commit 95f71db into main May 5, 2026
11 checks passed
@zeroshade
zeroshade deleted the feat/client-context branch May 5, 2026 15:54
zeroshade added a commit that referenced this pull request May 20, 2026
…erge

The merge of main brought in PR #374 which threaded context.Context through
Client request methods. Two call sites added by this branch were missed by
the merge:

- cmd/dbc/driver_list.go:155 in GetDriverList — now passes
  context.Background() (matches the pattern used by drivers.GetDriverList
  and cmd/dbc/main.getDriverRegistry).
- cmd/dbc/registry_wiring_test.go test stubs that mimic the production
  getDriverRegistry closure — match the production context.Background()
  call so the stubs faithfully reproduce the closure they replace.

Build & Integrate (ubuntu/macos/windows), snapshot, and the per-platform
build matrix were all failing on the same compile error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants