refactor(tf): DDD refactor of the tf runner (phase 2, partial) - #54
Closed
grubmeshi wants to merge 1 commit into
Conversation
Behavior-preserving DDD refactor of the tf runner under the green phase-1
characterization suite. All gates green: `task test`, `task test:tf-block-runner`
(-race), `task lint` (0 issues), coverage gate 90.3% >= 90%.
Landed (each an always-green checkpoint):
- Step 2 (D4): eliminate the `meshcrypto.Crypto` global. New `Decryptor` port
(certDecryptor / NoopDecryptor / NewCertDecryptor) threaded through
decryptIfSensitive, SshAuth.unwrapCert, the DTO->Run mapping, RunApiClient,
workers, manager and main. `var Crypto` deleted from go-meshapi-client/crypto
(flagged cross-module edit, provably dead after this step; all modules build).
- Step 5 (P3): remove the RunContextInfo-in-context.Value smuggling. RunContextInfo
is passed as an explicit parameter to the work/observer routines and
Apply/Plan/DestroyCmd; contextKey/runInfoContextKey deleted.
- Step 6 (B10, D13 exception): structural fix of the reporting data race.
RunStatus.Steps []*StepStatus -> []StepStatus (P4 value semantics); new
mutex-guarded `progress` tracker (publish/setStatus/Snapshot with deep-copy
clone) replaces the reportStatus shallow copy.
- B6 (D13 exception): DefaultRunManager.shutdownCalled -> atomic.Bool.
- `-race` turned on for the tf leg (Taskfile test:tf-block-runner + CI matrix
test-flags), pulled forward from 2b to guard the B6/B10 structural fixes.
Deferred (left green, no partial edits; see PR body + uncertainties):
- Step 3 (kill ToInternalWithoutDecryption fork), Step 4 (AppConfig de-global),
Steps 7-8 (Engine unification / Worker+SingleRunWorker collapse), Steps 9-11
(internal/{tf,gitsource,tofu} split + util/ dissolution + depguard).
Bug inventory intact (13 FIXME(bug) markers unchanged); no functional bug fixed.
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 2 — DDD refactor of the tf runner (partial)
Behavior-preserving DDD refactor of the tf runner under the green phase-1 characterization suite. Stacked on
refactor/single-go-binary/phase-1-characterization-tests.Gates (all green)
task test(all 3 modules) — passtask test:tf-block-runner(go test -race) — pass (62s)task lint— 0 issues across all modulestask coverage—tfrun90.3% >= 90% gatego build ./...)Landed (each an always-green checkpoint)
meshcrypto.Cryptoglobal eliminated. NewDecryptorport (certDecryptor/NoopDecryptor/NewCertDecryptor) threaded throughdecryptIfSensitive,SshAuth.unwrapCert, DTO→Run mapping,RunApiClient, workers, manager andmain.var Cryptodeleted fromgo-meshapi-client/crypto(flagged cross-module edit per §10 — provably dead after this step; all modules build).RunContextInfo-in-context.Valuesmuggling removed.RunContextInfopassed as an explicit parameter to work/observer routines andApply/Plan/DestroyCmd;contextKey/runInfoContextKeydeleted.RunStatus.Steps []*StepStatus→[]StepStatus(P4); mutex-guardedprogresstracker (publish/setStatus/Snapshotwith deep-copyclone) replaces thereportStatusshallow copy.DefaultRunManager.shutdownCalled→atomic.Bool.-raceon for the tf leg (Taskfile + CI matrixtest-flags), pulled forward from 2b to guard the B6/B10 structural fixes.Sanctioned deltas (D13 exception, §5.5)
-raceturned on early to lock them in.Deferred within this slice (left green, no partial edits)
ToInternalWithoutDecryptionfork (STOP-B-adjacent: flips one internal-flag pin).AppConfigde-global (~20 read sites + ~14 test setups mutate the global).Worker/SingleRunWorkercollapse + step-pipeline unification.internal/{tf,gitsource,tofu}split +util/dissolution + depguard.Exit criteria — status (partial)
meshcrypto.Cryptoglobal eliminated;context.Valuesmuggling removed; B6/B10 races fixed under-race.AppConfigglobal remains, Step 4 deferred); package split (Steps 9–11 deferred).EXECUTION_MODE=single-runbinary smoke.main.go/NewManager/NewRunApi/single-run mapping wiring changed — run both before merge.Uncertainties for human review
GenericTfCmd/RunContextInfo/TfCmdParamsliterals, smugglerciinto mock closures viactx.Value, assert on internals) rather than black-box at the declared seams. This is why the remaining steps are heavier than the plan's "≤15 mechanical steps" premise. Under the STOP protocol this would halt for replanning; under the autonomous run it is recorded here.-racescope. Enabled on the tf leg (test:tf-block-runner+ CI), not the aggregatetask testloop.🤖 Generated with Claude Code