Repository navigation
chore(operator): replace go.uber.org/zap with stdlib log/slog - #423
Merged
Merged
Conversation
lusoris
marked this pull request as ready for review
May 31, 2026 03:10
lusoris
enabled auto-merge (squash)
May 31, 2026 03:10
The vmafx-operator was the last of 25 Go binaries on the fork still using the kubebuilder-template-default zap logger. All other binaries (vmafx-server, vmafx-controller, vmafx-tune, MCP server, …) already log via the standard library's log/slog package. This change retires the holdout so the fork has a single, uniform logging stack across its entire Go surface. main.go now installs a slog.NewJSONHandler against os.Stderr and bridges it into controller-runtime via logr.FromSlogHandler. The envtest suite_test.go uses slog.NewTextHandler against GinkgoWriter for the same reason. go.uber.org/zap is removed from direct dependencies (it remains present as an indirect transitive dep of sigs.k8s.io/controller-runtime internals; that is upstream's choice and unaffected). go-logr/zapr and go.uber.org/multierr are dropped from go.mod entirely. github.com/go-logr/logr is promoted to a direct dependency. ADR-0108 deliverables: - Research digest: no digest needed — mechanical 1-importer refactor. - Decision matrix: no alternatives — only-one-way fix (replace with the slog handler all other binaries already use). - AGENTS.md invariant: cmd/vmafx-operator/AGENTS.md gains rule #6 documenting the slog bridge for future kubebuilder re-syncs. - Reproducer: KUBEBUILDER_ASSETS=\$(setup-envtest use 1.31 -p path) \\ go test ./cmd/vmafx-operator/... - CHANGELOG fragment: changelog.d/changed/zap-to-slog-uniform.md. - Rebase note: docs/rebase-notes.md head entry covers re-applying the slog bridge after a kubebuilder template re-scaffold. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
lusoris
force-pushed
the
chore/zap-to-slog-uniform
branch
from
May 31, 2026 03:11
7f52ae5 to
45bbbe6
Compare
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
Replaces
go.uber.org/zapwith the standard-librarylog/slogpackage incmd/vmafx-operator/— the last of 25 Go binaries on the fork still usingthe kubebuilder-template-default zap logger. All other vmafx Go binaries
(
vmafx-server,vmafx-controller,vmafx-tune, MCP server, …) alreadylog via
slog. The operator now bridgesslog.NewJSONHandlerintocontroller-runtime via
logr.FromSlogHandler, giving the fork a singleuniform logging stack across its entire Go surface.
Audit modernization item #3 (zap holdout retirement).
Type
chore/refactor— no behaviour change, dependency cleanup.Dependencies removed (direct)
go.uber.org/zap→ now indirect only (pulled in by controller-runtime internals; upstream's choice, unaffected).github.com/go-logr/zapr→ dropped fromgo.modentirely.go.uber.org/multierr→ dropped fromgo.modentirely.Promoted to direct dep:
github.com/go-logr/logr(was indirect; now used by thelogr.FromSlogHandlerbridge).Bug-status hygiene (ADR-0165)
fixed/opened/ruled-out and no user-visible behaviour change.
Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score in the Netflix golden Python tests.Deep-dive deliverables (ADR-0108)
AGENTS.mdinvariant note — added rule chore(deps): Update dependency anthropic to >=0.104.1 #6 tocmd/vmafx-operator/AGENTS.mddocumenting the slog bridge so a future kubebuilder template re-scaffold doesn't silently reintroduce zap.changelog.d/changed/zap-to-slog-uniform.md.docs/rebase-notes.md("vmafx-operator zap → slog uniformity"). Netflix/vmaf has no operator so cross-repo impact is zero; the note covers the kubebuilder-template re-scaffold path instead.Reproducer
Local run on master tip + this branch:
go build ./...clean,go vetclean,golangci-lint run ./cmd/vmafx-operator/...reports0 issues.,go test ./cmd/vmafx-operator/...passes(
ok 5.306s, 3 specs in the envtest suite).Known follow-ups
None.
zapremains an indirect transitive dependency ofsigs.k8s.io/controller-runtime; eliminating it entirely would requireforking controller-runtime, which is out of scope.