Skip to content

feat(settings): dynamic thinking effort experimental toggle (DTE-1) - #36

Closed
easonLiangWorldedtech wants to merge 1 commit into
mainfrom
feat/dte-v2-1-dynamic-thinking-effort
Closed

feat(settings): dynamic thinking effort experimental toggle (DTE-1)#36
easonLiangWorldedtech wants to merge 1 commit into
mainfrom
feat/dte-v2-1-dynamic-thinking-effort

Conversation

@easonLiangWorldedtech

@easonLiangWorldedtech easonLiangWorldedtech commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Part of the DTE-v2 stack; this PR: adds the dynamicThinkingEffort experimental toggle (DTE-1) — the experiment flag in packages/types, its registration in the extension experiment registry (src/shared/experiments.ts), the localized Experimental Settings display, and the accompanying tests. First unit of the series and the pipeline validator for the v2 workflow.

Stack: base = main (U1 is the first unit of the DTE-v2 stack; no lower PRs). Standalone diff vs that base:
211 additions + 6 deletions = 217 lines (≤400 budget). (measured with git diff --shortstat ca8a22f1204c8dcfcc4751ebe82bb5b7318ef53f HEAD)

Related issue: #35 (DTE-v2 series tracking)

Out of scope: the remaining DTE-v2 units (U2+): provider plumbing for the thinking-effort selection, the persisted user setting round-trip, and provider-specific behavior. This unit only introduces the experimental flag, its registry entry, the localized display, and the tests.

Pre-submission checklist:

  • CI locally: pnpm check-types (11/11), targeted vitest (packages/types 3/3, src 11/11, webview-ui 5/5), eslint --prune-suppressions (suppression counts unchanged for every touched file)
  • i18n: 18 locales (17 non-en + en) in webview-ui/src/i18n/locales/*/settings.json + node scripts/find-missing-translations.js clean
  • Tests accompany all changed lines (local §5.1 mutation gate run, see note below)
  • Visual baselines: none — no new production UI code in this unit; the flag renders through the existing generic ExperimentalSettings mechanism (asserted by the spec)
  • Line budget measured vs stack base (number above)

Binary files in this PR: none

Verification (local, worktree wt-dte-v2-1, base main = ca8a22f1204c8dcfcc4751ebe82bb5b7318ef53f):

  • pnpm check-types → 11/11 green
  • vitest: packages/types 3/3; src 11/11; webview-ui 5/5
  • pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 src/shared/experiments.ts src/shared/__tests__/experiments.spec.ts → exit 0, suppression counts unchanged
  • node scripts/find-missing-translations.js → clean
  • 3-way fidelity vs union 27a2e97df: the 5 non-locale files byte-identical to the union; the 18 locale files carry exactly the spec'd key inserts
  • git diff --shortstat ca8a22f1204c8dcfcc4751ebe82bb5b7318ef53f HEAD → 25 files, 211+ / 6− = 217 lines
  • Mutation gate: node scripts/stryker-diff.mjs ci --base ca8a22f1204c8dcfcc4751ebe82bb5b7318ef53f --head 45e90ffa310c4eb984e0921149afd03941c9265b → extension: 2 valid / 2 killed / 0 survived / 0 no-coverage → Passed (~7.6 min / 459 s, local, stock Stryker 10.0.0). The final head 19788c031667fc1e367511fb9026607652e0f9cb adds only scripts/stryker-diff.test.mjs (the gate's unit test, outside the mutation manifest); the src diff is byte-identical.

Mutation gate note: Stryker upstream defect workaround

This PR switches the extension entry of scripts/stryker-diff.mjs to the vitest
plugin's related-discovery mode (vitestRelated: true, discoverRelatedTests: false,
so STRYKER_TEST_FILES stays empty) instead of the default explicit-test-file mode.
The gate's unit tests (scripts/stryker-diff.test.mjs, buildManifest case) are updated
to assert the new extension-entry values (vitestRelated: true, discoverRelatedTests: false).

Why: with @stryker-mutator/core@10.0.0 + @stryker-mutator/vitest-runner@10.0.0,
passing an explicit test-file list makes the mutant-test planner label static mutants
(module-scope code — here: the new experiment-flag constants in src/shared/experiments.ts)
as mutantActivation: 'runtime' (mutant-test-planner.js:
mutantActivation: testFilter ? 'runtime' : 'static'), while the vitest plugin activates
static mutants only in beforeAll — after top-level code has already been evaluated.
Result: systematic false Survived for static code — both mutants on
src/shared/experiments.ts:29 (BooleanLiteral→true, ObjectLiteral→{}) survived
despite shared/__tests__/experiments.spec.ts asserting the exact replaced values.
With no test-file list the planner plans 'static' activation, the same mutants are
Killed (91 related test files executed; killed by the spec's
experimentConfigsMap.DYNAMIC_THINKING_EFFORT assertion), and the gate is green
(verified locally on stock 10.0.0, no patched modules).

Upstream tracking:

Revert condition: once the upstream fix lands and the Stryker version is bumped, the
extension entry can revert to vitestRelated: false / discoverRelatedTests: true
(the faster, narrowly targeted mode). The webview entry keeps that mode here (this unit
mutates no webview source); it carries the same latent exposure and should be switched in
the same follow-up.

Local-run note: an interrupted local gate run can leak Stryker's temp sandbox (<package>/.stryker-tmp/), which the pre-commit hook's full pnpm lint then flags with spurious errors (cleanup is skipped on hard kills despite cleanTempDir: "always"); clean runs remove it. Tracked in Zoo-Code-Org#1514.

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner Author

Superseded by upstream PR Zoo-Code-Org#1521 (DTE-v2 stack moved upstream — CodeRabbit only runs there). Same head 19788c0, same content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants