Skip to content

Commit 4820a6f

Browse files
committed
polish settings warn wording and drop redundant cast
1 parent e3ab7c6 commit 4820a6f

2 files changed

Lines changed: 29 additions & 19 deletions

File tree

‎src/config/settings.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,15 @@ test("settings load warns and still loads when a provider carries ignored fields
711711
expect(loaded).not.toBeNull();
712712
expect(loaded?.providers.external).toBeDefined();
713713
expect(stderr.output()).toContain(
714-
'"external" sets fields that are not honored by Corbits and are ignored',
714+
'"external" sets fields that are not honored by Corbits and will be ignored',
715715
);
716716
expect(stderr.output()).toContain("supportsThinkingTokenBudget");
717717
expect(stderr.output()).toContain("thinkingLevelMap");
718718
expect(stderr.output()).toContain("samplingParams");
719-
expect(stderr.output()).toContain("compat.supportsReasoningEffort");
719+
expect(stderr.output()).toContain("compat → supportsReasoningEffort");
720+
expect(stderr.output()).toContain(
721+
"These fields are not yet supported; configure effort/thinking via provider/model-level settings.",
722+
);
720723
} finally {
721724
stderr.restore();
722725
await rm(cwd, { recursive: true, force: true });
@@ -750,8 +753,8 @@ test("settings load does not warn for a normal provider block", async () => {
750753
}
751754
});
752755

753-
// CL-10226 (Part 1): the same warn must surface on the config path (--config /
754-
// global settings), which routes through loadSettings... → normalizeParsedSettings.
756+
// The same warn must surface on the config path (--config / global settings),
757+
// which routes through loadSettings... → normalizeParsedSettings.
755758
test("loadConfig warns and still loads when a provider carries ignored fields", async () => {
756759
const cwd = await mkdtemp(join(tmpdir(), "ic-unit-config-ignored-config-"));
757760
const globalSettingsPath = join(cwd, "global.json");

‎src/config/settings.ts‎

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,21 +1039,28 @@ function settingsSchemaError(path: string): Error {
10391039
// Provider blocks from some external tools carry fields Corbits does not
10401040
// honor: compat.supportsReasoningEffort, supportsThinkingTokenBudget,
10411041
// thinkingLevelMap, samplingParams. ProviderSettingsSchema does not reject
1042-
// unknown keys, so they pass validation and are silently dropped. Warn so the
1043-
// ignore is never silent. CL-10226 (Part 1): field mappings are a separate
1044-
// follow-up — this only surfaces the warn.
1042+
// unknown keys, so they pass validation and are silently dropped. Warn when
1043+
// any are present so the ignore is never silent.
10451044
const IGNORED_PROVIDER_FIELDS: {
1046-
key: string;
1045+
display: string;
10471046
path: (p: Record<string, unknown>) => unknown;
10481047
}[] = [
10491048
{
1050-
key: "supportsThinkingTokenBudget",
1049+
display: "supportsThinkingTokenBudget",
10511050
path: (p) => p.supportsThinkingTokenBudget,
10521051
},
1053-
{ key: "thinkingLevelMap", path: (p) => p.thinkingLevelMap },
1054-
{ key: "samplingParams", path: (p) => p.samplingParams },
10551052
{
1056-
key: "compat.supportsReasoningEffort",
1053+
display: "thinkingLevelMap",
1054+
path: (p) => p.thinkingLevelMap,
1055+
},
1056+
{
1057+
display: "samplingParams",
1058+
path: (p) => p.samplingParams,
1059+
},
1060+
{
1061+
// Rendered as the nested arrow form so it is not mistaken for a bare
1062+
// provider-level key (the JSON nests it under the provider's "compat").
1063+
display: "compat → supportsReasoningEffort",
10571064
path: (p) => {
10581065
const compat = p.compat as Record<string, unknown> | undefined;
10591066
return compat?.supportsReasoningEffort;
@@ -1062,15 +1069,17 @@ const IGNORED_PROVIDER_FIELDS: {
10621069
];
10631070

10641071
function warnOnIgnoredProviderFields(
1065-
providers: Record<string, Record<string, unknown>>,
1072+
path: string,
1073+
providers: Record<string, ProviderSettings>,
10661074
): void {
10671075
for (const [name, provider] of Object.entries(providers)) {
1076+
const p = provider as unknown as Record<string, unknown>;
10681077
const present = IGNORED_PROVIDER_FIELDS.filter(
1069-
(field) => field.path(provider) !== undefined,
1070-
).map((field) => field.key);
1078+
(field) => field.path(p) !== undefined,
1079+
).map((field) => field.display);
10711080
if (present.length > 0) {
10721081
process.stderr.write(
1073-
`settings: provider "${name}" sets fields that are not honored by Corbits and are ignored: ${present.join(", ")}. These will not be applied.\n`,
1082+
`settings: ${path}: provider "${name}" sets fields that are not honored by Corbits and will be ignored: ${present.join(", ")}. These fields are not yet supported; configure effort/thinking via provider/model-level settings.\n`,
10741083
);
10751084
}
10761085
}
@@ -1081,9 +1090,7 @@ function normalizeParsedSettings(path: string, parsed: unknown): Settings {
10811090
throw settingsSchemaError(path);
10821091
}
10831092
const s = parsed as unknown as Record<string, unknown>;
1084-
warnOnIgnoredProviderFields(
1085-
s.providers as Record<string, Record<string, unknown>>,
1086-
);
1093+
warnOnIgnoredProviderFields(path, parsed.providers);
10871094
// These keys were removed when plugins moved to discovery; they are now
10881095
// silently dropped on the next save. Warn so a user who relied on them knows
10891096
// to re-enable the equivalent plugins in /plugins instead of losing the

0 commit comments

Comments
 (0)