G0 D1 ships: skeleton + chi + /health × 5 binaries · acceptance gate PASSED

Phase G0 Day 1 executed end-to-end after a third-pass review by
qwen3-coder:480b consolidated all findings across Opus/Kimi/Qwen
lineages.

Cross-lineage review consolidation (3 model passes + 1 runtime pass):
- Opus 4.7: 9 findings · 7 fixed inline · 2 deferred
- Kimi K2.6: 2 BLOCKs (introduced by Opus fixes) · 2 fixed
- Qwen3-coder:480b: 2 WARNs · 1 fixed (D2.4 256 MiB cap + 4-slot
  semaphore on PUTs) · 1 deferred (Q2 view refresh batching)
- Runtime smoke: 1 finding (port 3100 collision with live Rust
  lakehouse) · fixed (Go dev ports shifted to 3110+)
- Total: 14 findings · 11 fixed · 3 deferred to G2

What landed in code:
- internal/shared/server.go — chi factory, slog JSON, /health,
  graceful shutdown via signal.NotifyContext
- internal/shared/config.go — TOML loader, DefaultConfig, -config flag
- cmd/{gateway,storaged,catalogd,ingestd,queryd}/main.go — five
  binaries, each ~30 lines using the shared factory
- lakehouse.toml — G0 dev defaults (3110-3214)
- scripts/d1_smoke.sh — repeatable smoke that exits 0 on PASS
- go.mod / go.sum — chi v5.2.5, pelletier/go-toml/v2 v2.3.0

Verified end-to-end via scripts/d1_smoke.sh:
- All 5 /health endpoints return 200 with correct service name
- Gateway /v1/ingest + /v1/sql stubs return 501 with X-Lakehouse-Stub
- Graceful shutdown logs cleanly on SIGTERM
- DuckDB cgo path verified separately (sql.Open("duckdb","") + ping)

D1 ACCEPTANCE GATE: PASSED.

