Phase 1: tf runner characterization tests to ≥90% (gate on) - #53
Closed
grubmeshi wants to merge 1 commit into
Closed
Conversation
Phase 1 of the single-Go-binary refactor (PLAN_DETAIL_01). Pins the tf runner's current behavior with hermetic, use-case-level scenario tests before the phase-2 DDD refactor, then turns the coverage gate on. - Hermetic fixtures (CP1): local on-disk git repos replace the live github.com/meshcloud/meshstack-hub.git clone; shared runDetailsDTO builder + genuine encrypt/decrypt helpers over the checked-in test key. - D9 pins across polling (Worker) and single-run (SingleRunWorker): claim/register/status endpoints, media types + runner headers, 409-register idempotency, 404/409-claim, abort-flag cancellation, 10s ticker, runToken>base-auth + ClearRunToken, async final IN_PROGRESS, plan-artifact download (128MiB cap), meshStack HTTP backend fallback + TF_HTTP_* auth, pre-run script contract, tfvars / meshStack_run_vars.tf generation, FILE data-URLs, cleanSystemEnv, decrypt-failure UX, workspace select/create/delete naming, SSH auth known-hosts resolution, config precedence, manager token protocol. - D13 bug inventory pinned verbatim with FIXME(bug): B1-B5, B7, B12, B13 (B6/B10 races are structural phase-2 fixes; B8/B9/B11 inventory-only). - Coverage gate (CP13): tools/coverage/thresholds.txt gates tfrun at 90% statement coverage (measured 90.2%); git.go + tfbinaries.go excluded as real-I/O adapters (tools/coverage/exclusions.txt) per §7. Tests-only except the sanctioned MockedTfFacade test-infra seam (configurable SetEnv/Workspace* hooks, CP4-CP6). 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 1 — Characterization tests for
tfrunto ≥90% (pre-refactor)Stacked on
refactor/single-go-binary/phase-0-guardrails. Pins the tf runner's current behavior with hermetic, use-case-level scenario tests (black-box throughWorker/SingleRunWorker) so they survive the phase-2 DDD refactor, then turns the coverage gate on. Tests-only, with one sanctioned production-file exception (below).Coverage
tfrunin-scope statement coverage: 90.2% (gate at 90 viatools/coverage/thresholds.txt).tools/coverage/exclusions.txt):git.go(go-git/exec-git+bash; SSH/Azure need real I/O) andtfbinaries.go(real tofu/terraform release downloads). Everything else counts.task test,task lint(golangci-lint v2, 0 issues), andtask coverageall green across the three modules.What is pinned (D9 + use-case matrix)
meshstack-hub.gitclone; sharedrunDetailsDTObuilder + genuine encrypt/decrypt over the checked-in test key.go-meshapi-client).TF_HTTP_*) + init retry /HINT_INIT_FAILED.triggerstep, finalIN_PROGRESS, destroy apply-before-destroy, async failure → FAILED).$MESHSTACK_USER_MESSAGE, stdin run JSON) + timeout / exit-status user messages.ReadConfig/NewAuthProvider/ToInternalWithoutDecryption+ small enum/status error branches.HostKeyAlgorithmspin) — hermetic, generated keys.done/norun/failed/stop, shutdown re-check).D13 bug inventory (pinned verbatim, fixed in phase 2b)
FIXME(bug):markers for B1, B2, B3, B4, B5, B7, B12, B13. B6/B10 (data races) are structural phase-2 fixes; B8/B9/B11 are inventory-only per the plan.Sanctioned deltas
mockedtffacade.go(production file) gained configurableSetEnv/Workspace*test hooks, defaulting to the prior hardcoded behavior — the CP4-CP6 test-infra seam the plan authorizes. This is the only non-_test.gochange besides the coverage config files.makeLocalGitRepofixture builder now retries construction on a fresh dir (go-git occasionally returns a transient "reference not found" under full-suite filesystem load); behavior-preserving, eliminates a suite flake.Cross-plan / D9 correction
88d67d4); only the 128MiB cap is pinned. The high-level D9 pin list should drop the same-origin item.Do not merge — draft for review.
🤖 Generated with Claude Code