Skip to content

Commit c48ac56

Browse files
test(dte): make the saved-false projection answer a real edit, and stop promising an in-chat control
The description of settings.experimental.DYNAMIC_THINKING_EFFORT promised a manual in-chat control that this PR does not ship. The second sentence is dropped from every locale file that carries the key (all 18), so the copy fix is locale-complete: the first sentence and the (experimental) tag stay. check-translations runs node scripts/find-missing-translations.js, which checks key parity rather than prose, and that script exits 0 in this tree with these files in place. ClineProvider.spec.ts: the saved-false getStateToPostToWebview test now stores a second enabled experiment next to the false flag, so a projection that fell back to experimentDefault whenever the flag was false can no longer pass while discarding an enabled experiment. SettingsView.spec.tsx: the toggle test asserts that no updateSettings message reaches the extension host before Save, and a new test hydrates an explicit false and edits a different experiment, so the save payload has to carry the hydrated false back. Gate accounting: packageForPath() in scripts/stryker-diff.mjs returns null for webview-ui/src/i18n/locales/en/settings.json (a .json path) and for every path in this commit that is a test file, so the mutation-diff leg charges 0 changed lines for it, even though executableChangedLines() counts 957 executable lines in the en locale file alone (of 1,127 total). A null package cancels that leg; it does not make these paths green. This answers the copy ask. It does not implement the control: implementing the in-chat control is the charged route (webview-ui/**/*.tsx maps to the webview package), which is the route the blocker accounting priced. Copy here is documentation, not the control.
1 parent dadac92 commit c48ac56

20 files changed

Lines changed: 68 additions & 19 deletions

File tree

‎src/core/webview/__tests__/ClineProvider.spec.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4213,14 +4213,23 @@ describe("ClineProvider", () => {
42134213

42144214
test("getStateToPostToWebview returns the saved dynamicThinkingEffort experiment when explicitly disabled", async () => {
42154215
await provider.resolveWebviewView(mockWebviewView)
4216+
// A second experiment is enabled on purpose: a projection that fell back to
4217+
// experimentDefault whenever the flag was false would still satisfy a
4218+
// fixture-equals-default assertion, and it would discard this enabled
4219+
// experiment on the way.
42164220
await provider.contextProxy.setValue("experiments", {
42174221
...experimentDefault,
4222+
preventFocusDisruption: true,
42184223
dynamicThinkingEffort: false,
42194224
})
42204225

42214226
const state = await provider.getStateToPostToWebview()
42224227

4223-
expect(state.experiments).toEqual({ ...experimentDefault, dynamicThinkingEffort: false })
4228+
expect(state.experiments).toEqual({
4229+
...experimentDefault,
4230+
preventFocusDisruption: true,
4231+
dynamicThinkingEffort: false,
4232+
})
42244233
})
42254234

42264235
test("getStateToPostToWebview defaults dynamicThinkingEffort to false when experiments are unset", async () => {

‎webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,9 @@ describe("SettingsView - Experimental Settings", () => {
893893
const checkbox = within(label).getByRole("checkbox")
894894
expect(checkbox).not.toBeChecked()
895895
fireEvent.click(checkbox)
896+
// The toggle only buffers the edit in cachedState. Nothing may reach the
897+
// extension host before Save, or a discarded edit would persist.
898+
expect(vscode.postMessage).not.toHaveBeenCalledWith(expect.objectContaining({ type: "updateSettings" }))
896899
fireEvent.click(screen.getByTestId("save-button"))
897900
expect(vscode.postMessage).toHaveBeenCalledWith(
898901
expect.objectContaining({
@@ -925,6 +928,43 @@ describe("SettingsView - Experimental Settings", () => {
925928
}),
926929
)
927930
})
931+
932+
// The false case has to survive being loaded, not only being toggled: an
933+
// explicit hydrated false must come back unchanged in the payload when the
934+
// edit the user actually made is a different experiment.
935+
it("keeps a hydrated false dynamicThinkingEffort in the payload when another experiment is edited", () => {
936+
const { activateTab, getSettingsContent } = renderSettingsView({
937+
experiments: { ...experimentDefault, dynamicThinkingEffort: false },
938+
})
939+
activateTab("experimental")
940+
const content = getSettingsContent()
941+
const effortLabel = within(content)
942+
.getByText("settings:experimental.DYNAMIC_THINKING_EFFORT.name")
943+
.closest("label")!
944+
const effortCheckbox = within(effortLabel).getByRole("checkbox")
945+
expect(effortCheckbox).not.toBeChecked()
946+
947+
const focusLabel = within(content)
948+
.getByText("settings:experimental.PREVENT_FOCUS_DISRUPTION.name")
949+
.closest("label")!
950+
const focusCheckbox = within(focusLabel).getByRole("checkbox")
951+
expect(focusCheckbox).not.toBeChecked()
952+
fireEvent.click(focusCheckbox)
953+
expect(focusCheckbox).toBeChecked()
954+
955+
fireEvent.click(screen.getByTestId("save-button"))
956+
expect(vscode.postMessage).toHaveBeenCalledWith(
957+
expect.objectContaining({
958+
type: "updateSettings",
959+
updatedSettings: expect.objectContaining({
960+
experiments: expect.objectContaining({
961+
dynamicThinkingEffort: false,
962+
preventFocusDisruption: true,
963+
}),
964+
}),
965+
}),
966+
)
967+
})
928968
})
929969

930970
describe("SettingsView - Blanket Auto-Deny", () => {

‎webview-ui/src/i18n/locales/ca/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/de/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/en/settings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@
993993
},
994994
"DYNAMIC_THINKING_EFFORT": {
995995
"name": "Dynamic thinking effort",
996-
"description": "Prepares the set_thinking_effort tool for later support: this setting stores the preference only, and the tool's per-request behavior arrives in follow-up work. The manual in-chat control is always available. (experimental)"
996+
"description": "Prepares the set_thinking_effort tool for later support: this setting stores the preference only, and the tool's per-request behavior arrives in follow-up work. (experimental)"
997997
}
998998
},
999999
"temperature": {

‎webview-ui/src/i18n/locales/es/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/fr/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/hi/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/id/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webview-ui/src/i18n/locales/it/settings.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)