Next: D2 — storaged S3 GET/PUT/LIST against MinIO.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claw
2026-04-28 07:00:37 -05:00
co-authored by Claude Opus 4.7
parent a74fdb1204
commit 1142f54f23
12 changed files with 586 additions and 6 deletions
+35
View File
@@ -0,0 +1,35 @@
// catalogd is the metadata control plane — dataset registry,
// Parquet manifest persistence, idempotent registration with
// schema-fingerprint gate (per Rust ADR-020). D3 wires the
// register/list/manifest routes; D1 just stands up the binary.
package main
import (
"flag"
"log/slog"
"os"
"git.agentview.dev/profit/golangLAKEHOUSE/internal/shared"
"github.com/go-chi/chi/v5"
)
func main() {
configPath := flag.String("config", "lakehouse.toml", "path to TOML config")
flag.Parse()
cfg, err := shared.LoadConfig(*configPath)
if err != nil {
slog.Error("config", "err", err)
os.Exit(1)
}
if err := shared.Run("catalogd", cfg.Catalogd.Bind, func(_ chi.Router) {
// D3 wires:
// POST /catalog/register (idempotent by name + fingerprint, 409 on drift)
// GET /catalog/manifest/{name}
// GET /catalog/list
}); err != nil {
slog.Error("server", "err", err)
os.Exit(1)
}
}
+48
View File
@@ -0,0 +1,48 @@
// gateway is the Lakehouse-Go HTTP/gRPC ingress. In G0 it serves
// /health, /v1/ingest (501 stub, per D1.10), and /v1/sql (501 stub).
// D6 promotes the stubs to real reverse-proxies with a custom
// Director that strips the /v1 prefix before forwarding (per Kimi
// finding K2 — httputil.NewSingleHostReverseProxy preserves the
// inbound path by default).
package main
import (
"flag"
"log/slog"
"net/http"
"os"
"git.agentview.dev/profit/golangLAKEHOUSE/internal/shared"
"github.com/go-chi/chi/v5"
)
func main() {
configPath := flag.String("config", "lakehouse.toml", "path to TOML config")
flag.Parse()
cfg, err := shared.LoadConfig(*configPath)
if err != nil {
slog.Error("config", "err", err)
os.Exit(1)
}
if err := shared.Run("gateway", cfg.Gateway.Bind, func(r chi.Router) {
// G0 stubs — D6.1 promotes these to real reverse-proxies via
// httputil.ReverseProxy with a Director that strips /v1.
r.Post("/v1/ingest", stubHandler)
r.Post("/v1/sql", stubHandler)
}); err != nil {
slog.Error("server", "err", err)
os.Exit(1)
}
}
// stubHandler returns 501 with the X-Lakehouse-Stub header so the
// D6 promotion is a behavior change (handler swap), not an endpoint
// addition. Test clients can detect the stub by header presence.
func stubHandler(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("X-Lakehouse-Stub", "g0")
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusNotImplemented)
_, _ = w.Write([]byte(`{"error":"not implemented in G0; promoted on D6.1"}`))
}
+32
View File
@@ -0,0 +1,32 @@
// ingestd is the data on-ramp — CSV → Parquet, schema inference,
// auto-registration with catalogd. D4 wires the actual ingest route.
package main
import (
"flag"
"log/slog"
"os"
"git.agentview.dev/profit/golangLAKEHOUSE/internal/shared"
"github.com/go-chi/chi/v5"
)
func main() {
configPath := flag.String("config", "lakehouse.toml", "path to TOML config")
flag.Parse()
cfg, err := shared.LoadConfig(*configPath)
if err != nil {
slog.Error("config", "err", err)
os.Exit(1)
}
if err := shared.Run("ingestd", cfg.Ingestd.Bind, func(_ chi.Router) {
// D4.3 wires:
// POST /ingest (multipart form file → schema infer → write
// Parquet via storaged → register via catalogd)
}); err != nil {
slog.Error("server", "err", err)
os.Exit(1)
}
}
+40
View File
@@ -0,0 +1,40 @@
// queryd is the SQL execution layer — DuckDB via cgo, registers
// catalog datasets as views, executes ad-hoc SQL. D5 wires the
// actual /sql route + DuckDB session with S3 secret plumbed in
// (per Opus B2 fix). D1 just stands up the binary.
//
// NOTE: cgo handle lifecycle. The shared server factory's
// graceful-shutdown is enough for G0 (DuckDB connections are
// goroutine-local), but G1+ when persistent prepared statements +
// HNSW indexes attach, queryd will need its own OnShutdown drain
// hook. Tracked in D7.5 (W3 disposition).
package main
import (
"flag"
"log/slog"
"os"
"git.agentview.dev/profit/golangLAKEHOUSE/internal/shared"
"github.com/go-chi/chi/v5"
)
func main() {
configPath := flag.String("config", "lakehouse.toml", "path to TOML config")
flag.Parse()
cfg, err := shared.LoadConfig(*configPath)
if err != nil {
slog.Error("config", "err", err)
os.Exit(1)
}
if err := shared.Run("queryd", cfg.Queryd.Bind, func(_ chi.Router) {
// D5 wires:
// POST /sql (JSON body {"sql": "..."} → DuckDB exec → JSON rows)
// Internal: TTL-cached views + etag invalidation against catalogd.
}); err != nil {
slog.Error("server", "err", err)
os.Exit(1)
}
}
+32
View File
@@ -0,0 +1,32 @@
// storaged is the object I/O service. D2 wires the actual S3
// GET/PUT/LIST routes; D1 just stands up the binary with /health.
package main
import (
"flag"
"log/slog"
"os"
"git.agentview.dev/profit/golangLAKEHOUSE/internal/shared"
"github.com/go-chi/chi/v5"
)
func main() {
configPath := flag.String("config", "lakehouse.toml", "path to TOML config")
flag.Parse()
cfg, err := shared.LoadConfig(*configPath)
if err != nil {
slog.Error("config", "err", err)
os.Exit(1)
}
if err := shared.Run("storaged", cfg.Storaged.Bind, func(_ chi.Router) {
// D2.4 wires GET/PUT/LIST routes here with localhost-only
// bind, 256 MiB MaxBytesReader, and a 4-slot semaphore on
// in-flight PUTs (per Qwen Q1 fix).
}); err != nil {
slog.Error("server", "err", err)
os.Exit(1)
}
}