mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-04 13:24:13 +08:00
Reject resident audio reuse without session lease opt-in
This commit is contained in:
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
|
||||
|
||||
def verify(metadata,environ):
|
||||
if metadata.get('resident_capable') and environ.get('ROADSCORE_RESIDENT')!='1':raise ValueError('Resident service requires an opted-in fresh handoff and playback lease')
|
||||
if int(metadata.get('generation_seed',-1))!=int(environ['ROADSCORE_GENERATION_SEED']):raise ValueError('Resident composer belongs to another seed; its owner must finish/release that session')
|
||||
if metadata.get('prepared_profile')!=environ.get('ROADSCORE_ACE_PROFILE','prism'):raise ValueError('Resident composer profile differs from this launch')
|
||||
if metadata.get('composition_policy','prepared-v1')!=environ.get('ROADSCORE_COMPOSITION_POLICY','prepared-v1'):raise ValueError('Resident composer policy differs from this launch')
|
||||
|
||||
@@ -77,3 +77,10 @@ def test_wrong_bank_does_not_change_existing_session(worker):
|
||||
state,saved,audio,model=worker
|
||||
with pytest.raises(ValueError,match='identity changed'):state['prepare_session'](selection(124,'b'*64))
|
||||
assert state['base_seed']==123 and audio==[]
|
||||
|
||||
|
||||
def test_nonresident_launch_cannot_reuse_resident_audio_with_same_seed():
|
||||
from prepared_session import verify
|
||||
metadata={'generation_seed':123,'prepared_profile':'prism','composition_policy':'hook-cache-v1','resident_capable':True}
|
||||
env={'ROADSCORE_GENERATION_SEED':'123','ROADSCORE_ACE_PROFILE':'prism','ROADSCORE_COMPOSITION_POLICY':'hook-cache-v1'}
|
||||
with pytest.raises(ValueError,match='opted-in'):verify(metadata,env)
|
||||
|
||||
Reference in New Issue
Block a user