fix(module/infra_admin): populate provider types in Start, not Init (live config-section ordering bug)#823
Merged
intel352 merged 1 commit intoJun 1, 2026
Conversation
engine.BuildFromConfig registers the "workflow" config section AFTER
app.Init() (app.Init() then RegisterConfigSection("workflow")), so
infra.admin.Init -> populateProviderTypes -> GetConfigSection("workflow")
returned "config section not found" and silently degraded provider_type,
supported_regions, AND the mutation desiredSpecs/wfCfg to empty. Moved the
call to Start() (runs after BuildFromConfig completes). Surfaced by the
scenario-92 live boot (region dropdown empty + curl showed empty provider_type);
unit tests pre-registered the section via withConfigSectionApp so they missed it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a live boot ordering bug where infra.admin.Init() attempted to read the "workflow" config section before engine.BuildFromConfig registers it, causing silent degradation (empty provider_type, empty supported_regions, and empty desiredSpecs impacting plan/apply).
Changes:
- Move
populateProviderTypesinvocation fromInfraAdmin.InittoInfraAdmin.Startso it runs after the"workflow"config section exists. - Add clarifying comments documenting why Init-time access to
"workflow"silently fails in live builds. - Update
TestInfraAdmin_Init_ResolvesAllServicesto explicitly drivepopulateProviderTypesnow that it’s Start-populated.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| module/infra_admin.go | Defers population of provider types / workflow-derived state to Start() to match engine config-section registration order. |
| module/infra_admin_test.go | Adjusts Init contract test to call populateProviderTypes explicitly (function unchanged) after the lifecycle shift. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
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.
Bug
infra.admin.InitcalledpopulateProviderTypes(app)which readsapp.GetConfigSection("workflow"). Butengine.BuildFromConfigregisters that section afterapp.Init():So during
infra.admin.Init,GetConfigSection("workflow")returnsconfig section not found: workflow→ silent graceful-degradation → emptyprovider_type, emptysupported_regions, and emptywfCfg/desiredSpecs(the last degrades the actual mutation Plan/Apply path, not just the form's region dropdown).Why it was never caught
The v1 infra-admin scenario never booted as a live stack (it referenced an
iac.providertype no plugin registered). Unit tests pre-register the section viawithConfigSectionApp, so the live ordering was never exercised. The scenario-92 v1.1 live boot surfaced it: region dropdown empty +curl /api/infra-admin/providersreturned noprovider_type/supported_regions. Debug logging confirmedsection_nil=true err="config section not found: workflow"at Init.Fix
Move the
populateProviderTypescall fromInittoStart(which runs afterBuildFromConfigcompletes, when the section exists, and before any route serves a request). One-line move + a comment;TestInfraAdmin_Init_ResolvesAllServicesupdated to drivepopulateProviderTypesexplicitly.Verification
go test -race ./module/ ./iac/admin/...green;golangci-lint --new-from-rev=origin/main0. Live-proven: scenario-92 stack boots,providersnow returnsprovider_type:"stub"+supported_regions:[test-region-1,test-region-2], and the full scenario-92 Playwright suite goes 20/20 (region depends_on provider + generate-config now pass; RBAC viewer→403, CSRF→401, apply→200 all green).🤖 Generated with Claude Code