Keep Enhance + Generate as one queue row with shared progress.
The PE stage now stays on the same jobId so the header and queue badge agree, and jobs behind it do not promote when enhance finishes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,11 +1,26 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import {queueJobs,jobView,elapsedSeconds} from '../shared/studio2/queue-view.mjs'
|
||||
import {queueJobs,jobView,elapsedSeconds,jobStageLabel,jobProgressView} from '../shared/studio2/queue-view.mjs'
|
||||
test('queue shows every waiting job in order alongside the running job',()=>{
|
||||
const jobs=[{id:'late',state:'waiting',queuedAt:30},{id:'done',state:'complete',queuedAt:1},{id:'early',state:'waiting',queuedAt:10},{id:'active',state:'rendering',queuedAt:20},{id:'held',state:'held',queuedAt:40}]
|
||||
assert.deepEqual(queueJobs(jobs).map(j=>j.id),['active','early','late','held'])
|
||||
assert.equal(queueJobs(Array.from({length:15},(_,i)=>({id:i,state:'waiting',queuedAt:i}))).length,15)
|
||||
})
|
||||
test('enhancing stays on the active queue with the same job id as generate',()=>{
|
||||
const pe={id:'one',state:'enhancing',queuedAt:10}
|
||||
const behind={id:'two',state:'waiting',queuedAt:20}
|
||||
assert.deepEqual(queueJobs([behind,pe]).map(j=>j.id),['one','two'])
|
||||
assert.equal(jobStageLabel('enhancing'),'Enhancing prompt…')
|
||||
assert.equal(jobStageLabel('rendering'),'Generating…')
|
||||
assert.equal(jobStageLabel('submitting'),'Generating…')
|
||||
assert.deepEqual(jobProgressView(pe),{indeterminate:true,percent:null})
|
||||
assert.deepEqual(jobProgressView({state:'enhancing',progress:{step:2,maxStep:4,percent:50}}),{indeterminate:false,percent:50})
|
||||
assert.deepEqual(jobProgressView({state:'rendering',progress:{step:3,maxStep:6,percent:50}}),{indeterminate:false,percent:50})
|
||||
assert.equal(jobProgressView({state:'waiting'}),null)
|
||||
// PE → generate is a stage change on the same row, not a vanish frame
|
||||
const same=[{id:'one',state:'submitting',queuedAt:10},{id:'two',state:'waiting',queuedAt:20}]
|
||||
assert.deepEqual(queueJobs(same).map(j=>j.id),['one','two'])
|
||||
})
|
||||
test('authoritative completion ends a stale rendering row and freezes its timer',()=>{
|
||||
const record={state:'rendering',queuedAt:1000,startedAt:2000,updatedAt:5000}
|
||||
for(const status of ['complete','error','cancelled']){
|
||||
|
||||
Reference in New Issue
Block a user