Skip to content

Commit b2b31f7

Browse files
refactor(dte): drop the U5 reasoning pair and the duplicated U1 surface
This PR's scope is the transient task-local thinking effort on Task.ts, its per-request delivery at the four createMessage sites, the profile-switch re-capture, and the tests for that behaviour. Two groups of changes here belong to sibling units and are removed. src/api/transform/reasoning.ts gained the adaptive-envelope effort set and the shared effective-effort resolver, together with the spec that covers only those two exports. They belong to the adaptive-envelope unit, whose own branch carries the same pair. Nothing in this unit's code reads them - the only importer in the tree is the pair's own spec - so removing both leaves Task.ts, the metadata field in src/api/index.ts and the task tests untouched. The eighteen webview-ui/src/i18n/locales/*/settings.json additions, the experimental-settings gallery entry in webview-ui/playwright/gallery/stories.tsx, the ExperimentalSettings visual story and fixture, and the four experimental-settings baselines are the dynamic-thinking-effort setting surface the dynamic-thinking-effort unit already ships. This unit does not render that control: its ExperimentalSettings case asserts the toggle stays hidden, and it asserts on translation keys rather than translated strings, so dropping the copies cannot change what it proves. The locale-loading awaits come out with them. The await loadLanguage calls existed because the eighteen new setting keys moved the Korean bundle out of the eager entry chunk and the spec's timing assertions started racing that fetch; with the keys gone the calls are no longer needed. Measured on this tree: with the awaits the spec passes 3/3 with CI=true, without them it passes 8/8 with CI=true and 4/4 with CI unset, and neither variant logs a "not wrapped in act(...)" warning, so the change is dropped instead of restructured. Tests: core/task/__tests__/Task.runtime-thinking-effort.test.ts, core/webview/__tests__ ClineProvider.spec.ts and webviewMessageHandler.spec.ts and shared/__tests__/experiments.spec.ts pass together (4 files, 466 tests); the webview-ui i18n suites and ExperimentalSettings pass (5 files, 18 tests) and the SettingsView suites pass (3 files, 53 tests). tsc --noEmit is clean for both src and webview-ui.
1 parent b1d2d58 commit b2b31f7

28 files changed

Lines changed: 0 additions & 248 deletions

‎src/api/transform/__tests__/dte-effective-reasoning-effort.spec.ts‎

Lines changed: 0 additions & 58 deletions
This file was deleted.

‎src/api/transform/reasoning.ts‎

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,53 +33,6 @@ export type AnthropicProviderReasoningParams =
3333

3434
export type OpenAiReasoningParams = { reasoning_effort: OpenAI.Chat.ChatCompletionCreateParams["reasoning_effort"] }
3535

36-
/**
37-
* DTE series 2/5 — effort levels accepted by the Claude 4.7+ adaptive-thinking
38-
* `output_config.effort` envelope. Efforts outside this set (e.g. "none",
39-
* "minimal", "disable") omit the envelope so the API applies its own default.
40-
* @internal Exported for focused implementation tests.
41-
*/
42-
export const ADAPTIVE_OUTPUT_CONFIG_EFFORTS: readonly ReasoningEffortExtended[] = [
43-
"low",
44-
"medium",
45-
"high",
46-
"xhigh",
47-
"max",
48-
]
49-
50-
/**
51-
* DTE series 2/5 — resolves the effective thinking effort for a single request.
52-
*
53-
* Resolution order (strongest first):
54-
* 1. `override` — the per-request task-local effort
55-
* (`ApiHandlerCreateMessageMetadata.reasoningEffort`),
56-
* 2. `settingsReasoningEffort` — the settings-derived value,
57-
* 3. `modelDefaultEffort` — the model's default effort.
58-
*
59-
* This is the single shared resolution point for the per-request override:
60-
* providers that resolve the effective effort through it inherit the override
61-
* without duplicating precedence logic. The override is transient (next request
62-
* only) and never persisted to settings.
63-
* @internal Exported for focused implementation tests.
64-
*/
65-
export const resolveEffectiveReasoningEffort = ({
66-
override,
67-
settingsReasoningEffort,
68-
modelDefaultEffort,
69-
}: {
70-
override?: ReasoningEffortExtended
71-
settingsReasoningEffort?: ReasoningEffortExtended | "disable"
72-
modelDefaultEffort?: ReasoningEffortExtended
73-
}): ReasoningEffortExtended | "disable" | undefined => {
74-
if (override !== undefined) {
75-
return override
76-
}
77-
if (settingsReasoningEffort !== undefined) {
78-
return settingsReasoningEffort
79-
}
80-
return modelDefaultEffort
81-
}
82-
8336
// Valid Gemini thinking levels for effort-based reasoning
8437
const GEMINI_THINKING_LEVELS = ["minimal", "low", "medium", "high"] as const
8538

