sessions: test the Session Activity Bar Terminal entry registration #343318

Merged
sandy081 opened 2:44pm on October 21, 2026 wanted to merge 70 Δ into microsoft/vscode main from
agents/the-session-activity-bar-should-have-two-groups

Pull Request Overview

  • Opened on October 21, 2026
  • Status Merged
  • Commit count 2 with first commit October 21, 2026

Total Delta

70 Total Diff Delta

Open Days

Open 9 weekdays

Test Delta

156 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
 
9.0 days Merge to deploy (still awaiting deployment)

Total time for pull request 0.0 business days from first commit authored to merge
Still awaiting deployment

Author avatar

sessions: test the Session Activity Bar Terminal entry registration

Follow-up to #343313, addressing its review comments. Tests only, no product change.


  • Adds a test in sessionsTerminalContribution.test.ts that reads the registered Menus.SessionActivityBar items and checks that the Terminal entry comes first in the panel group (2_panel, order 0), before the Show Panel toggle (order 1). It also checks when the entry shows and when it's enabled: shown when a terminal can be launched or one already exists, including with layout actions off; hidden when no terminal is available and in auxiliary windows; disabled while a custom view is shown.

  • The activity bar fixtures and sessionActivityBar.test.ts now use SessionActivityBarGroup.SidePanel / .Panel instead of hardcoded group ids.

Validation



  • npm run typecheck-client: passed


  • npx eslint <changed files>: passed


  • ./scripts/test.sh --run src/vs/sessions/contrib/terminal/test/browser/sessionsTerminalContribution.test.ts --run src/vs/sessions/test/browser/sessionActivityBar.test.ts --run src/vs/sessions/test/browser/layoutActions.test.ts: 121 passing

Comments Threads Pending Resolution

ljharb reviewed on October 21, 2026
ljharb left a comment

> [!WARNING]
> Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a `copilot-code-review.yml` file specifying one with the `runs-on` attribute. See the [docs](https://gh.io/AA11tgch) for more details.

## Copilot review overview

2 open issues

- Medium severity [The filter `item.command.title !== 'Hide Panel'` is brittle and can behave incorrectly because…](https://github.com/microsoft/vscode/pull/343318#discussion_r4341355542) · New
- Low severity [The test sorts with `(order ?? 0)` but prints `${item.order}` (which can be `undefined`). This can…](https://github.com/microsoft/vscode/pull/343318#discussion_r4341355616) · New

What changed in this PR

Adds/updates sessions test fixtures to use shared activity bar group constants and introduces a regression test asserting the Session Activity Bar Terminal entry is registered/ordered correctly and respects expected contextkey conditions.

**Changes:**
- Add a new test validating Terminal menu registration order and contextkey-driven visibility/enablement.
- Replace hardcoded group ids (`'1_sidePanel'`, `'2_panel'`) with `SessionActivityBarGroup` constants across fixtures/tests.
- Update chat activity bar fixture grouping helper to use the shared group constant.

| File | Description |
| ---- | ----------- |
| src/​vs/​sessions/​test/​browser/​sessionActivityBar.test.ts | Switches test entries to use `SessionActivityBarGroup` constants. |
| src/​vs/​sessions/​test/​browser/​addTabFixtureUtils.ts | Updates fixture entries’ `group` fields to use `SessionActivityBarGroup`. |
| src/​vs/​sessions/​contrib/​terminal/​test/​browser/​sessionsTerminalContribution.test.ts | Adds a new menu-registry-based test for Terminal entry ordering and context behavior. |
| src/​vs/​sessions/​contrib/​chat/​test/​browser/​sessionActivityBar.fixture.ts | Updates fixture grouping helper to use `SessionActivityBarGroup.SidePanel`. |

Review effort: Lite

src/vs/sessions/contrib/terminal/test/browser/sessionsTerminalContribution.test.ts
2360
	ensureNoDisposablesAreLeakedInTestSuite();
Unspecified Git Hub Copilot Model
2361
Unspecified Git Hub Copilot Model
2362
	test('shows the terminal before the panel toggle in the panel group of the session activity bar', () => {
Unspecified Git Hub Copilot Model
2363
		const items = MenuRegistry.getMenuItems(Menus.SessionActivityBar).filter(isIMenuItem)
Unspecified Git Hub Copilot Model
2364
			.filter(item => item.group === SessionActivityBarGroup.Panel && item.command.title !== 'Hide Panel')
Unspecified Git Hub Copilot Model
src/vs/sessions/contrib/terminal/test/browser/sessionsTerminalContribution.test.ts
2368
		const terminalAvailable: Record<string, ContextKeyValue> = { [TerminalContextKeys.processSupported.key]: true };
Unspecified Git Hub Copilot Model
2369
		const terminalState = (values: Record<string, ContextKeyValue>) => ({ shows: evaluate(terminal?.when, values), enabled: evaluate(terminal?.command.precondition, values) });
Unspecified Git Hub Copilot Model
2370
Unspecified Git Hub Copilot Model
2371
		assert.deepStrictEqual({
Unspecified Git Hub Copilot Model
2372
			items: items.map(item => `${item.group}:${item.order} ${typeof item.command.title === 'string' ? item.command.title : item.command.title.value}`),
Unspecified Git Hub Copilot Model

Resolved Comment Threads

No resolved comments have been left on this PR.