test(e2e): defeat template-filter pollution in the bundle_init wizard - #2123
Draft
rugpanov wants to merge 2 commits into
Draft
test(e2e): defeat template-filter pollution in the bundle_init wizard#2123rugpanov wants to merge 2 commits into
rugpanov wants to merge 2 commits into
Conversation
## Why `bundle_init :: should initialize new project` still flakes on the Windows shard with "Can't complete cli bundle init wizard" (its two follow-on tests then cascade), despite #2034 gating the first keystroke on tab-readiness. Two races remain: keystrokes can land before the editor terminal holds keyboard focus, and — per BundleInitWizard.bundleInitInTerminal — the Python extension can inject env-setup text into the freshly opened terminal that lands in the template *search filter*, so the typed "default-python" appends to that text, matches no template, and the wizard stalls until the 40s completion loop times out. ## What - Move keyboard focus into the editor-hosted terminal (`workbench.action.terminal.focus`) before typing, so wizard keystrokes aren't swallowed by the editor-tab chrome. - Clear the template search filter with a burst of Backspace keys before typing the template name (a no-op when the filter is empty), removing any injected env-setup text so the name matches. - The completion loop and the ground-truth workspace-root gate are unchanged. Test-only: no production code, settings, persisted state, telemetry, or when-clause flags. Nothing changes for shards that never hit the races. ## Verification - `tsc -p src/test/e2e/tsconfig.json`: no new errors (the sole error is the pre-existing `assert {type: "json"}` in `wdio.conf.ts`, untouched here). - `eslint` + `prettier -c` clean on the touched file. - e2e-only behavior verified via isolated CI runs of `bundle_init` on the branch (repeated, since one green run != stable). Co-authored-by: Isaac
rugpanov
requested a deployment
to
test-trigger-is
August 14, 2026 20:07 — with
GitHub Actions
Queued
Contributor
Author
|
🤖 Integration tests triggered for |
## Why
Review (Codex + a devil's-advocate pass) flagged two robustness gaps in the
first commit: a 50-backspace burst can leave a prefix when the Python
extension injects a long activation line (a Windows venv/conda activate with
an absolute path exceeds 50 chars), and the terminal-focus callback didn't
return the command, so `executeWorkbench` resolved before focus completed and
relied on the trailing sleep alone.
## What
- Over-provision the filter clear to 200 backspaces. Backspacing an empty
filter is a no-op, so a larger count only adds safety margin for long
injected lines; it can't corrupt a clean run.
- Return `executeCommand` from the focus callback so `executeWorkbench` awaits
focus completing before the keystrokes are sent.
- Trim the filter-clear comment so it no longer restates the block above it.
Still test-only: no production code, settings, state, telemetry, or
when-clause flags.
## Verification
- `tsc -p src/test/e2e/tsconfig.json`: no new errors (only the pre-existing
`assert {type: "json"}` in `wdio.conf.ts`).
- `eslint` + `prettier -c` clean on the touched file.
Co-authored-by: Isaac
Contributor
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
rugpanov
requested a deployment
to
test-trigger-is
August 14, 2026 20:16 — with
GitHub Actions
Queued
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
bundle_init :: should initialize new projectstill flakes on the Windows shard with "Can't complete cli bundle init wizard" (its two follow-on tests then cascade), despite #2034 gating the first keystroke on tab readiness. Two races remain:BundleInitWizard.bundleInitInTerminal(see its own comment), the Python extension can inject env-setup text into the freshly opened terminal, and that text lands in the wizard's template search filter. The typeddefault-pythonthen appends to that text, matches no template, and the wizard stalls until the 40s completion loop times out.The terminal buffer isn't reliably readable via the wdio API on this editor-hosted terminal, so the fix hardens the input path rather than reading state back.
What
workbench.action.terminal.focus) after the tab is active and before typing, so wizard keystrokes aren't swallowed by the editor-tab chrome.Backspacekeys before typing the template name — a no-op when the filter is already empty, and it removes any injected env-setup text sodefault-pythonmatches.Test-only: no production code, settings, persisted state, telemetry, or when-clause flags. Nothing changes for shards that never hit the races.
Verification
tsc -p src/test/e2e/tsconfig.json: no new errors (the sole error is the pre-existingassert {type: "json"}inwdio.conf.ts, untouched here).eslint+prettier -c: clean on the touched file.bundle_initon this branch (repeated, since one green run ≠ stable).This pull request and its description were written by Isaac.