microsoft / microsoft/vscode

Testing: automatic result eviction leaves extension-host run trackers retained

Open
#336,408 0 comments 0 reactions 1 assignee Claimed by @connor4312 View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

### Problem

Automatic eviction at the test-result history limit disposes the renderer-side result but does not notify the extension host to release the corresponding test-run tracker.

This is a remaining ownership path after #333244: that change disposes the result-specific store, while the ordinary eviction branch still does not emit the existing `removed` result event.

### Reproduction

In the existing `Workbench - Test Results Service` test fixture:

1. Push a `TestLiveTestResult` and mark it complete.
2. Subscribe to `results.onResultsChanged`, collecting events with a `removed` field.
3. Push and complete another 128 distinct results.
4. Check that the original result is disposed and absent from `results.results`, and that the retained list has 128 entries.
5. Check that exactly one removal notification contains the original result.

On the inspected source, step 4 succeeds but step 5 fails: the ordinary eviction path never emits the removal notification. A proposed PR adds this regression to the existing suite, together with immediately-evicted and active-result cases.

### Source path

- `src/vs/workbench/contrib/testing/common/testResultService.ts`: `push()` calls `_resultsDisposables.deleteAndDispose(removed)` without firing `changeResultEmitter` with `{ removed: [removed] }`.
- `src/vs/workbench/api/browser/mainThreadTesting.ts`: the `removed` event is the path that forwards `$disposeRun` to the extension host.
- `src/vs/workbench/api/common/extHostTesting.ts`: the coordinator consequently retains the tracker in its request and run-ID maps after ordinary history eviction.

Explicit result clearing already emits a removal notification; the reproduction concerns automatic history eviction.

### Expected behavior

Notify consumers when history eviction removes a result, and eventually release its extension-host tracker. If the evicted tracker still has genuine running tasks, cleanup should wait for those tasks to end rather than synthesize completion or cancel them. Repeated removal requests and later grouped tasks should remain safe.

### Evidence and limits

Observed with VS Code 1.137.0 on macOS arm64. A 129-run probe found 129 corresponding extension-host trackers while renderer history retained 128 results. Those captures were taken at different times, so they are supporting observations, not a settled heap measurement or an exact leaked-byte claim. The deterministic notification regression and source ownership path establish the missing cleanup signal.

Source inspected: `6a932e0f957fb194b0ffa81b8bb51080aa274147`; the proposed patch has passed the two complete relevant browser suites (50 tests), lint, client transpilation, and client typechecking on that revision. This report does not claim complete-application memory bounds. Controller-unregistration cleanup is a separate concern.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.