Skip to content

deps: upgrade all soulteary kits to their latest majors - #118

Merged
soulteary merged 3 commits into
mainfrom
claude/jolly-cray-5qdi4q
Sep 21, 2026
Merged

soulteary merged 3 commits into
mainfrom
claude/jolly-cray-5qdi4q

Conversation

@soulteary

Copy link
Copy Markdown
Owner

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 the
moved symbols are ones we call, a constructor rename.

Version changes

Module From To
httpcache-kit /v2 v2.5.0 /v4 v4.0.0
logger-kit /v2 v2.3.0 /v3 v3.0.0
metrics-kit /v2 v2.2.0 /v3 v3.0.0
health-kit /v2 v2.3.0 /v4 v4.0.0
middleware-kit /v2 v2.2.0 /v3 v3.0.0
version-kit /v2 v2.2.0 /v4 v4.0.0
tracing-kit v1.5.0 /v2 v2.0.0
http-kit v1.5.0 /v2 v2.0.0

cli-kit v1.9.0 and vfs-kit v1.4.2 were already current and are untouched. No
replace directives, and no compatibility shims for the removed APIs. go mod tidy also carried three transitive bumps the new kits require —
molecule-man/go-brrr v1.1.1, dustin/go-humanize v1.1.0 and
go.uber.org/atomic v1.12.0.

The first commit bumps httpcache-kit, logger-kit and metrics-kit together
on purpose: httpcache-kit's API takes the other two's types directly
(SetLogger, HandlerOptions.Logger, the metrics constructor), and a module
path 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.New

v4 moved the Prometheus recorder into a prometheusmetrics subpackage so the
root package no longer links client_golang. New still installs itself as
httpcache's default recorder, so the return value stays discarded exactly as
before:

-	httpcache.NewCacheMetrics(s.metricsRegistry)
+	prometheusmetrics.New(s.metricsRegistry)

The constructors were moved verbatim upstream, so the apt_proxy_cache_* metric
names, labels and buckets are unchanged.

MiddlewareConfig.CustomFieldsFiber → loggerfiber.Config.CustomFields

logger-kit v3 removed the fiber.Ctx-typed hooks from the root
MiddlewareConfig — those fields are what pulled Fiber into the root package in
the first place. They now live on fiberadapter.Config, which embeds the root
config, so logCfg is passed through untouched and the closure body is
unchanged:

-	logCfg.CustomFieldsFiber = func(c fiber.Ctx) map[string]interface{} {
-		...
-	}
-	app.Use(logger.FiberMiddleware(logCfg))
+	app.Use(loggerfiber.Middleware(loggerfiber.Config{
+		MiddlewareConfig: logCfg,
+		CustomFields: func(c fiber.Ctx) map[string]interface{} {
+			...
+		},
+	}))

Logger, SkipPaths and the Debug-only IncludeHeaders / IncludeBody still
come from logger.DefaultMiddlewareConfig(), so the access log keeps its
cache and size fields.

GetDefaultMetrics() nil check dropped

It used to return a *CacheMetrics that was nil until metrics were registered,
which nil-receiver methods made safe. In v4 it returns the Metrics interface
and never nil — "unset" is a real NopMetrics object — so the old guard would
now be a nil-interface panic waiting to happen:

-	if metrics := httpcache.GetDefaultMetrics(); metrics != nil {
-		metrics.UpdateCacheStats(stats)
-	}
+	httpcache.GetDefaultMetrics().UpdateCacheStats(stats)

The rest

Before After
tracing.InitTracer(...) otlp.InitTracer(...) (same args, same returns)
version.FiberMiddleware(info, "X-") versionfiber.Middleware(info, "X-")
version.FiberHandler(cfg) versionfiber.Handler(cfg) (HandlerConfig still root)
middleware.SecurityHeaders(cfg) mwfiber.SecurityHeaders(cfg) (DefaultSecurityHeadersConfig still root)
health.FiberLivenessHandler(name) healthfiber.LivenessHandler(name)

/healthz and /readyz keep the local fiberHealthHandler. The race with
fasthttp'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.HandlerFor and metrics.NewRegistry stayed in metrics-kit's root
package, so /metrics needed only the import path. http-kit v2 removed
Client.InjectTraceContext, which this project never called — it uses only
RetryOptions and DefaultRetryOptions, 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 -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. Verified against a make build
binary below.

⚠️ /version response changed

Two documented behaviour changes in version-kit's Fiber adapter, both confirmed
against a pre-upgrade build, and neither avoidable without a shim:

before: Content-Type: application/json; charset=utf-8   {"version":"dev"}          (17 B)
after:  Content-Type: application/json                  {\n  "version": "dev"\n}   (22 B)
  • 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 config is kept as written rather than flipped to false to
    reproduce the old body — set Pretty: false in createFiberApp if the
    compact form is wanted back.
  • Content-Type drops ; charset=utf-8, matching the net/http handler
    (RFC 8259 defines no charset parameter for application/json). Not
    configurable either way.

The X- version headers are unaffected.

Verification

go build ./..., go vet ./... (also with -tags=integration), go test ./..., make test (-race -short) and make test-integration
(-tags=integration -race) all pass.

Both old-path checks come back empty on tracked files:

grep -rnE 'soulteary/(httpcache|logger|metrics|health|middleware|version)-kit/v2' .
grep -rnP 'soulteary/(tracing|http)-kit(?!/v2)' --include='*.go' --include=go.mod .

golangci-lint could not be run here: the installed binary is built with Go
1.25 and refuses a go 1.27.0 module. That is pre-existing and unrelated to
this change; gofmt -l is clean and go vet passes.

Runtime, against a make build binary vs. a pre-upgrade build

Fetched /ubuntu/dists/noble/InRelease twice through the proxy:

fetch #1  X-Cache: MISS   {"path":"/ubuntu/dists/noble/InRelease","status":200,"cache":"MISS","size":255850}
fetch #2  X-Cache: HIT    {"path":"/ubuntu/dists/noble/InRelease","status":200,"cache":"HIT","size":255850}
  • Access log cache and size fields 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 against
    the pre-upgrade scrape.
  • /api/cache/stats body byte-identical to pre-upgrade, and the
    apt_proxy_cache_item_count / _size_bytes gauges move from 0 to
    1 / 256230 after that call — which is the UpdateCacheStats path this PR
    changed.
  • X-Version plus the four security headers unchanged; /livez, /healthz,
    /readyz byte-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

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
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@soulteary soulteary left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@soulteary
soulteary merged commit 6ad2f61 into main Sep 21, 2026
8 checks passed
@soulteary
soulteary deleted the claude/jolly-cray-5qdi4q branch September 21, 2026 15:47
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