|
9 | 9 | "os/exec" |
10 | 10 | "path/filepath" |
11 | 11 | "regexp" |
| 12 | + "slices" |
12 | 13 | "sort" |
13 | 14 | "strings" |
14 | 15 | "sync" |
@@ -1090,6 +1091,14 @@ func checkConfigurationSources(ctx context.Context, ws *resources.Workspace, env |
1090 | 1091 | if provided != nil { |
1091 | 1092 | declared := ownConfigurationNames(wsCfgDir) |
1092 | 1093 | byName, own, composed := classifyProvidedConfigurations(provided, declared) |
| 1094 | + // Doctor has no selected runtime. Report native-only supply as a warning, |
| 1095 | + // and exempt no other service that also requires the authored group. |
| 1096 | + if byName[environments.FederationConfiguration] == nil && provided.Ambiguous[environments.FederationConfiguration] == nil && |
| 1097 | + nativeFederationCoversScope(env, scope) { |
| 1098 | + required = slices.DeleteFunc(required, func(name string) bool { return name == environments.FederationConfiguration }) |
| 1099 | + report.add("", "workspace configuration federation", "warn", |
| 1100 | + "derived from host for the native delivery service; container runs and deployments still require authored federation values", "") |
| 1101 | + } |
1093 | 1102 | reportWorkspaceConfigurationDirectory(wsCfgDir, relCfgDir, required, byName, own, report) |
1094 | 1103 | if len(composed) > 0 { |
1095 | 1104 | report.add("", "composed module configurations", "ok", |
@@ -1117,6 +1126,26 @@ func checkConfigurationSources(ctx context.Context, ws *resources.Workspace, env |
1117 | 1126 | return append(toResolve, checkServiceConfigurationSources(ctx, env, profiles, profile, scope, report)...), provided |
1118 | 1127 | } |
1119 | 1128 |
|
| 1129 | +// nativeFederationCoversScope requires every declaring consumer to be the |
| 1130 | +// delivery host. A generated host group never satisfies a sibling's requirement. |
| 1131 | +func nativeFederationCoversScope(env *environments.Environment, scope []*resources.Service) bool { |
| 1132 | + if env == nil || env.DeclaresLocalK3d() { |
| 1133 | + return false |
| 1134 | + } |
| 1135 | + found := false |
| 1136 | + for _, service := range scope { |
| 1137 | + if !slices.Contains(service.WorkspaceConfigurationDependencies, environments.FederationConfiguration) { |
| 1138 | + continue |
| 1139 | + } |
| 1140 | + group, err := environments.NativeHostFederation(env.Host, service) |
| 1141 | + if err != nil || group == nil { |
| 1142 | + return false |
| 1143 | + } |
| 1144 | + found = true |
| 1145 | + } |
| 1146 | + return found |
| 1147 | +} |
| 1148 | + |
1120 | 1149 | // reportWorkspaceConfigurationDirectory reports the workspace's own |
1121 | 1150 | // configuration directory. Only what nobody provides — a name no module |
1122 | 1151 | // ships, or one two modules disagree on — is what the directory would have to |
|
0 commit comments