test(ci): verify complete Python reports and exact model references
This commit is contained in:
@@ -2,6 +2,7 @@ import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { fixture, launchWorkbench, until, compatibleFixture, call, completion, assertToolPairs } from './helpers.mjs';
|
||||
import { deliveryGit } from './fixtures/delivery-project.mjs';
|
||||
import { captureWorkspaceSource, assertWorkspaceSource } from './fixtures/workspace-project.mjs';
|
||||
@@ -103,7 +104,14 @@ test('an isolated three-module Python Task repairs, checks and delivers a source
|
||||
await host.api(route + '/delivery-jobs', { planId: session.execution.deliveryPlans.at(-1).id });
|
||||
await wait(value => value.execution.deliveries.at(-1).status === 'completed' && !!value.execution.deliveries.at(-1).reportArtifactId);
|
||||
assert.equal(model.requests.length, requests); assert.equal(session.status, 'completed');
|
||||
const job = session.execution.deliveries.at(-1), report = JSON.parse((await host.api('/artifacts/' + job.reportArtifactId + '?session=' + session.id + '&limit=64000')).content);
|
||||
const job = session.execution.deliveries.at(-1), artifactRoute = '/artifacts/' + job.reportArtifactId + '?session=' + session.id;
|
||||
const metadata = await host.api(artifactRoute + '&limit=1');
|
||||
const download = await fetch(host.url + '/api' + artifactRoute + '&download=1', { headers: { 'X-Workbench-Token': host.bootstrap.token, Connection: 'close' } });
|
||||
assert.equal(download.status, 200);
|
||||
const bytes = Buffer.from(await download.arrayBuffer());
|
||||
assert.equal(bytes.length, metadata.bytes);
|
||||
assert.equal(createHash('sha256').update(bytes).digest('hex'), metadata.sha256);
|
||||
const report = JSON.parse(bytes.toString('utf8'));
|
||||
assert.equal(report.status, 'verified_committed'); assert.equal(report.workspace.workspaceId, workspace.id);
|
||||
assert.equal(report.workspace.sourceRoot, f.projectRoot); assert.equal(report.task.id, taskId);
|
||||
assert.deepEqual(job.paths.slice().sort(), Object.keys(pythonFixes).sort());
|
||||
|
||||
@@ -190,7 +190,9 @@ test('real pytest pass, failure, skip, collection errors and teardown errors use
|
||||
test('a real project virtual environment is detected statically and its actual version is recorded only during the approved check', { timeout: 20000 }, async t => {
|
||||
const f = fixture(t); pythonProject(f, onePass);
|
||||
const host = await resolvePythonRuntime(f.project, { executable: process.env.AGENT_WORKBENCH_TEST_PYTHON });
|
||||
execFileSync(host.baseExecutable, ['-I', '-m', 'venv', path.join(f.projectRoot, '.venv')], { windowsHide: true, cwd: f.root, stdio: 'pipe' });
|
||||
// This scenario executes stdlib unittest. It needs a real project venv,
|
||||
// not ensurepip's unrelated setuptools fixtures (overlong Windows paths).
|
||||
execFileSync(host.baseExecutable, ['-I', '-X', 'utf8', '-m', 'venv', '--without-pip', path.join(f.projectRoot, '.venv')], { windowsHide: true, cwd: f.root, stdio: 'pipe' });
|
||||
const runner = new CheckRunner(f.store); f.onCleanup(() => runner.stopAll());
|
||||
const plan = await runner.plan(f.session);
|
||||
assert.equal(plan.checks[0].python.runtime.status, 'deferred'); assert.equal(plan.checks[0].python.runtime.version, null);
|
||||
|
||||
@@ -36,7 +36,12 @@ test('brand and custom-compatible profiles send native reasoning controls per pr
|
||||
assert.equal(body.model, member.model);
|
||||
}
|
||||
assert.equal(actualRequest(plan, cases[0]).thinking, undefined); assert.equal(actualRequest(plan, cases[4]).reasoning_effort, undefined);
|
||||
assert.equal(modelParameterProfile({ ...config, brand: '自定义' }).id, 'deepseek');
|
||||
const unknown = modelParameterProfile({ ...config, brand: '自定义' });
|
||||
assert.equal(unknown.id, 'openai'); assert.equal(unknown.sourceKind, 'compatibility_profile'); assert.equal(unknown.officialSource, null);
|
||||
const explicit = modelParameterProfile({ ...config, providerId: 'deepseek' });
|
||||
assert.equal(explicit.id, 'deepseek'); assert.equal(explicit.officialSource, null, 'a provider declaration does not invent an exact model specification');
|
||||
const official = modelParameterProfile({ ...config, model: 'deepseek-v4-pro' });
|
||||
assert.equal(official.id, 'deepseek'); assert.equal(official.sourceKind, 'official_model_spec'); assert.equal(official.officialSource.provider, 'deepseek');
|
||||
assert.equal(modelParameterProfile({ ...config, parameterProfile: 'openai' }).id, 'openai');
|
||||
for (const [protocol, params, profile] of [
|
||||
['chat-completions', { thinking: { type: 'adaptive' } }], ['chat-completions', { thinking: { type: 'enabled', budget_tokens: 1024 } }],
|
||||
|
||||
Reference in New Issue
Block a user