Skip to content

fix: honor -v verbosity for HTTP logging in all commands#207

Open
scotwells wants to merge 3 commits into
mainfrom
fix/verbose-http-logging
Open

fix: honor -v verbosity for HTTP logging in all commands#207
scotwells wants to merge 3 commits into
mainfrom
fix/verbose-http-logging

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

Summary

datumctl accepts the standard -v verbosity flag, and users reasonably expect -v 6 to dump HTTP traffic so they can debug connectivity, auth, and proxy issues. Today that only works for the kubectl-backed commands (get, apply, etc.) because client-go wraps their transport with its debug round tripper. Commands that talk to other services over bare net/http — for example plugin search, which fetches the plugin index — print nothing at any verbosity, which is confusing when you're trying to figure out why a request is slow or failing.

This wraps the default HTTP transport once during root command setup, so -v now dumps requests consistently across every command, not just the Kubernetes-facing ones.

Verbosity levels match the behavior users already know from the kubectl-backed commands:

  • -v 6 — request URL and timing
  • -v 7 — adds request headers
  • -v 8/-v 9 — adds response headers, bodies, and curl-equivalent output

The wrapper is a no-op below -v 6, so normal runs are unaffected and pay no cost.

Test plan

  • datumctl plugin search (no flag) — output unchanged, no debug noise
  • datumctl plugin search -v 6 — logs the index GET URL + timing
  • datumctl plugin search -v 7 — additionally logs request headers
  • go build ./..., go vet, and go test ./internal/... pass

scotwells and others added 3 commits June 4, 2026 10:58
The -v flag dumped HTTP requests only for kubectl-backed commands,
because client-go wraps their transport with its debug round tripper.
Commands that use bare net/http (e.g. plugin search fetching the index)
showed nothing at any verbosity.

Wrap the default transport once in the root PersistentPreRunE so -v 6+
dumps requests for every command. DebugWrappers is a no-op below -v 6.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A GitHub token in the environment (GITHUB_TOKEN or DATUMCTL_GITHUB_TOKEN)
is attached to the plugin index request, but the public index host rejects
unexpected Bearer tokens with a 404, producing a confusing "HTTP 404"
error with no indication of the cause.

Return a typed IndexFetchError that records the status and which env var
the token came from, and surface a hint on 401/403/404 telling the user a
token is being sent and to unset it. Wired into search, install, and
upgrade.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant