Skip to content

Commit bf3afe1

Browse files
cliffhallclaude
andcommitted
Extensions: reconverge advertisedExtensions to no-override on default (review)
Address Phase 2 review observation #1: toggling an extension back to its registry default now deletes the override key (and drops the whole map to undefined when it empties), so the on-disk `advertisedExtensions` reconverges to the byte-stable "no override" state instead of persisting a redundant `{ key: <default> }`. Matches the omit-when-default policy the other settings use. Only a value that differs from the default is persisted. Adds a modal test asserting the reconvergence (re-checking the sole disabling override drops advertisedExtensions to undefined). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5
1 parent c8eb4c9 commit bf3afe1

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

‎clients/web/src/components/groups/ServerSettingsModal/ServerSettingsModal.test.tsx‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,36 @@ describe("ServerSettingsModal", () => {
189189
);
190190
});
191191

192+
it("reconverges to no override when an extension toggle returns to its default (#1739)", async () => {
193+
const user = userEvent.setup();
194+
const onSettingsChange = vi.fn();
195+
renderWithMantine(
196+
<ServerSettingsModal
197+
opened
198+
// Start from a disabling override so re-checking Tasks returns it to the
199+
// registry default (advertised) and should drop the key entirely.
200+
settings={{
201+
...emptySettings,
202+
advertisedExtensions: { "io.modelcontextprotocol/tasks": false },
203+
}}
204+
serverType="streamable-http"
205+
isStdio={false}
206+
onClose={vi.fn()}
207+
onSettingsChange={onSettingsChange}
208+
/>,
209+
);
210+
await user.click(
211+
screen.getByRole("checkbox", {
212+
name: /Tasks \(io\.modelcontextprotocol\/tasks\)/,
213+
}),
214+
);
215+
// The only override returned to its default → the whole map drops to
216+
// undefined (no-override), keeping the on-disk round-trip minimal.
217+
expect(onSettingsChange).toHaveBeenCalledWith(
218+
expect.objectContaining({ advertisedExtensions: undefined }),
219+
);
220+
});
221+
192222
it("hides the modern log-level control when this server negotiated legacy under 'auto' (#1629)", () => {
193223
renderWithMantine(
194224
<ServerSettingsModal

‎clients/web/src/components/groups/ServerSettingsModal/ServerSettingsModal.tsx‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
ServerType,
1010
} from "@inspector/core/mcp/types.js";
1111
import { isOAuthCapableServerType } from "@inspector/core/mcp/config.js";
12+
import { ADVERTISABLE_EXTENSIONS } from "@inspector/core/mcp/extensions.js";
1213
import { ListToggle } from "../../elements/ListToggle/ListToggle";
1314
import {
1415
ServerSettingsForm,
@@ -177,12 +178,20 @@ export function ServerSettingsModal({
177178
}
178179

179180
function handleAdvertisedExtensionChange(key: string, checked: boolean) {
181+
const next = { ...settings.advertisedExtensions };
182+
const ext = ADVERTISABLE_EXTENSIONS.find((e) => e.key === key);
183+
// Reconverge to "no override" when the toggle returns to the registry
184+
// default, so the on-disk map (and its byte-stable round-trip) stays minimal
185+
// — matching the omit-when-default policy used for the other settings. Only
186+
// a value that actually differs from the default is persisted.
187+
if (ext && checked === ext.defaultAdvertised) {
188+
delete next[key];
189+
} else {
190+
next[key] = checked;
191+
}
180192
onSettingsChange({
181193
...settings,
182-
advertisedExtensions: {
183-
...settings.advertisedExtensions,
184-
[key]: checked,
185-
},
194+
advertisedExtensions: Object.keys(next).length > 0 ? next : undefined,
186195
});
187196
}
188197

0 commit comments

Comments
 (0)