feat(research): reopen artifacts and immutable history (RP25)
This commit is contained in:
parent
f9b97c3004
commit
e39989c4d5
4 changed files with 385 additions and 16 deletions
|
|
@ -400,6 +400,11 @@ describe.skipIf(!url)('AI research workflow through authenticated APIs and Rust'
|
|||
reportHash: report.reportHash,
|
||||
});
|
||||
expect(finding.latestRevision.evidence).toHaveLength(6);
|
||||
const reopenedFinding = await f.client.artifact(finding.id);
|
||||
expect(reopenedFinding.latestRevision).toMatchObject(finding.latestRevision);
|
||||
expect(await f.client.artifactRevisions(finding.id)).toEqual([
|
||||
reopenedFinding.latestRevision,
|
||||
]);
|
||||
for (const evidence of finding.latestRevision.evidence) {
|
||||
const saved = await f.api.getRunResults(evidence.runId);
|
||||
if (!saved || !('kind' in saved) || saved.kind !== 'canonical-result/v1') {
|
||||
|
|
@ -507,17 +512,57 @@ describe.skipIf(!url)('AI research workflow through authenticated APIs and Rust'
|
|||
expect(reference.datasetHash).toBe(native.request.datasetHash);
|
||||
expect(reference.value).toBe(native.analytics.metrics.totalReturn);
|
||||
}
|
||||
const response = await f.transport(
|
||||
`http://127.0.0.1:2003/api/v2/analysis-artifacts/${finding.id}`,
|
||||
{ headers: { Authorization: `Bearer ${f.provisioned.token}` } }
|
||||
);
|
||||
expect(response.status).toBe(200);
|
||||
const retained = (await response.json()).artifact;
|
||||
const retained = await f.client.artifact(finding.id);
|
||||
expect(retained.latestRevision.id).toBe(finding.latestRevision.id);
|
||||
expect(retained.latestRevision.source).toBeNull();
|
||||
expect(retained.latestRevision.evidence).toMatchObject(finding.latestRevision.evidence);
|
||||
expect(retained.latestRevision.validationState).toBe('unvalidated');
|
||||
const revised = await f.research.reviseArtifact(
|
||||
finding.id,
|
||||
{
|
||||
expectedRevision: retained.latestRevision.ordinal,
|
||||
title: 'Human follow-up to saved AI comparison',
|
||||
body: 'A revised interpretation, still unvalidated.',
|
||||
contentOrigin: 'human',
|
||||
evidence: comparisonInput.evidence,
|
||||
source: null,
|
||||
},
|
||||
'operator'
|
||||
);
|
||||
const latest = await f.client.artifact(finding.id);
|
||||
expect(latest.latestRevision.id).toBe(revised.latestRevision.id);
|
||||
expect(latest.latestRevision.contentOrigin).toBe('human');
|
||||
expect(latest.latestRevision.submittedBy).toBe('operator');
|
||||
const history = await f.client.artifactRevisions(finding.id);
|
||||
expect(history).toHaveLength(2);
|
||||
expect(history.find(item => item.id === finding.latestRevision.id)).toEqual(
|
||||
retained.latestRevision
|
||||
);
|
||||
expect(history.find(item => item.id === revised.latestRevision.id)).toEqual(
|
||||
latest.latestRevision
|
||||
);
|
||||
expect(latest.latestRevision.evidence).toEqual(retained.latestRevision.evidence);
|
||||
expect(f.requests.slice(-3).every(item => item.method === 'GET' && item.key === null)).toBe(
|
||||
true
|
||||
);
|
||||
}
|
||||
const note = await f.research.createArtifact(
|
||||
f.project.id,
|
||||
{
|
||||
kind: 'note',
|
||||
title: 'Service diagnostic note',
|
||||
body: 'No measured claim.',
|
||||
contentOrigin: 'unknown',
|
||||
},
|
||||
'service'
|
||||
);
|
||||
expect((await f.client.artifact(note.id)).latestRevision).toMatchObject({
|
||||
contentOrigin: 'unknown',
|
||||
submittedBy: 'service',
|
||||
evidence: [],
|
||||
evidenceState: 'none',
|
||||
source: null,
|
||||
});
|
||||
const artifactsBeforeRefusals = (
|
||||
await f.pool.query('SELECT count(*)::int AS count FROM analysis_artifacts')
|
||||
).rows[0].count;
|
||||
|
|
@ -548,6 +593,18 @@ describe.skipIf(!url)('AI research workflow through authenticated APIs and Rust'
|
|||
expect((await f.pool.query('SELECT count(*)::int AS count FROM runs')).rows[0].count).toBe(
|
||||
before
|
||||
);
|
||||
await f.agents.update(f.provisioned.agent.id, {
|
||||
expectedRevision: f.provisioned.agent.revision,
|
||||
enabled: false,
|
||||
});
|
||||
await expect(f.client.artifact(note.id)).rejects.toMatchObject({
|
||||
status: 401,
|
||||
uncertain: false,
|
||||
});
|
||||
await expect(f.client.artifactRevisions(note.id)).rejects.toMatchObject({
|
||||
status: 401,
|
||||
uncertain: false,
|
||||
});
|
||||
}, 180000);
|
||||
|
||||
test('real quota refusal and oversized search create no runs; nonmember evidence cannot become a finding', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue