Skip to content

copilot: remove leftover code from /tests test-generation codelens#318609

Merged
ulugbekna merged 1 commit into
mainfrom
ulugbekna/agents/remove-codelens-test-generation
May 27, 2026
Merged

copilot: remove leftover code from /tests test-generation codelens#318609
ulugbekna merged 1 commit into
mainfrom
ulugbekna/agents/remove-codelens-test-generation

Conversation

@ulugbekna
Copy link
Copy Markdown
Contributor

What

The "Generate tests using Copilot" codelens (and its companion testGenAction.ts) was removed in c0eaa94 (#3937), but its supporting infrastructure was left behind as dead code. This PR completes the cleanup.

Why

After c0eaa94:

  • ITestGenInfoStorage.sourceFileToTest had no writers (the deleted testGenAction.ts was the only one), so every reader took the undefined branch.
  • TreeSitterAST.getTestableNode / getTestableNodes and the underlying testableNodeQueries had no callers.
  • Three large .spec.ts files tested only the now-orphaned parser API.

Changes

Deleted files

  • extensions/copilot/src/extension/intents/node/testIntent/testInfoStorage.ts
  • extensions/copilot/src/platform/parser/test/node/getTestableNode.{js,ts}.spec.ts + getTestableNode.util.ts
  • extensions/copilot/src/platform/parser/test/node/getTestableNodes.ts.spec.ts + getTestableNodes.util.ts

Modified

  • testFromTestInvocation.tsx: dropped the testGenInfo plumbing, simplified to the always-undefined path.
  • test2Impl.tsx: dropped the unused srcFile?: ITestGenInfo prop and dead branch.
  • Parser API (parserService.ts, parserServiceImpl.ts, parserImpl.ts, testGenParsing.ts, treeSitterQueries.ts): removed unused getTestableNode / getTestableNodes / TestableNode / testableNodeQueries.
  • Service registrations (extension/services.ts, test/services.ts, simulationContext.ts): dropped ITestGenInfoStorage.

Preserved

  • The /tests slash command and its TestsIntent, TestFromSrcInvocation, TestFromTestInvocation flows.
  • _findLastTest and testInSuiteQueries — still used by testFromSrcInvocation.tsx.
  • formatRequestAndUserQuery — still used by testFromSrcInvocation.tsx.

Validation

  • npx tsgo --noEmit passes for tsconfig.json, test/simulation/workbench/tsconfig.json, and tsconfig.worker.json.
  • All 80 tests in src/platform/parser pass (vitest --run).
  • Pre-commit hygiene hook passes on the modified files.

Diff: 16 files changed, 11 insertions, 1145 deletions.

The codelens feature for /tests test generation was removed in
c0eaa94, but related infrastructure remained as dead code:

- ITestGenInfoStorage was never populated (the deleted testGenAction.ts
  was the only writer), so TestFromTestInvocation and Test2Impl always
  took the 'undefined' branch.
- IParserService.getTreeSitterAST().getTestableNode/getTestableNodes
  and the underlying testGenParsing helpers + testableNodeQueries had
  no remaining callers.

Delete the storage service, the parser API, the tree-sitter queries,
and the related tests. The /tests slash command itself is preserved;
`_findLastTest` stays since testFromSrcInvocation.tsx still uses it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 27, 2026 18:45
@ulugbekna ulugbekna enabled auto-merge (squash) May 27, 2026 18:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes leftover code from the previously deleted "Generate tests using Copilot" codelens. After the codelens was removed in c0eaa94, the supporting ITestGenInfoStorage had no writers and the parser's getTestableNode(s) / testableNodeQueries had no callers; this PR completes the cleanup while preserving the /tests slash command flow.

Changes:

  • Deletes testInfoStorage.ts and all ITestGenInfoStorage service registrations; simplifies Test2Impl and TestFromTestInvocation to the always-undefined source-file path.
  • Removes _getTestableNode / _getTestableNodes / TestableNode from the parser API (parserService.ts, parserServiceImpl.ts, parserImpl.ts, testGenParsing.ts) and drops testableNodeQueries from treeSitterQueries.ts.
  • Deletes the three orphaned getTestableNode(s) spec files and their utility helpers.
Show a summary per file
File Description
extensions/copilot/src/extension/intents/node/testIntent/testInfoStorage.ts Deleted unused storage service.
extensions/copilot/src/extension/intents/node/testIntent/testFromTestInvocation.tsx Removed dead testGenInfo plumbing and unused imports (IWorkspaceService, CodeBlock, formatRequestAndUserQuery).
extensions/copilot/src/extension/prompt/node/test2Impl.tsx Dropped unused srcFile prop and dead branch.
extensions/copilot/src/extension/extension/vscode-node/services.ts Removed ITestGenInfoStorage registration.
extensions/copilot/src/extension/test/vscode-node/services.ts Removed ITestGenInfoStorage test registration.
extensions/copilot/test/base/simulationContext.ts Removed ITestGenInfoStorage simulation registration.
extensions/copilot/src/platform/parser/node/parserService.ts Removed getTestableNode(s) API.
extensions/copilot/src/platform/parser/node/parserServiceImpl.ts Removed getTestableNode(s) wiring.
extensions/copilot/src/platform/parser/node/parserImpl.ts Stopped re-exporting _getTestableNode(s).
extensions/copilot/src/platform/parser/node/testGenParsing.ts Removed _getTestableNode(s) and TestableNode.
extensions/copilot/src/platform/parser/node/treeSitterQueries.ts Removed testableNodeQueries.
extensions/copilot/src/platform/parser/test/node/getTestableNode.{js,ts}.spec.ts, getTestableNode.util.ts Deleted orphaned tests/helpers.
extensions/copilot/src/platform/parser/test/node/getTestableNodes.ts.spec.ts, getTestableNodes.util.ts Deleted orphaned tests/helpers.

Copilot's findings

  • Files reviewed: 16/16 changed files
  • Comments generated: 0

@ulugbekna ulugbekna merged commit 0c15482 into main May 27, 2026
40 of 41 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/agents/remove-codelens-test-generation branch May 27, 2026 20:42
@vs-code-engineering vs-code-engineering Bot added this to the 1.123.0 milestone May 27, 2026
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.

3 participants