test(canvas): drain cancellation events before next AI admission
This commit is contained in:
@@ -14,7 +14,7 @@ export async function verifyFoundryAI({open,transport,rootId,imageId,assets,call
|
||||
const target={id:randomUUID(),incarnation:1};
|
||||
assert.equal(engine.editor.dispatch({type:'element.create',element:{id:target.id,incarnation:1,ownerCanvasId:rootId,componentId:'text',dataVersion:1,structure:'node',data:{title:'Real AI adapter',text:'before generation',extension:{keep:true}},geometry:{x:0,y:0,width:100,height:80,rotation:0}}}).status,'applied');await engine.settle();
|
||||
const input={target,boardId:rootId,modelId:'fixture-text',prompt:'Fixture generation',parameters:{},propagate:false};
|
||||
const begin=async value=>{const result=engine.startRun(value);assert.equal(result.status,'applied');await engine.settle();return result;};
|
||||
const begin=async value=>{const result=engine.startRun(value);assert.equal(result.status,'applied',JSON.stringify(result));await engine.settle();return result;};
|
||||
const byOperation=id=>[...engine.getSnapshot().runtime.runs.values()].find(run=>run.operationId===id);
|
||||
const initialStarts=posts('/ai/runs').length,initialUploads=posts('/assets').length;
|
||||
|
||||
@@ -38,6 +38,7 @@ export async function verifyFoundryAI({open,transport,rootId,imageId,assets,call
|
||||
loseAction();assert.equal(engine.cancelRun(secondRun.id).status,'applied');await engine.settle();
|
||||
const cancellation=[...engine.getSnapshot().runtime.ledger.requests.values()].find(request=>request.kind==='run.cancel'&&request.runId===secondRun.id);assert.equal(cancellation.phase,'waiting');const cancellationCount=posts('/cancel').length;
|
||||
await reopen();assert.equal(posts('/cancel').length,cancellationCount);assert.equal(engine.getSnapshot().runtime.ledger.requests.get(cancellation.id).body,cancellation.body);assert.equal(engine.getSnapshot().runtime.runs.get(secondRun.id).status,'cancelled');
|
||||
await poll();assert.equal(engine.getSnapshot().runtime.runs.get(secondRun.id).hasMore,false,'drain the cancelled run event cursor before another admission');
|
||||
assert.equal((await control('stats')).executions,beforeCancel);
|
||||
|
||||
// Edit while the provider is held, then retain and explicitly apply its output.
|
||||
|
||||
Reference in New Issue
Block a user