Refresh Studio 2 LoRAs from live Comfy object_info on fresh=1.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-18 12:45:48 -05:00
co-authored by Cursor
parent 36d24feb9c
commit 7221b6a8cf
3 changed files with 82 additions and 23 deletions
+19
View File
@@ -36,6 +36,25 @@ test('cached LoRAs survive sleeping GPU and failed explicit refresh',async()=>{
const opts={read:()=>cache,write:()=>assert.fail('Do not erase cache'),live:async()=>{queried++;throw Error('Comfy asleep')}}
assert.deepEqual(await cachedLoras(opts),cache);assert.equal(queried,0);assert.deepEqual(await cachedLoras({...opts,fresh:true}),cache);assert.equal(queried,1)
})
test('fresh LoRA refresh replaces disk cache so new Comfy names appear',async()=>{
let store={image:['old.safetensors'],video:['old-vid.safetensors']}
const next=await cachedLoras({
read:()=>store,
write:value=>{store=value},
live:async()=>({image:['old.safetensors','new-drop.safetensors'],video:['old-vid.safetensors']}),
fresh:true
})
assert.deepEqual(next.image,['old.safetensors','new-drop.safetensors'])
assert.deepEqual(store.image,['old.safetensors','new-drop.safetensors'])
const removed=await cachedLoras({
read:()=>store,
write:value=>{store=value},
live:async()=>({image:['new-drop.safetensors'],video:[]}),
fresh:true
})
assert.deepEqual(removed,{image:['new-drop.safetensors'],video:[]})
assert.deepEqual(store,{image:['new-drop.safetensors'],video:[]})
})
test('source/hero actions are independent and full input restores structured settings',()=>{
const form={identityStillId:'hero',imageAId:'source',promptSections:{action:'old'},settings:{}}
assert.equal(useAsHero(form,{id:'new'}).imageAId,'source');assert.equal(useAsSource(form,{id:'new'}).identityStillId,'hero')