Repository navigation
deps: upgrade all soulteary kits to their latest majors - #118
Merged
Merged
Conversation
These three move together because httpcache-kit's API takes logger-kit and metrics-kit types directly, and the module path is part of a type's identity: SetLogger/HandlerOptions.Logger want a *logger.Logger and the cache metrics constructor a *metrics.Registry, so a v2 value cannot satisfy a v3/v4 parameter. Splitting the bump across commits would not compile. - github.com/soulteary/httpcache-kit/v2 v2.5.0 -> /v4 v4.0.0 - github.com/soulteary/logger-kit/v2 v2.3.0 -> /v3 v3.0.0 - github.com/soulteary/metrics-kit/v2 v2.2.0 -> /v3 v3.0.0 Code migrations beyond the import paths: - httpcache v4 moved the Prometheus recorder into the prometheusmetrics subpackage so the root package stops linking client_golang, so httpcache.NewCacheMetrics(reg) becomes prometheusmetrics.New(reg). New still installs itself as httpcache's default recorder, so the return value stays discarded and the apt_proxy_cache_* series are unchanged. - httpcache.GetDefaultMetrics() now returns the Metrics interface and never nil (unset is NopMetrics), so the nil guard in the cache stats API would have been a nil-interface panic waiting to happen. Call UpdateCacheStats(stats) unconditionally. - logger-kit v3 dropped the fiber.Ctx-typed hooks from the root MiddlewareConfig, which is what kept Fiber out of the root package. MiddlewareConfig.CustomFieldsFiber becomes CustomFields on fiberadapter.Config, which embeds the root config; the closure itself is unchanged, so the access log keeps its cache and size fields. Logger, SkipPaths and the Debug-only IncludeHeaders/IncludeBody still come from logger.DefaultMiddlewareConfig(). - metrics-kit v3 keeps NewRegistry and HandlerFor in the root package, so /metrics only needed the import path. go build ./..., go vet ./... (also with -tags=integration) and go test ./... all pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5
- github.com/soulteary/health-kit/v2 v2.3.0 -> /v4 v4.0.0
- github.com/soulteary/middleware-kit/v2 v2.2.0 -> /v3 v3.0.0
- github.com/soulteary/version-kit/v2 v2.2.0 -> /v4 v4.0.0
All three moved their Fiber support into a fiberadapter subpackage so their
root packages stop linking Fiber and fasthttp. The configuration types stayed
in the root packages, so only the handler and middleware constructors move:
- health.FiberLivenessHandler("apt-proxy") -> healthfiber.LivenessHandler.
/healthz and /readyz keep the local fiberHealthHandler; the race with
fasthttp's graceful shutdown that it exists to avoid is unchanged, so the
kit's own aggregator handlers are still not what we want. The comments
naming them are updated to the new symbol names.
- middleware.SecurityHeaders -> mwfiber.SecurityHeaders, with
middleware.DefaultSecurityHeadersConfig() still coming from the root
package. The response headers are the same four.
- version.FiberMiddleware -> versionfiber.Middleware and version.FiberHandler
-> versionfiber.Handler, both still reading version.HandlerConfig /
version.Info from the root package.
The -X ldflags in the Makefile inject main.version / main.commit / main.date,
not version-kit package variables, so the silent-"dev" trap in version-kit's
upgrade notes does not apply here.
Two documented behaviour changes on /version, both from version-kit's Fiber
adapter and both confirmed against a pre-upgrade build:
- Pretty now works. fiber.Ctx.JSON always wrote compact JSON, so the
Pretty: true this endpoint has always been configured with was silently
ignored; the body is now indented ({"version":"dev"} -> 22 bytes over 3
lines).
- Content-Type is application/json instead of application/json; charset=utf-8,
matching the net/http handler (RFC 8259 defines no charset parameter).
The X- version headers, /livez, /healthz, /readyz and the security headers
are byte-identical to the pre-upgrade build.
health-kit v4 also moved its Redis probe to a redisprobe subpackage; apt-proxy
does not use it.
go build ./..., go vet ./... (also with -tags=integration) and go test ./...
all pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5
- github.com/soulteary/tracing-kit v1.5.0 -> /v2 v2.0.0 - github.com/soulteary/http-kit v1.5.0 -> /v2 v2.0.0 Both moved what pulled a heavy dependency into every consumer out of the root package. tracing-kit v2 moved the OTLP exporter into the otlp subpackage, so tracing.InitTracer becomes otlp.InitTracer. The arguments and the return values are the same, and initTracing keeps treating a failure as non-fatal. Everything the proxy uses from the root package — StartSpan, RecordError, SetSpanStatus, SetSpanAttributes, SetSpanAttributesFromMap and Shutdown — kept its name and signature, so handler.go, passthrough.go and transport.go only needed the import path. http-kit v2 removed Client.InjectTraceContext, which is what made every user of the package link OpenTelemetry. The proxy never called it — it uses only RetryOptions and DefaultRetryOptions, both unchanged — so transport.go and transport_test.go only needed the import path too. With this the old module paths are gone from the tree: neither soulteary/(httpcache|logger|metrics|health|middleware|version)-kit/v2 nor a soulteary/(tracing|http)-kit without /v2 matches any tracked file. go build ./..., go vet ./... (also with -tags=integration) and go test ./... all pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Every kit this project depends on cut a new major that moves framework- and
exporter-specific code out of its root package, so the root packages stop
linking Fiber, fasthttp, Prometheus/protobuf and the OTLP exporter into
consumers that do not ask for them. Go encodes the major in the import path, so
none of this arrives via
go get -u— each one is a path change plus, where themoved symbols are ones we call, a constructor rename.
Version changes
httpcache-kit/v2v2.5.0/v4v4.0.0logger-kit/v2v2.3.0/v3v3.0.0metrics-kit/v2v2.2.0/v3v3.0.0health-kit/v2v2.3.0/v4v4.0.0middleware-kit/v2v2.2.0/v3v3.0.0version-kit/v2v2.2.0/v4v4.0.0tracing-kit/v2v2.0.0http-kit/v2v2.0.0cli-kitv1.9.0 andvfs-kitv1.4.2 were already current and are untouched. Noreplacedirectives, and no compatibility shims for the removed APIs.go mod tidyalso carried three transitive bumps the new kits require —molecule-man/go-brrrv1.1.1,dustin/go-humanizev1.1.0 andgo.uber.org/atomicv1.12.0.The first commit bumps
httpcache-kit,logger-kitandmetrics-kittogetheron purpose:
httpcache-kit's API takes the other two's types directly(
SetLogger,HandlerOptions.Logger, the metrics constructor), and a modulepath is part of a type's identity, so a v2 value cannot satisfy a v3/v4
parameter. Split across commits it would not compile.
Code migrations
httpcache.NewCacheMetrics→prometheusmetrics.Newv4 moved the Prometheus recorder into a
prometheusmetricssubpackage so theroot package no longer links
client_golang.Newstill installs itself ashttpcache's default recorder, so the return value stays discarded exactly as
before:
The constructors were moved verbatim upstream, so the
apt_proxy_cache_*metricnames, labels and buckets are unchanged.
MiddlewareConfig.CustomFieldsFiber→loggerfiber.Config.CustomFieldslogger-kit v3 removed the
fiber.Ctx-typed hooks from the rootMiddlewareConfig— those fields are what pulled Fiber into the root package inthe first place. They now live on
fiberadapter.Config, which embeds the rootconfig, so
logCfgis passed through untouched and the closure body isunchanged:
Logger,SkipPathsand the Debug-onlyIncludeHeaders/IncludeBodystillcome from
logger.DefaultMiddlewareConfig(), so the access log keeps itscacheandsizefields.GetDefaultMetrics()nil check droppedIt used to return a
*CacheMetricsthat was nil until metrics were registered,which nil-receiver methods made safe. In v4 it returns the
Metricsinterfaceand never nil — "unset" is a real
NopMetricsobject — so the old guard wouldnow be a nil-interface panic waiting to happen:
The rest
tracing.InitTracer(...)otlp.InitTracer(...)(same args, same returns)version.FiberMiddleware(info, "X-")versionfiber.Middleware(info, "X-")version.FiberHandler(cfg)versionfiber.Handler(cfg)(HandlerConfigstill root)middleware.SecurityHeaders(cfg)mwfiber.SecurityHeaders(cfg)(DefaultSecurityHeadersConfigstill root)health.FiberLivenessHandler(name)healthfiber.LivenessHandler(name)/healthzand/readyzkeep the localfiberHealthHandler. The race withfasthttp's graceful shutdown it exists to avoid is unchanged, so the kit's
aggregator handlers are still not what we want; the comments naming them were
updated to the new symbol names.
metrics.HandlerForandmetrics.NewRegistrystayed in metrics-kit's rootpackage, so
/metricsneeded only the import path. http-kit v2 removedClient.InjectTraceContext, which this project never called — it uses onlyRetryOptionsandDefaultRetryOptions, both unchanged.Everything else is import paths only: 8 files for httpcache-kit, 23 for
logger-kit, 2 for health-kit, 3 for tracing-kit, 2 for http-kit.
The
-Xldflags in the Makefile injectmain.version/main.commit/main.date, not version-kit package variables, so the silent-devtrap inversion-kit's upgrade notes does not apply. Verified against a
make buildbinary below.
/versionresponse changedTwo documented behaviour changes in version-kit's Fiber adapter, both confirmed
against a pre-upgrade build, and neither avoidable without a shim:
Prettynow works.fiber.Ctx.JSONalways wrote compact JSON, so thePretty: truethis endpoint has always been configured with was silentlyignored. The config is kept as written rather than flipped to
falsetoreproduce the old body — set
Pretty: falseincreateFiberAppif thecompact form is wanted back.
Content-Typedrops; charset=utf-8, matching the net/http handler(RFC 8259 defines no charset parameter for
application/json). Notconfigurable either way.
The
X-version headers are unaffected.Verification
go build ./...,go vet ./...(also with-tags=integration),go test ./...,make test(-race -short) andmake test-integration(
-tags=integration -race) all pass.Both old-path checks come back empty on tracked files:
golangci-lintcould not be run here: the installed binary is built with Go1.25 and refuses a
go 1.27.0module. That is pre-existing and unrelated tothis change;
gofmt -lis clean andgo vetpasses.Runtime, against a
make buildbinary vs. a pre-upgrade buildFetched
/ubuntu/dists/noble/InReleasetwice through the proxy:cacheandsizefields correct on both.apt_proxy_cache_hits_total{method="GET"}and..._misses_total{method="GET"}each at 1; the full
apt_proxy_*series name + label set diffs clean againstthe pre-upgrade scrape.
/api/cache/statsbody byte-identical to pre-upgrade, and theapt_proxy_cache_item_count/_size_bytesgauges move from 0 to1/256230after that call — which is theUpdateCacheStatspath this PRchanged.
X-Versionplus the four security headers unchanged;/livez,/healthz,/readyzbyte-identical; version ldflags land (X-Version: 9fe1f10);graceful shutdown clean, no panics or races, and the log-message profile
matches the pre-upgrade run line for line.
🤖 Generated with Claude Code
https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5
Generated by Claude Code