refactor(setup): take the platform in client configuration readers and the setup write path (#11120)

* refactor(setup): take the platform in client configuration readers and the setup write path

ClientRegistrationEnvironment, ClientConfigurationFiles and SupportedClients take a required platform (before defaulted parameters). Setup's configure, inspect and alignment entry points take the setup host's platform and pass it through every layer read, ownership check and the Cordis serializer, which now aliases Windows environment names by the selected platform instead of the running host. Host file operations in ClientConfigPath, ClientConfigurationPublication, JsonFiles and rea mcp add read HOST_PLATFORM explicitly.

* fix(setup): keep private-profile modes on the host when setup selects another platform
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 21:31:35 +08:00
1 parent bb445d8691
commit 3e4e178ccc
37 files changed
+548 -212

No files matched your search

@@ -99,16 +99,16 @@ const expressionSettings = (
export const clientRegistrationEnvironment = (
parsed: ClientConfigurationDocument | undefined,
client: Pick<SetupClient, "name" | "registrationProfile"> | undefined,
platform: NodeJS.Platform,
overrides: Readonly<Record<string, string>> = {},
validation: "fragment" | "effective" = "effective",
platform: NodeJS.Platform = process.platform,
): Result<Readonly<Record<string, string>>, ConfigurationError> => {
const details = clientRegistrationEnvironmentDetails(
parsed,
client,
platform,
overrides,
validation,
platform,
);
return details.ok ? ok(details.value.values) : details;
};
@@ -117,9 +117,9 @@ export const clientRegistrationEnvironment = (
export const clientRegistrationEnvironmentDetails = (
parsed: ClientConfigurationDocument | undefined,
client: Pick<SetupClient, "name" | "registrationProfile"> | undefined,
platform: NodeJS.Platform,
overrides: Readonly<Record<string, string>> = {},
validation: "fragment" | "effective" = "effective",
platform: NodeJS.Platform = process.platform,
): Result<ClientRegistrationEnvironmentDetails, ConfigurationError> => {
if (parsed?.dialect === "dsh") {
const environment = dshDocument(parsed.document).environment(
@@ -207,7 +207,7 @@ export const recordedProviderSettings = (
parsed: ClientConfigurationDocument,
client: Pick<SetupClient, "name" | "registrationProfile"> | undefined,
selected: Readonly<Record<string, string>>,
platform: NodeJS.Platform = process.platform,
platform: NodeJS.Platform,
owns?: OwnedProviderSetting,
observe?: ProviderSettingObserver,
): RecordedProviderSettings | undefined => {
@@ -219,9 +219,9 @@ export const recordedProviderSettings = (
const details = clientRegistrationEnvironmentDetails(
parsed,
client,
platform,
{},
"fragment",
platform,
);
if (!details.ok) return { unrecorded: [], differing: [], unresolved: names };
const recorded = snapshotEnvironment(details.value.values, platform);
@@ -273,16 +273,16 @@ export const clientRegistrationEnvironmentDetailsWithBudget = async (
overrides: Readonly<Record<string, string>>,
validation: "fragment" | "effective",
resolveProviderRequestBudget: ProviderRequestBudgetResolver | undefined,
platform: NodeJS.Platform = process.platform,
platform: NodeJS.Platform,
): Promise<
Result<ResolvedClientRegistrationEnvironmentDetails, ConfigurationError>
> => {
const details = clientRegistrationEnvironmentDetails(
parsed,
client,
platform,
overrides,
validation,
platform,
);
if (!details.ok) return details;
const unresolved = [...details.value.unresolvedSettings].filter(