feat(httpx): inject deco-operator User-Agent on outbound HTTP#22
Open
igoramf wants to merge 3 commits into
Open
feat(httpx): inject deco-operator User-Agent on outbound HTTP#22igoramf wants to merge 3 commits into
igoramf wants to merge 3 commits into
Conversation
Wraps the transport for the notifier, GitHub downloader, and DecoRedirect DNS probe with a shared RoundTripper so every request the operator makes identifies itself as deco-operator instead of Go's default User-Agent. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adopts the standard product/version (comment) format used by terraform, curl, and kubectl. The version slot is overridden at build time via -ldflags "-X .../httpx.version=v$VERSION" and forwarded through the Dockerfile via a VERSION build arg. Local builds fall back to "dev". Example: decofile-operator/v0.4.0-beta.3 (+https://github.com/decocms/operator) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Lets the release workflow forward github.ref_name (e.g. v0.4.0-beta.3) into the Dockerfile VERSION build arg, which ldflags into the binary. Removes the Makefile/local build-arg plumbing that diverged from the single CI path; local builds keep the "dev" default. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nicacioliveira
approved these changes
Jun 10, 2026
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
internal/httpx.WithUserAgent, ahttp.RoundTripperwrapper that injectsUser-Agent: deco-operatoron every outbound request while preserving any value the caller already set and honoring the no-mutation contract by cloning the request.NewHTTPClient), the GitHub ZIP downloader, and the DecoRedirect DNS readiness probe — so requests no longer ship Go's defaultGo-http-client/1.1UA.Test plan
go build ./...go vet ./...go test ./internal/httpx/...User-Agent: deco-operator🤖 Generated with Claude Code
Summary by cubic
Sets a consistent RFC 7231-style User-Agent on all outbound HTTP from the operator, with the version sourced from the git tag in CI, to improve downstream observability. Applied to the notifier, GitHub ZIP downloads, and the DNS readiness probe without mutating caller requests.
internal/httpx.WithUserAgenttransport that injectsdecofile-operator/<version> (+https://github.com/decocms/operator), preserves any caller-set header, and clones requests.NewHTTPClient), GitHub downloader, andDecoRedirectDNS probe. Version is set at build time via-ldflags -X github.com/deco-sites/decofile-operator/internal/httpx.version=${VERSION};DockerfileexposesARG VERSION(defaultdev) and CI passes the git tag asVERSIONin.github/workflows/build-and-push.yaml. Tests cover injection, preservation, and non-mutation.Written for commit c43080a. Summary will update on new commits.