Files
vscode/extensions/copilot/test/simulation/debugCommandToConfig.stest.ts
Pierce Boggan 0af1ef6fce Model should self-identify if asked (#1267)
* Update model response guidelines in agent prompts

- Modified the response instructions in `agentPrompt.tsx` to clarify when to state the model name.
- Enhanced the `CopilotIdentityRules` class in `copilotIdentity.tsx` to include model name responses.

| File                             | Changes                                                                 |
|----------------------------------|-------------------------------------------------------------------------|
| `agentPrompt.tsx`               | Updated guidance on stating model name when asked.                     |
| `copilotIdentity.tsx`           | Added model name response instructions in identity rules.               |

* Update guidance on model name disclosure in agent prompts

- Revised instruction to clarify that the model name should not be volunteered unless explicitly asked by the user.

| File                                   | Changes Made                                      |
|----------------------------------------|--------------------------------------------------|
| src/extension/prompts/node/agent/agentPrompt.tsx | Updated reminder text regarding model name disclosure. |

* Update agent prompts to include model disclosure

- Added instruction to state the model being used when asked about it in multiple agent prompt snapshots.

| File Path                                                                 | Changes Made                                                                 |
|---------------------------------------------------------------------------|------------------------------------------------------------------------------|
| src/extension/prompts/node/agent/test/__snapshots__/agentPrompt.spec.tsx.snap | Updated responses to include model disclosure when asked about the model.    |

* Add SQLite cache file for simulation layer

This commit introduces a new SQLite cache file for the simulation layer to enhance data retrieval efficiency.

| File                                                                 | Changes                       |
|----------------------------------------------------------------------|-------------------------------|
| test/simulation/cache/layers/2171978e-88a1-4218-afac-dc1fe7ecc095.sqlite | New file created with versioning info |

* Add SQLite cache file for simulation layer

This commit introduces a new SQLite cache file to enhance the simulation layer's performance.

| File                                                                 | Changes                |
|----------------------------------------------------------------------|------------------------|
| test/simulation/cache/layers/94afd615-5805-4860-a1ba-3f9ebbf7b9a4.sqlite | New file added 📁      |

* remove bad cache layers

* npm run simulate

* update baseline

---------

Co-authored-by: João Moreno <joaomoreno@users.noreply.github.com>
2025-10-16 18:21:10 +00:00

97 lines
4.4 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import path from 'path';
import { DebugCommandToConfigConverter } from '../../src/extension/onboardDebug/node/commandToConfigConverter';
import { IGitExtensionService } from '../../src/platform/git/common/gitExtensionService';
import { API } from '../../src/platform/git/vscode/git';
import { TestingServiceCollection } from '../../src/platform/test/node/services';
import { TestWorkspaceService } from '../../src/platform/test/node/testWorkspaceService';
import { IWorkspaceService } from '../../src/platform/workspace/common/workspaceService';
import { CancellationToken } from '../../src/util/vs/base/common/cancellation';
import { Event } from '../../src/util/vs/base/common/event';
import { URI } from '../../src/util/vs/base/common/uri';
import { SyncDescriptor } from '../../src/util/vs/platform/instantiation/common/descriptors';
import { IInstantiationService } from '../../src/util/vs/platform/instantiation/common/instantiation';
import { rubric } from '../base/rubric';
import { ssuite, stest } from '../base/stest';
ssuite({ title: 'Debug config to command', location: 'context' }, () => {
const WORKSPACE_FOLDER = URI.file('/workspace');
async function score(testingServiceCollection: TestingServiceCollection, cwd: string, args: string[]) {
testingServiceCollection.define(IGitExtensionService, new SyncDescriptor(class implements IGitExtensionService {
_serviceBrand: undefined;
onDidChange = Event.None;
extensionAvailable: boolean = false;
getExtensionApi(): API | undefined {
return undefined;
}
}));
const accessor = testingServiceCollection.createTestingAccessor();
(accessor.get(IWorkspaceService) as TestWorkspaceService).getWorkspaceFolders().push(WORKSPACE_FOLDER);
const cvt = accessor.get(IInstantiationService).createInstance(DebugCommandToConfigConverter);
const result = await cvt.convert(cwd, args, CancellationToken.None);
if (!result.ok) {
throw new Error('Expected tools to be found');
}
return { accessor, r: result.config?.configurations[0] };
}
stest({ description: 'node test' }, async (testingServiceCollection) => {
const { accessor, r } = await score(testingServiceCollection, WORKSPACE_FOLDER.fsPath, ['node', 'index.js']);
rubric(accessor,
() => assert.ok(r?.type === 'node'),
() => assert.ok(r?.program.endsWith('index.js')),
() => assert.ok(!r?.cwd || r?.cwd === '${workspaceFolder}'),
);
});
stest({ description: 'node subdirectory and arg' }, async (testingServiceCollection) => {
const { accessor, r } = await score(testingServiceCollection, path.join(WORKSPACE_FOLDER.fsPath, 'foo'), ['node', 'index', '--my-arg']);
rubric(accessor,
() => assert.ok(r?.type === 'node'),
() => assert.ok(r?.program.endsWith('index.js')),
() => assert.ok(r?.cwd.endsWith('foo')),
() => assert.deepStrictEqual(r?.args, ['--my-arg']),
);
});
stest({ description: 'python3 subdirectory and arg' }, async (testingServiceCollection) => {
const { accessor, r } = await score(testingServiceCollection, path.join(WORKSPACE_FOLDER.fsPath, 'foo'), ['python3', 'cool.py', '--my-arg']);
rubric(accessor,
() => assert.ok(r?.type === 'python' || r?.type === 'debugpy'),
() => assert.ok(r?.program.endsWith('cool.py')),
() => assert.ok(r?.cwd.endsWith('foo')),
() => assert.deepStrictEqual(r?.args, ['--my-arg']),
);
});
stest({ description: 'opening a browser' }, async (testingServiceCollection) => {
const { accessor, r } = await score(testingServiceCollection, path.join(WORKSPACE_FOLDER.fsPath), ['chrome.exe', 'https://microsoft.com']);
rubric(accessor,
() => assert.ok(r?.type === 'chrome'),
() => assert.deepStrictEqual(r?.url, 'https://microsoft.com'),
);
});
stest({ description: 'cargo run platform-specific' }, async (testingServiceCollection) => {
const { accessor, r } = await score(testingServiceCollection, path.join(WORKSPACE_FOLDER.fsPath), ['cargo', 'run']);
rubric(accessor,
// test env service always advertises linux:
() => assert.strictEqual(r?.type, 'lldb'),
() => assert.ok(r?.program.includes('target/debug')),
);
});
});