Skip to content

feat(cmd/duckgres-worker): add a worker-only entry point that ships libduckdb#500

Merged
fuziontech merged 1 commit into
mainfrom
feature/cmd-worker-binary
May 1, 2026
Merged

feat(cmd/duckgres-worker): add a worker-only entry point that ships libduckdb#500
fuziontech merged 1 commit into
mainfrom
feature/cmd-worker-binary

Conversation

@fuziontech
Copy link
Copy Markdown
Member

Summary

Counterpart to cmd/duckgres-controlplane (PR #498). This binary:

  • Links libduckdb (verified: go list -deps shows duckdb-go-bindings, duckdb-go/v2 in the import graph).
  • Imports duckdbservice but not controlplane — no PG wire surface, no config-store / k8s pool wiring. It's the runtime that the control plane spawns into worker pods over Unix sockets / TCP.
  • Is the target of the planned per-DuckDB-version matrix build in CI. A worker pod ships exactly one DuckDB version, pinned via go.mod + the Dockerfile DUCKDB_EXTENSION_VERSION build arg.

Like cmd/duckgres-controlplane, this is a stub that errors out at runtime — duckgres' YAML / CLI / env config resolution still lives in the package main file at the repo root alongside the all-in-one binary. The follow-up PR lifts that into a shared package both new binaries can import. The point of this PR is locking in the binary's existence and the import-graph contract.

Where the binary split now stands

Together with PR #498 (CP-only, no libduckdb) and PR #499 (CI guard), the binary split is structurally complete:

Binary libduckdb Modes
cmd/duckgres-controlplane no control-plane only (all DuckDB versions run on remote workers)
cmd/duckgres-worker yes duckdb-service only (pinned to one DuckDB version per build)
duckgres (all-in-one) yes all modes (standalone / control-plane / duckdb-service)

Test plan

🤖 Generated with Claude Code

…ibduckdb

Counterpart to cmd/duckgres-controlplane (PR #498). This binary:

  - Links libduckdb (verified: go list -deps shows duckdb-go-bindings,
    duckdb-go/v2 in the import graph).
  - Imports duckdbservice but not controlplane — no PG wire surface, no
    config-store / k8s pool wiring. It's the runtime that the control
    plane spawns into worker pods over Unix sockets / TCP.
  - Is the target of the planned per-DuckDB-version matrix build in CI.
    A worker pod ships exactly one DuckDB version, pinned via go.mod +
    the Dockerfile DUCKDB_EXTENSION_VERSION build arg.

Like cmd/duckgres-controlplane, this is a stub that errors out at
runtime — duckgres' YAML / CLI / env config resolution still lives in
the package main file at the repo root alongside the all-in-one binary.
The follow-up PR lifts that into a shared package both new binaries
can import. The point of this PR is locking in the binary's existence
and the import-graph contract.

Together with PR #498 (CP-only, no libduckdb) and PR #499 (CI guard),
the binary split is now structurally complete:

  cmd/duckgres-controlplane   no libduckdb (CP-only, all DuckDB versions
                              run on remote workers)
  cmd/duckgres-worker         links libduckdb (worker-only, pinned to
                              one DuckDB version per build)
  duckgres                    all-in-one (links libduckdb, all modes)

Verified:
  - go build ./cmd/duckgres-worker/... clean
  - go list -deps ./cmd/duckgres-worker | grep duckdb-go shows the
    expected DuckDB driver imports
  - go list -deps ./cmd/duckgres-controlplane | grep duckdb-go is still
    empty (the CP-only contract held)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fuziontech fuziontech enabled auto-merge (squash) May 1, 2026 18:18
@fuziontech fuziontech merged commit 14a4e2e into main May 1, 2026
21 of 22 checks passed
@fuziontech fuziontech deleted the feature/cmd-worker-binary branch May 1, 2026 18:21
fuziontech added a commit that referenced this pull request May 5, 2026
… API (#512)

Two pieces of the runbook went stale during the recent binary-split work:

1. The "canary a new build" instructions still recommended direct
   `UPDATE duckgres_managed_warehouses SET image=...` SQL against the
   config store. PR #506 replaced that with `PATCH
   /api/v1/orgs/:id/warehouse/pinning` (row-locked transaction, audit
   trail, no DB shell required). Updates every example to use the API
   endpoint and explicitly tells operators not to use SQL.

2. The image format was the all-in-one `posthog/duckgres:vX.Y.Z`. PRs
   #500-#503 split that into a per-DuckDB-version `duckgres-worker`
   matrix. Updates examples to the new
   `ghcr.io/posthog/duckgres-worker:<sha>-duckdb<version>` shape and
   adds a tag-conventions table covering both GHCR and the ECR mirror
   (provisioned in posthog-cloud-infra#7848).

Adds two new sections:

- "Available Worker Builds" — explains the matrix CD, shows operators
  how to list current ECR / GHCR tags, and explains why pinning a
  non-default DuckDB version requires a specific `<sha>-duckdb<version>`
  tag (no `latest-duckdb<version>` convention exists).
- "Reverting a Pin" — documents the empty-string semantics for clearing
  back to the global default, with a caution that clearing
  `ducklake_version` does NOT downgrade an already-migrated tenant
  (one-way door from the existing CAUTION block).

Also fixes the spec-version format in examples (it's `major.minor` only —
"0.4" / "1.0" / "1.1" — matching the validator added in #506) and adds
a "Background" section linking back to the binary-split PRs so future
maintainers understand the two-image story.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fuziontech added a commit that referenced this pull request May 5, 2026
The cmd/ binary stubs were created in #498/#500 but never had their
config-resolution wiring finished, so they could be built and pushed to
ECR but not actually run. This wires cmd/duckgres-worker to call
duckdbservice.Run via configresolve.ResolveEffective, and lifts the
shared boot scaffolding (logging, tracing, otel resource, build-info)
into a new internal/cliboot package so the worker, control plane, and
all-in-one binaries inherit identical PostHog log shipping, password
redaction, and OTLP tracing.

The worker exposes a ~14-flag subset (DuckDB execution, DuckLake, query
log, duckdb-service transport) — TLS/ACME, PG wire, control-plane pool,
K8s, and config-store flags intentionally do not exist on this binary.
YAML and env still carry the full surface so a worker pod can boot from
the same ConfigMap as the control plane; CP-only fields land in
Resolved slots the worker simply doesn't read.

Boot scaffolding lift moves logging.go (incl. RedactingHandler),
tracing.go, otel_resource.go, and the BuildInfo helper out of package
main and into internal/cliboot. Each binary keeps its own
package-main var version/commit/date because -ldflags -X can only
target package-main symbols. just test-unit picks up ./internal/... so
the redaction tests run on every CI pass.

Co-authored-by: james <james@jams-spark.lan>
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