refactor(phase-4): single Go module at repo root + per-persona binaries - #57
Closed
grubmeshi wants to merge 2 commits into
Closed
Conversation
…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>
Collaborator
Author
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 free
to 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.
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
tf-block-runner,run-controller,go-meshapi-client) → one modulegithub.com/meshcloud/building-block-runnerat the repo root.go.work/go.work.sum+ three legacygo.mod/go.sum+ both legacy mains deleted. Code moved viagit mv(import-path rewrite, zero semantic edits) intointernal/{tf,meshapi,crypto,config,report,meshapitest,controller,build}. MVS liftedx/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.cmd/tf(lean fit persona, links no k8s) andcmd/bbrunner(controller/superset = therun-controllerimage; fit-persona subcommand registry; unknown subcommand → usage + exit 2). Phase-4 ships bbrunner as the k8s controller only;InProcessDispatcher+auto-detect are phase 5.internal/mgmt(one listener serving/healthz+/metrics;RunMetricsrunner_*series) +config.ManagementPort(MANAGEMENT_PORTwith the deprecation-loggedPORTalias on tf). Controller gains/healthz; tf polling gains/metrics+ generic run metrics via a consumer-sideMeterseam ininternal/tf.containers/{tf-block-runner,run-controller}/Dockerfile, each ships its own binary as direct ENTRYPOINT (/app/tfrunnerkept as a plain duplicate;PORT=8080kept on the tf image). Runtime assets moved tocontainers/<app>/.ci.yml/build-images.ymlcollapse to one repo-root Go test leg (-race, coverage at root) + per-app Dockerfile paths; Taskfile/thresholds/exclusions/depguard reparented tointernal/*+cmd/*; README health/structure/task truth-pass;CROSS_REPO_TODO.mdrecords the meshfed-releaselocal-dev-stackSKILL hand-off.Gates (all green on the consolidated tree)
go build ./...clean;task test(-race) all packages pass;task lint0 issues;go mod tidyno diff.task coverage:internal/tf90.2%,internal/config96.5%,internal/meshapi90.6%,internal/report99.2%,internal/mgmt96.4% — all ≥90 (STOP-C not tripped).crypto/controllerungated per plan.cmd/tf→[TF RUNNER]config-read;cmd/bbrunner→[RUN CONTROLLER]config-read;bbrunner bogus→ usage, exit 2.Sanctioned deltas (§6 / §10 flags)
runner_*series (additive names, no rename).PORTon the tf persona logs a one-line deprecation notice (fires in default containers).task test/ CI now run-raceover the whole suite (was tf-leg only).run-controller - testetc. → singleGo - test) — not a D9/D10 frozen surface; branch-protection may need a one-time update.runner-config.yml(the §4.4 base+override deep-merge is not wired — the loader is not yet called by either persona'sReadConfig; behavior-preserving).Uncertainties for review
prometheus.Registererseam; it was never delivered (A4 debt), so the controller'smgmt.NewServeris wired toprometheus.DefaultGatherer— byte-identical to today, but the de-globalization remains open.AppConfigde-global,Decryptor→meshapi move) is still unpaid;cmd/*wiring readstf.AppConfig.RunnerUuid(global).cmd/tf/main.goandcmd/bbrunner/tf.go(both wiring-only, D11-exempt); a shared composition root may be cleaner in phase 5.run-controller/k8s/*.yamldeployment 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