Keep the E2E state file bridge out of production extension builds - #19147
Keep the E2E state file bridge out of production extension builds#19147Adam Ratzman (adamint) wants to merge 1 commit into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19147Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19147" |
There was a problem hiding this comment.
Pull request overview
Prevents the E2E control bridge from shipping in production VS Code extension bundles.
Changes:
- Replaces the bridge with a production-only no-op module.
- Preserves the real bridge for development and E2E builds.
- Adds focused configuration and export compatibility tests.
Show a summary per file
| File | Description |
|---|---|
extension/webpack.config.js |
Adds production module replacement. |
extension/src/testing/e2eStateFileBridge.production.ts |
Provides the no-op production implementation. |
extension/src/test/e2eBridgeProductionGate.test.ts |
Tests build-mode gating and stub compatibility. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
`src/testing/e2eStateFileBridge.ts` is a test control channel: it registers a
wildcard debug adapter tracker and executes commands read from a file path
supplied in an environment variable. `extension.ts` imports it unconditionally
and `webpack.config.js` had no build-time gate, so the whole channel was bundled
into the published VSIX and gated only at runtime by
`ASPIRE_EXTENSION_E2E_ENABLE_BRIDGE`.
Swap the bridge for a no-op stub via `NormalModuleReplacementPlugin` when
webpack runs in production mode. `vscode:prepublish` runs `webpack --mode
production`, and `vsce package` runs `vscode:prepublish`, so every shipping path
gets the stub. `yarn compile` (mode `none`) and `yarn watch` keep the real
bridge, so the E2E runner is unaffected.
`NormalModuleReplacementPlugin` is used rather than `DefinePlugin` plus dead code
elimination because dropping the module through tree shaking would require a
`sideEffects` declaration in `package.json`.
Verified by three real webpack builds, counting bridge-only symbols in
`dist/extension.js`:
stock config, production: proveMauiResourceDebugging=1, stoppingPathEvents=1
gated config, production: proveMauiResourceDebugging=0, stoppingPathEvents=0,
getResourceDebugProofRequest=0,
clipboardExpectation=0, atomicWriteSequence=0
gated config, `yarn compile`: proveMauiResourceDebugging=3,
stoppingPathEvents=6, atomicWriteSequence=2
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e93e41a to
045f313
Compare
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Description
extension/src/testing/e2eStateFileBridge.tsis a test control channel. It registers a wildcard debug adapter tracker factory and executes commands read from a file whose path comes from an environment variable.extension.tsimports it unconditionally andwebpack.config.jshad no build-time gate, so the entire channel was bundled into the published VSIX and gated only at runtime byASPIRE_EXTENSION_E2E_ENABLE_BRIDGE.This replaces the bridge with a no-op stub in production builds using
NormalModuleReplacementPlugin, so the code is not present in the shipped bundle at all.vscode:prepublishrunswebpack --mode productionandvsce packagerunsvscode:prepublish, so every packaging path gets the stub.yarn compile(modenone) andyarn watchkeep the real bridge, so local development and the E2E runner are unaffected.NormalModuleReplacementPluginis used rather thanDefinePluginplus dead code elimination because dropping the module through tree shaking would require adding asideEffectsdeclaration topackage.json.Validation
Verified with three real webpack builds, counting bridge-only symbols in the emitted
dist/extension.js:proveMauiResourceDebuggingstoppingPathEventsatomicWriteSequence--mode productionyarn packageyarn compilegetResourceDebugProofRequestandclipboardExpectationare also 0 in the gated production bundle.From
extension/:The new unit test was negative-tested in both directions: breaking the replacement pattern and removing an export from the stub each produced a failing assertion naming the specific problem.
Checklist