Skip to content

refactor: lift resolveEffectiveConfig out of root main.go into configresolve/#511

Open
fuziontech wants to merge 2 commits intomainfrom
feat/lift-config-resolution
Open

refactor: lift resolveEffectiveConfig out of root main.go into configresolve/#511
fuziontech wants to merge 2 commits intomainfrom
feat/lift-config-resolution

Conversation

@fuziontech
Copy link
Copy Markdown
Member

Summary

Lifts the ~940-line precedence-aware config merger (CLI > env > YAML > defaults) and its CLIInputs / Resolved types out of the all-in-one duckgres binary's package into a new configresolve/ package. This is the last piece needed before cmd/duckgres-controlplane and cmd/duckgres-worker can move past their config-load stub and actually boot — they can now import and call configresolve.ResolveEffective(...) directly instead of having to duplicate the resolution logic.

Why a new package and not configloader/? configloader is intentionally light (YAML schema + LoadFile only, no deps on server/controlplane). configresolve is heavy by design (pulls in server, controlplane, server/ducklake) because it produces fully-wired runtime configs. Mixing the two would force everything that just wants the YAML schema to pull in the heavy graph.

Changes

Mechanical rename + move; no logic touched:

  • config_resolution.goconfigresolve/resolve.go (95% rename similarity)
  • config_resolution_k8s_test.goconfigresolve/resolve_k8s_test.go (56%, package + symbol rename)
  • main.go updated: imports configresolve, calls configresolve.ResolveEffective(...) with configresolve.CLIInputs{...}

Symbol renames:

  • configCLIInputsconfigresolve.CLIInputs
  • resolvedConfigconfigresolve.Resolved
  • defaultServerConfigconfigresolve.DefaultServerConfig
  • resolveEffectiveConfigconfigresolve.ResolveEffective
  • splitAndTrim, intPtr, boolPtr stay package-private

Function signature switched to take *configloader.FileConfig directly (was *FileConfig relying on a main-package type alias).

Test plan

  • go build ./... clean
  • go build -tags kubernetes ./... clean
  • go test ./configresolve/... passes
  • go test -tags kubernetes ./configresolve/... passes
  • go list -deps ./cmd/duckgres-controlplane confirms libduckdb still NOT in the import graph (default and -tags kubernetes)

Follow-up

Wiring of cmd/duckgres-controlplane and cmd/duckgres-worker to actually call configresolve.ResolveEffective is a separate PR — each binary needs its own flag.* declarations + cliSet capture shape; doing both here would balloon this PR. With this PR landed, that follow-up is mechanical.

🤖 Generated with Claude Code

fuziontech and others added 2 commits May 1, 2026 14:34
…resolve/

Moves the ~940-line precedence-aware config merger (CLI > env > YAML >
defaults) and its CLIInputs / Resolved types out of the all-in-one
duckgres binary's package into a new configresolve/ package. This is the
last piece needed before cmd/duckgres-controlplane and cmd/duckgres-worker
can move past their config-load stub and actually boot — they can now
import and call configresolve.ResolveEffective(...) instead of having to
duplicate the resolution logic.

Why a new package and not configloader/: configloader is intentionally
light (YAML schema + LoadFile only, ~30 lines per file, no deps on
server/controlplane). configresolve is heavy by design (depends on
server, controlplane, server/ducklake) because it produces fully wired
runtime configs. Mixing the two would force everything that just wants
the YAML schema to pull in the heavy graph too.

Naming changes (all renames mechanical, no logic touched):
- configCLIInputs → configresolve.CLIInputs
- resolvedConfig → configresolve.Resolved
- defaultServerConfig → configresolve.DefaultServerConfig
- resolveEffectiveConfig → configresolve.ResolveEffective
- splitAndTrim, intPtr, boolPtr stay package-private (unexported)

main.go's existing FileConfig type alias to configloader.FileConfig is
unchanged; ResolveEffective takes *configloader.FileConfig directly so
callers don't need the alias.

Verified:
- go build ./... + go build -tags kubernetes ./... both clean
- go test ./configresolve/... passes both with and without -tags kubernetes
- go list -deps ./cmd/duckgres-controlplane confirms libduckdb still NOT
  pulled in (default tags AND -tags kubernetes)

The follow-up wiring of cmd/duckgres-controlplane and cmd/duckgres-worker
to actually call configresolve.ResolveEffective lands in a separate PR
since each binary needs its own flag.* declarations + cliSet capture
shape; doing both here would balloon this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
main_test.go is in `package main` so it referenced the moved symbols
unqualified (resolveEffectiveConfig, configCLIInputs). go test ./
compiles the binary's own test file, which my local sanity runs missed
because I tested ./... which does NOT include the root package's tests
when run from a deeper directory in some shells. Lint and unit-tests
caught it on PR #511's CI.

49 references updated to configresolve.ResolveEffective /
configresolve.CLIInputs; configresolve import added; FileConfig type
alias kept (still used for the flag-binding code). golangci-lint clean
locally now.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant