Uh oh!
There was an error while loading. Please reload this page.
chore: trim duplication and dead code ahead of v0.9.0 - #375
Merged
Conversation
Collapses several near-identical blocks into small shared helpers and drops code that has no callers. Behaviour is unchanged; tests and go vet stay green. - cmd/obol/main.go: fold the kubectl/helm/helmfile/k9s passthroughs into a single passthroughCommand helper (~120 LOC removed). - internal/serviceoffercontroller: drop trivial statusFor/containsFinalizer/ newBigInt/hasStringInSlice helpers in favour of stdlib (slices.Contains, slices.DeleteFunc, big.Int.SetString); collapse mergeBuyerConfig/ mergeBuyerAuths/removeBuyerUpstream onto one mergeBuyerCM helper; delete the unused buildMiddleware/ownerRef/ownerRefFor render helpers. - internal/x402/buyer/proxy.go: lift the duplicated core-route wiring into registerCoreRoutes and simplify normalizeRemoteModel's prefix stripping. - internal/stack/stack.go: loop over the three legacy config-file paths instead of repeating os.Stat three times. - internal/testutil/eip712_signer.go: drop the unused chainName helper. Net -233 LOC, with go build ./... and go test ./... clean.
OisinKyne
approved these changes
Apr 24, 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 freeto 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
Architecture pass targeted at production readiness for v0.9.0. Collapses near-identical blocks into small shared helpers, leans on the stdlib where we were re-implementing it, and drops code that has no callers. Behaviour is unchanged — no user-visible flag, API, RBAC, or controller semantic is touched.
Net: -233 LOC across 9 files (107 insertions / 340 deletions).
go build ./...,go test ./..., andgo vet ./...all stay clean.What changed
cmd/obol/main.go— the fourkubectl/helm/helmfile/k9spassthrough subcommands were copy-paste of each other. Folded into a singlepassthroughCommand(cfg, tool, extraEnv)helper;helmfilestill gets its extraHELMFILE_FILE_PATHenv var. ~120 LOC removed.internal/serviceoffercontroller—statusForpointer pass-through,containsFinalizer/hasStringInSlice(use stdlibslices.Contains), andnewBigInt(usebig.Int.SetStringdirectly).removeFinalizernow usesslices.DeleteFuncinstead of an in-place filter loop.mergeBuyerConfig/mergeBuyerAuths/removeBuyerUpstreamonto a singlemergeBuyerCMhelper + a 2-entry loop for the teardown path. Also swapsjson.MarshalIndent(unused whitespace in a ConfigMap value) forjson.Marshal.buildMiddleware,ownerRef, andownerRefForrender helpers (flagged bystaticcheck -unused).internal/x402/buyer/proxy.go— the core-route wiring (/healthz,/status,/admin/*,/metrics, OpenAI-compat) was registered identically in bothNewProxyandsyncCompatibilityRoutesLocked. ExtractedregisterCoreRoutesso there's one source of truth. Also simplifiednormalizeRemoteModel— the for-loop + switch now reduces to a fixed-pointstrings.TrimPrefixpair.internal/stack/stack.go— three sequentialos.Stats for.stack-id/.stack-backend/k3d.yamlbecame a single loop over the filenames.internal/testutil/eip712_signer.go— removed deadchainNamehelper.Why these and not others
I deliberately kept the surface area small. Several additional ideas (port-forward helper in
openclaw.govssell.go, LiteLLM config patching vs remove path ininternal/model/model.go, registration helper extraction incmd/obol/sell.go) have structural similarities but non-trivial semantic differences (exit-code handling, error flow, TLS init order). Rolling those in would require behavior review I'd rather split into separate PRs so each diff stays reviewable.Test plan
go build ./...go vet ./...(clean)go test ./...— all packages pass, includinginternal/serviceoffercontroller(purchase lifecycle tests updated to useslices.Contains) andinternal/x402/buyer(proxy core-route registration andnormalizeRemoteModelunchanged externally)go test -tags integration -v -timeout 15m ./internal/openclaw/against a live cluster (reviewer to run on Mac host; CI covers unit path)obol kubectl get nodes,obol helm list -A,obol stack up→ verifysell http/buy.py buyhappy path (touches themergeBuyerCMpath)https://claude.ai/code/session_019YQ7b8bunKhCbEFUKcfSd3
Generated by Claude Code