Warn about broad tool response projections
This commit is contained in:
@@ -490,6 +490,29 @@ test('wizard shows agent-facing MCP preview from current draft fields', async ({
|
||||
},
|
||||
);
|
||||
|
||||
await page.route(
|
||||
`/api/admin/workspaces/${encodeURIComponent(workspace.id)}/operations/analyze-quality`,
|
||||
async (route) => {
|
||||
const payload = route.request().postDataJSON();
|
||||
expect(payload.output_mapping.rules.length).toBeGreaterThan(0);
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
blocking: false,
|
||||
findings: [
|
||||
{
|
||||
severity: 'warning',
|
||||
code: 'response_projection_full_body',
|
||||
message: 'Результат инструмента отдает агенту весь ответ API.',
|
||||
suggested_action: 'Выберите только поля, которые нужны агенту.',
|
||||
field_path: 'output_mapping.rules.0.source',
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
await page.goto(`/wizard/?mode=edit&operationId=${operationId}`);
|
||||
await page.locator('#btn-continue').click();
|
||||
await page.locator('#btn-continue').click();
|
||||
@@ -502,6 +525,12 @@ test('wizard shows agent-facing MCP preview from current draft fields', async ({
|
||||
await expect(page.locator('#agent-preview-tool-call')).toHaveValue(/"name": "frankfurter_monthly_rates"/);
|
||||
await expect(page.locator('#agent-preview-tool-call')).toHaveValue(/"from": "USD"/);
|
||||
await expect(page.locator('#agent-preview-success-response')).toHaveValue(/0\.91/);
|
||||
await page.evaluate(() => window.CrankWizardShell.doGoToStep(5));
|
||||
await expect(page.locator('#step-panel-5')).toBeVisible();
|
||||
await page.locator('#wizard-run-quality').scrollIntoViewIfNeeded();
|
||||
await page.locator('#wizard-run-quality').click();
|
||||
await expect(page.locator('#wizard-quality-findings')).toContainText(/весь ответ API|full response/i);
|
||||
await expect(page.locator('#wizard-quality-findings')).toContainText('output_mapping.rules.0.source');
|
||||
});
|
||||
|
||||
test('wizard edit mode preserves explicit request mapping targets on save', async ({ page }) => {
|
||||
|
||||
Reference in New Issue
Block a user