feat: add reviewed Task Git delivery and verified evidence reports
This commit is contained in:
@@ -60,12 +60,12 @@ export class CheckRunner {
|
||||
const artifact = this.store.artifactStore.write(session, run, JSON.parse(this.redact(JSON.stringify(inspection))), { kind: 'project-inspection' });
|
||||
this.store.core.artifact.set(artifact.id, artifact);
|
||||
const plan = { id: randomUUID(), sessionId: session.id, projectId: session.projectId, taskId: session.taskId, runId: session.runId,
|
||||
status: 'planned', createdAt: at(), fingerprint: inspection.fingerprint, project: inspection, artifactId: artifact.id,
|
||||
status: 'planned', createdAt: at(), fingerprint: inspection.fingerprint, sourceFingerprint: inspection.sourceFingerprint, project: inspection, artifactId: artifact.id,
|
||||
checks: createCheckList(inspection, names).map(check => ({ id: randomUUID(), ...check })) };
|
||||
const task = this.store.core.task.get(session.taskId);
|
||||
if (task.verification.status === 'passed') {
|
||||
const last = this.store.core.check_job.get(task.verification.checkJobId);
|
||||
if (last?.fingerprint !== inspection.fingerprint) invalidateProjectChecks(this.store, session.projectId);
|
||||
if (last?.sourceFingerprint ? last.sourceFingerprint !== inspection.sourceFingerprint : last?.fingerprint !== inspection.fingerprint) invalidateProjectChecks(this.store, session.projectId);
|
||||
}
|
||||
return this.store.putRecord('check_plan', session, plan, 'check.plan');
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export class CheckRunner {
|
||||
if (session.changes.some(change => ['pending', 'conflict'].includes(change.status))) throw conflict('先应用或撤回本任务的待审查改动,再检查实际工程。');
|
||||
const controller = new AbortController(), run = this.store.owned('run', session.runId, session.id);
|
||||
const job = { id: randomUUID(), sessionId: session.id, projectId: session.projectId, taskId: session.taskId, runId: run.id, planId: plan.id,
|
||||
status: 'queued', source, startedAt: at(), finishedAt: null, results: [], fingerprint: plan.fingerprint,
|
||||
status: 'queued', source, startedAt: at(), finishedAt: null, results: [], fingerprint: plan.fingerprint, sourceFingerprint: plan.sourceFingerprint ?? null,
|
||||
baseline: { head: plan.project.git.head, branch: plan.project.git.branch, dirty: plan.project.git.dirty }, originalSessionStatus: session.status };
|
||||
const active = { sessionId: session.id, projectId: session.projectId, controller, promise: null };
|
||||
this.active.set(job.id, active); this.projects.set(session.projectId, job.id);
|
||||
@@ -104,6 +104,7 @@ export class CheckRunner {
|
||||
const before = await inspectProject(this.store.project(session.projectId));
|
||||
signal.throwIfAborted();
|
||||
if (before.fingerprint !== plan.fingerprint) throw conflict('检查计划创建后工程或Git基线已变化,请重新识别再执行。');
|
||||
job.sourceFingerprint = before.sourceFingerprint;
|
||||
const current = createCheckList(before, plan.checks.map(check => check.name));
|
||||
if (current.some((check, index) => check.script !== plan.checks[index].script || check.command !== plan.checks[index].command)) throw conflict('检查脚本与计划不一致,未执行任何命令。');
|
||||
job.status = 'running'; session.status = 'running'; task.verification = { status: 'running', checkJobId: job.id };
|
||||
@@ -121,10 +122,10 @@ export class CheckRunner {
|
||||
this.store.save(session, { type: 'check.result', detail: { jobId: job.id, checkId: check.id, status: record.status, artifactId: artifact.id } });
|
||||
if (['cancelled', 'unknown'].includes(record.status)) break;
|
||||
const after = await inspectProject(this.store.project(session.projectId));
|
||||
if (after.fingerprint !== plan.fingerprint) { job.stale = true; break; }
|
||||
if (after.sourceFingerprint !== job.sourceFingerprint) { job.stale = true; break; }
|
||||
}
|
||||
const final = await inspectProject(this.store.project(session.projectId));
|
||||
job.stale ||= final.fingerprint !== plan.fingerprint;
|
||||
job.stale ||= final.sourceFingerprint !== job.sourceFingerprint;
|
||||
if (signal.aborted || job.results.some(result => result.status === 'cancelled')) job.status = 'cancelled';
|
||||
else if (job.results.some(result => result.status === 'unknown')) { job.status = 'unknown'; job.requiresVerification = true; }
|
||||
else if (job.stale) job.status = 'stale';
|
||||
@@ -138,7 +139,7 @@ export class CheckRunner {
|
||||
} finally {
|
||||
job.currentCheck = null;
|
||||
job.finishedAt = at();
|
||||
task.verification = { status: job.status, checkJobId: job.id, fingerprint: job.fingerprint, checkedAt: job.finishedAt };
|
||||
task.verification = { status: job.status, checkJobId: job.id, fingerprint: job.fingerprint, sourceFingerprint: job.sourceFingerprint, checkedAt: job.finishedAt };
|
||||
if (job.source === 'user') session.status = job.originalSessionStatus;
|
||||
this.store.save(session, { type: 'check.finished', detail: { jobId: job.id, status: job.status } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user