‎webview-ui/playwright/gallery/stories.tsx‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,6 @@ export const stories: Record<string, Story> = {
419419
const { UISettingsStory } = await import("@/components/settings/__tests__/UISettings.visual.fixture")
420420
return <UISettingsStory />
421421
},
422-
"experimental-settings": async () => {
423-
const { ExperimentalSettingsStory } =
424-
await import("@/components/settings/__tests__/ExperimentalSettings.visual.fixture")
425-
return <ExperimentalSettingsStory />
426-
},
427422
"ui-settings-long-locale": async () => {
428423
const { UISettingsStory } = await import("@/components/settings/__tests__/UISettings.visual.fixture")
429424
return <UISettingsStory initialState={{ language: "ru" }} />

‎webview-ui/src/components/settings/__tests__/ExperimentalSettings.visual.fixture.tsx‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎webview-ui/src/components/settings/__tests__/ExperimentalSettings.visual.tsx‎

Lines changed: 0 additions & 12 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

‎webview-ui/src/i18n/__tests__/TranslationContext.locale-loading.spec.tsx‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ describe("TranslationProvider locale loading", () => {
4747
// through the English fallback and the switch lands after the fetch.
4848
expect(screen.getByTestId("error-title")).toHaveTextContent("Something went wrong")
4949

50-
// A locale outside the entry chunk is fetched on demand, so how long the switch
51-
// takes is a property of the machine and the load on it, not of the code under
52-
// test: on a contended runner the fetch can outlast any fixed wall-clock window,
53-
// which is what made this suite flake. Awaiting the memoized promise the provider
54-
// itself waits on - the idiom the unmount case at the end of this file uses - takes
55-
// the clock out of the assertion. What `waitFor` has left to catch is the render
56-
// that `languageChanged` triggers, which settles in the same task.
57-
await loadLanguage("ko")
58-
5950
await waitFor(() => {
6051
expect(screen.getByTestId("error-title")).toHaveTextContent("문제가 발생했습니다")
6152
})
@@ -76,9 +67,6 @@ describe("TranslationProvider locale loading", () => {
7667
)
7768
})
7869

79-
// Await the fetch instead of racing a fixed window (note in the first case).
80-
await loadLanguage("ja")
81-
8270
await waitFor(() => {
8371
expect(screen.getByTestId("error-title")).toHaveTextContent("問題が発生しました")
8472
})
@@ -96,9 +84,6 @@ describe("TranslationProvider locale loading", () => {
9684
it("keeps English available after switching away and back", async () => {
9785
const { rerender } = renderProbe("de")
9886

99-
// German is loaded on demand as well: await it rather than time it.
100-
await loadLanguage("de")
101-
10287
await waitFor(() => {
10388
expect(screen.getByTestId("error-title")).toHaveTextContent("Etwas ist schiefgelaufen")
10489
})
@@ -120,9 +105,6 @@ describe("TranslationProvider locale loading", () => {
120105
it("keeps the previous locale rendered while a warm switch is still loading", async () => {
121106
const { rerender } = renderProbe("de")
122107

123-
// The cold locale is awaited here too (see the note in the first case).
124-
await loadLanguage("de")
125-
126108
await waitFor(() => {
127109
expect(screen.getByTestId("error-title")).toHaveTextContent("Etwas ist schiefgelaufen")
128110
})
@@ -141,10 +123,6 @@ describe("TranslationProvider locale loading", () => {
141123
// resolves would paint the English fallback here instead of German.
142124
expect(screen.getByTestId("error-title")).toHaveTextContent("Etwas ist schiefgelaufen")
143125

144-
// Awaiting the fetch through the promise the provider waits on keeps the assertion
145-
// above a statement about ordering rather than about the clock.
146-
await loadLanguage("fr")
147-
148126
await waitFor(() => {
149127
expect(screen.getByTestId("error-title")).toHaveTextContent("Une erreur s'est produite")
150128
})

0 commit comments

Comments
 (0)