Skip to content

refactor(phase-4): single Go module at repo root + per-persona binaries - #57

Closed
grubmeshi wants to merge 2 commits into
refactor/single-go-binary/phase-3-shared-corefrom
refactor/single-go-binary/phase-4-single-binary
Closed

refactor(phase-4): single Go module at repo root + per-persona binaries#57
grubmeshi wants to merge 2 commits into
refactor/single-go-binary/phase-3-shared-corefrom
refactor/single-go-binary/phase-4-single-binary

Conversation

@grubmeshi

Copy link
Copy Markdown
Collaborator

Phase 4 — Per-persona binaries & module consolidation (PLAN_DETAIL_04_single_binary.md)

Consolidation of six parallel slices into one always-green commit (the PR squash-merges to one).

What landed

  • Module consolidation (D2/D11): three Go modules (tf-block-runner, run-controller, go-meshapi-client) → one module github.com/meshcloud/building-block-runner at the repo root. go.work/go.work.sum + three legacy go.mod/go.sum + both legacy mains deleted. Code moved via git mv (import-path rewrite, zero semantic edits) into internal/{tf,meshapi,crypto,config,report,meshapitest,controller,build}. MVS lifted x/net 0.39→0.56, x/sys 0.33→0.46, x/text 0.25→0.38; k8s v0.34.1 compiles and controller goldens/transcripts stay green → STOP-B not tripped.
  • Entrypoints (D1/D8): cmd/tf (lean fit persona, links no k8s) and cmd/bbrunner (controller/superset = the run-controller image; fit-persona subcommand registry; unknown subcommand → usage + exit 2). Phase-4 ships bbrunner as the k8s controller only; InProcessDispatcher+auto-detect are phase 5.
  • D12 observability unification: internal/mgmt (one listener serving /healthz+/metrics; RunMetrics runner_* series) + config.ManagementPort (MANAGEMENT_PORT with the deprecation-logged PORT alias on tf). Controller gains /healthz; tf polling gains /metrics + generic run metrics via a consumer-side Meter seam in internal/tf.
  • Per-app Dockerfiles (D8): containers/{tf-block-runner,run-controller}/Dockerfile, each ships its own binary as direct ENTRYPOINT (/app/tfrunner kept as a plain duplicate; PORT=8080 kept on the tf image). Runtime assets moved to containers/<app>/.
  • Workflows/tooling: ci.yml/build-images.yml collapse to one repo-root Go test leg (-race, coverage at root) + per-app Dockerfile paths; Taskfile/thresholds/exclusions/depguard reparented to internal/*+cmd/*; README health/structure/task truth-pass; CROSS_REPO_TODO.md records the meshfed-release local-dev-stack SKILL hand-off.

Gates (all green on the consolidated tree)

  • go build ./... clean; task test (-race) all packages pass; task lint 0 issues; go mod tidy no diff.
  • task coverage: internal/tf 90.2%, internal/config 96.5%, internal/meshapi 90.6%, internal/report 99.2%, internal/mgmt 96.4% — all ≥90 (STOP-C not tripped). crypto/controller ungated per plan.
  • Boot smoke: cmd/tf[TF RUNNER] config-read; cmd/bbrunner[RUN CONTROLLER] config-read; bbrunner bogus → usage, exit 2.

Sanctioned deltas (§6 / §10 flags)

  1. Controller listener bind failure flips silent-continue → fatal (§6.1) with the healthz addition.
  2. tf polling serves /metrics + new runner_* series (additive names, no rename).
  3. PORT on the tf persona logs a one-line deprecation notice (fires in default containers).
  4. task test / CI now run -race over the whole suite (was tf-leg only).
  5. CI required-status-check name changes (run-controller - test etc. → single Go - test) — not a D9/D10 frozen surface; branch-protection may need a one-time update.
  6. Per-app Dockerfiles ship each persona's self-contained runner-config.yml (the §4.4 base+override deep-merge is not wired — the loader is not yet called by either persona's ReadConfig; behavior-preserving).

Uncertainties for review

  • Cross-plan (blocker-tracked): plan-03 §5.6 promised phase 4 an injectable prometheus.Registerer seam; it was never delivered (A4 debt), so the controller's mgmt.NewServer is wired to prometheus.DefaultGatherer — byte-identical to today, but the de-globalization remains open.
  • Standing 2→3→4 deferred debt (Engine/Worker unification, AppConfig de-global, Decryptor→meshapi move) is still unpaid; cmd/* wiring reads tf.AppConfig.RunnerUuid (global).
  • tf polling wiring is duplicated between cmd/tf/main.go and cmd/bbrunner/tf.go (both wiring-only, D11-exempt); a shared composition root may be cleaner in phase 5.
  • run-controller/k8s/*.yaml deployment manifests left in place (no path dependency; not part of the Go module).

Base: refactor/single-go-binary/phase-3-shared-core.

🤖 Generated with Claude Code

grubmeshi and others added 2 commits July 10, 2026 17:20
…plan

Runs every A1-A12 verification step from PLAN_DETAIL_04_single_binary.md §1
against the phase-3-shared-core tree. A2 (tf package split + Engine/Worker
unification), A3 (Decryptor/DecryptRunDetails in meshapi), A4 (AppConfig/
MetricsCollector de-global) and A5 (5-line threshold split) are materially
false — phases 2 and 3 both landed "partial" by their own commit messages,
deferring this same work forward, and plan 03's own STOP-gate check already
hit and recorded the identical A2/A3 pattern for itself.

Resolved autonomously without halting: unlike plan 03, none of phase 4's own
steps require that debt paid down first (step 1 is a git mv of whatever the
tree actually looks like, plus verbatim main bodies). Adapts the plan's
mechanical specifics to match reality — single `internal/tf` package instead
of a tf/gitsource/tofu split, one coverage threshold line instead of three,
`prometheus.DefaultGatherer` instead of an injected registerer for the
mgmt listener — while leaving the phase's actual deliverable (module
consolidation, cmd/* wiring, per-app Dockerfiles, MANAGEMENT_PORT) unchanged.

Flags the three-phases-in-a-row deferral pattern for human review rather
than resolving it further here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Consolidate the three Go modules (tf-block-runner, run-controller,
go-meshapi-client) into one module github.com/meshcloud/building-block-runner
rooted at the repo root; delete go.work/go.work.sum and the three legacy
go.mod/go.sum. Code moves under internal/{tf,meshapi,crypto,config,report,
meshapitest,controller,build} (git mv, import-path rewrite, zero semantic
edits) and the two legacy mains become cmd/tf (lean fit persona, no k8s) and
cmd/bbrunner (controller/superset = run-controller image, with a fit-persona
subcommand registry; unknown subcommand -> usage, exit 2).

D12 observability unification: new internal/mgmt (one listener serving
/healthz + /metrics; RunMetrics runner_* series) and config.ManagementPort
(MANAGEMENT_PORT with the deprecation-logged PORT alias on the tf persona).
The controller gains /healthz (bind failure now fatal); the tf polling loop
gains /metrics + generic run metrics wired through a consumer-side Meter seam
in internal/tf. Single-run tf stays listener-free; the controller keeps its
run_controller_* series on 2112 (DefaultGatherer, byte-identical).

Per-app Dockerfiles under containers/<app>/ (each builds/ships its own binary
as a direct ENTRYPOINT; /app/tfrunner kept as a plain duplicate; PORT=8080
kept on the tf image). Runtime assets move to containers/<app>/. CI/release
workflows collapse to one repo-root Go test leg (-race, coverage at root) and
per-app Dockerfile paths. Taskfile/thresholds/exclusions/depguard reparented
to internal/*+cmd/*; README health/structure/task sections truth-passed;
CROSS_REPO_TODO records the meshfed-release local-dev-stack SKILL hand-off.

Frozen contracts (wire shapes, headers, k8s single-run contract, image names,
in-image paths, healthz body, controller metric names/port) preserved; the
only new env vars are MANAGEMENT_PORT and LOG_LEVEL wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@grubmeshi

Copy link
Copy Markdown
Collaborator Author

Superseded by #65, which consolidates the plan + all phases 0→7 + the phase-3/5 remediation into a single reviewable PR (with all plan/run artifacts and a code-verified FOLLOW_UP.md). Closing in favor of #65.

@grubmeshi grubmeshi closed this Jul 13, 2026
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