refactor(phase-3): shared runner-core — meshapi consolidation + config/report/meshapitest - #56
Closed
grubmeshi wants to merge 1 commit into
Conversation
…g/report/meshapitest packages
Phase 3 (PLAN_DETAIL_03_shared_core.md) partial landing — the shared-core
package foundations, consolidated from five disjoint sub-agent slices.
meshapi (steps 2–5):
- HttpError{StatusCode, ResponseBody} + IsNotFound/IsConflict/IsForbidden +
AsHttpError, replacing the status-only StatusError (provider-shaped, D3/§7).
- Identity{Name,Version} + UserAgent(); deletes the runnerName/runnerVersion/
SetClientMetadata package globals (last deferred mutable global in the module).
- retryTransport + RetryOptions/ExponentialBackoff: GET/PUT/DELETE always retry,
POST only whitelisted (/status/source, /api/login); claim POST + status PATCH
never retried; 429/502/503/504/transport-error retryable, 500 not; Retry-After
honored (cap 5min); MaxRetries 4, 1–8s (§5.2.3).
- Pluggable Logger seam copied verbatim from the provider (noop default, SlogLogger
adapter, Authorization [REDACTED] as the one sanctioned mask; artifact stream never
body-logged) (§5.2.6).
- Client split: RunClient (run endpoints, Client=RunClient alias) + RunnerClient
(registration PUT moved out of controller/registration.go, wire byte-identical).
- Consumers migrated (behavior byte-identical): controller.go/runapi.go/registration.go,
tf worker.go/runapi.go, both mains (SetClientMetadata dropped).
New shared packages (born standalone, gated ≥90):
- config (§5.3, D7): two-file deep-merge loader, ${VAR} interpolation, D7 legacy-env
fail-fast, shared Api section (user/username alias), Env bindings, LogLevel helper.
- report (§5.4, D4): ExecutionStatus/RunStatus/StepStatus/Output, Progress, RunLog,
Observer (10s ticker, abort-cancel, async SUCCEEDED→IN_PROGRESS), Reporter, ToStatusUpdate.
- meshapitest (§5.7): httptest-backed meshfed-API mock server (claim/register/PATCH/
artifact) with seedable runs + captured requests; ungated test-only helper.
Gate: thresholds.txt gains config 90 / meshapi 90 / report 90 (all pass:
config 95.9%, meshapi 90.6%, report 99.2%); tf gate holds at 90.4%.
Deferred to a follow-up (not delivered by any slice; see PR body): controller
de-global (AppConfig/DiscoveredOidcIssuer/UseTestClient, metrics singleton — step 7),
config/report consumer rebases (steps 6/9), decryption move + crypto gate (step 8),
lint-debt exclusion-block removal (step 10), acceptance run (step 11).
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 3 — Shared Runner-Core & Client Consolidation (partial)
Consolidates five disjoint sub-agent slices into one always-green branch. This landing covers the shared-package foundations (plan steps 2–5 + the three new standalone packages); the consumer-rebase / de-global steps (6,7,8,9,10,11) were not produced by any slice and are deferred — see "Not delivered" below. Opening as draft accordingly.
Delivered (green)
meshapiclient consolidation (steps 2–5)HttpError{StatusCode, ResponseBody}+IsNotFound/IsConflict/IsForbidden+AsHttpError, replacing status-onlyStatusError(provider-shaped, D3/§7).Identity{Name,Version}+UserAgent(); deletesrunnerName/runnerVersion/SetClientMetadata(last deferred mutable global in the module).retryTransport,RetryOptions,ExponentialBackoff) per §5.2.3.Loggerseam copied verbatim from the provider (§5.2.6).RunClient/RunnerClient; registration PUT + v1-preview media type moved out ofcontroller/registration.go, wire byte-identical.New shared packages (born standalone, gated ≥90)
config(§5.3, D7): two-file deep-merge loader,${VAR}interpolation, legacy-env fail-fast, sharedApisection (user/usernamealias),Envbindings,LogLevel.report(§5.4, D4):ExecutionStatus/RunStatus/StepStatus/Output,Progress,RunLog,Observer,Reporter,ToStatusUpdate.meshapitest(§5.7): httptest meshfed-API mock server; ungated test-only helper.Gates
task testgreen (all 3 modules); tf-racegreen.task lintgreen (0 issues, 3 modules).Sanctioned deltas
meshapi(429/502/503/504/transport-error, idempotent + whitelisted POST) — the D3 phase-3 mandate; inert on happy paths; STOP-D transcript-neutral (§5.2.3, §8).LOG_LEVELenv +meshapiDEBUG wire-body logging seam (inert at defaultinfo);mainhandler-level wiring lands phase 4 (§5.2.6).RunnerClient.Update(uuid, jsonBody []byte)(keeps controller-side marshal-vs-PUT metric split, D12), statefulconfig.Loader(per-startup consumed-env tracking, P3),Observer.Runextradonechan,NewRunLog (*RunLog, error),ExecutionStatus.String()returns"UNKNOWN"(no panic).NOT delivered by any slice (deferred; exit criteria NOT fully met)
AppConfig,DiscoveredOidcIssuer,UseTestClientand themetricsInstance/metricsOncesingleton all remain. The injectableNewMetricsCollector(reg prometheus.Registerer)seam (§5.6) that phase 4 assumes is NOT in place — flagged as a cross-plan issue.configandreportare unused by tf/controller (they keep their own config + reporting types; duplication remains until the rebase).controller/decryption.gonot moved intomeshapi;cryptohas noDecryptmethod and stays at 71.4% (nocryptogate line added — it would fail)..golangci.ymlcontroller/go-meshapi-clienterrcheck/forcetypeassert/makezero exclusion blocks are still present (13 findings would surface if removed, incl. untouchedcrypto).See
PLAN_DETAIL_03_shared_core.md§6 for the full step list and the structured run report for the uncertainty list.🤖 Generated with Claude Code