feat(tasks): review sourced requirements against current original evidence
This commit is contained in:
@@ -14,6 +14,7 @@ import { verifyWorkspaceProject } from './workspaces/git-workspaces.mjs';
|
||||
import { currentBrowserVerification } from './browser/browser-manager.mjs';
|
||||
import { assertBrowserResolved } from '../shared/contracts/browser.mjs';
|
||||
import { TaskPlanManager } from './tasks/task-plan-manager.mjs';
|
||||
import { RequirementReview } from './tasks/requirement-review.mjs';
|
||||
import { assertMcpResolved } from './tools/mcp-contract.mjs';
|
||||
import { assertWorkersResolved, workerForProject } from '../shared/contracts/workers.mjs';
|
||||
|
||||
@@ -227,6 +228,7 @@ export class GitDelivery {
|
||||
const browser = await currentBrowserVerification(this.store, session, inspection);
|
||||
if (browser.required && browser.status !== 'passed') throw conflict('本任务已配置页面验收,请先取得当前源码与构建的实际浏览器断言通过记录。');
|
||||
const taskPlan = await new TaskPlanManager(this.store).assertReady(session, { inspection });
|
||||
const requirements = await new RequirementReview(this.store).assertReady(session, { inspection });
|
||||
const files = await this.selectedFiles(session, project, snapshot);
|
||||
const name = options.authorName ?? snapshot.config['user.name'] ?? 'Agent Workbench';
|
||||
const email = options.authorEmail ?? snapshot.config['user.email'] ?? 'local@agent-workbench.invalid';
|
||||
@@ -236,12 +238,14 @@ export class GitDelivery {
|
||||
if (snapshot.digest !== second.digest || identity.taskId !== session.taskId || identity.runId !== session.runId) throw conflict('准备提交期间工程或任务已变化,请重新预览。');
|
||||
this.assertIdle(session, idleOptions); this.assertTask(session);
|
||||
await new TaskPlanManager(this.store).assertReady(session, { expectedBinding: taskPlan.binding_sha256 });
|
||||
await new RequirementReview(this.store).assertReady(session, { expectedBinding: requirements.binding_sha256 });
|
||||
const diffArtifact = this.store.artifactStore.write(session, run, files.map(file => file.diff).join('\n'), { kind: 'delivery-diff', mediaType: 'text/plain' });
|
||||
this.store.core.artifact.set(diffArtifact.id, diffArtifact);
|
||||
const plan = { id: randomUUID(), sessionId: session.id, projectId: session.projectId, taskId: task.id, runId: run.id, status: 'planned', createdAt: at(),
|
||||
message, author, files, paths: files.map(file => file.path), snapshot, preparedBy: source, fingerprint: inspection.fingerprint, sourceFingerprint: inspection.sourceFingerprint,
|
||||
checkJobId: check.id, checkSummary: check.results.map(value => ({ name: value.name, command: value.command, exitCode: value.exitCode, tests: value.tests, logArtifactId: value.logArtifactId })),
|
||||
...(taskPlan.configured ? { taskPlanId: taskPlan.plan_id, taskPlanRevision: taskPlan.revision, taskPlanBindingSha256: taskPlan.binding_sha256 } : {}),
|
||||
...(requirements.configured ? { requirementBindingSha256: requirements.binding_sha256 } : {}),
|
||||
...(browser.required ? { browserJobId: browser.jobId, browserPlanId: browser.planId, browserBuildSha256: browser.buildSha256 } : {}),
|
||||
protectedIndexSha256: protectedIndex(snapshot.stage, snapshot.flags, files.map(file => file.path)), diffArtifactId: diffArtifact.id,
|
||||
policy: { name: 'local-reviewed-snapshot', hooks: 'disabled', signing: 'unsigned', remote: 'none',
|
||||
@@ -294,6 +298,7 @@ export class GitDelivery {
|
||||
}
|
||||
|
||||
async verifyBrowserDelivery(session, plan, inspection) {
|
||||
await new RequirementReview(this.store).assertReady(session, { inspection, expectedBinding: plan.requirementBindingSha256 ?? null });
|
||||
await new TaskPlanManager(this.store).assertReady(session, { inspection, expectedBinding: plan.taskPlanBindingSha256 ?? null });
|
||||
assertBrowserResolved(this.store, session.projectId);
|
||||
const browser = await currentBrowserVerification(this.store, session, inspection);
|
||||
|
||||
Reference in New Issue
Block a user