P08-02: 旧配置の安全な変更

This commit is contained in:
Agent Control Runner
2026-10-13 21:39:16 +09:00
parent e59206b9b2
commit bb34f443c4
8 changed files with 166 additions and 17806 deletions
+10 -1
View File
@@ -76,8 +76,17 @@ def semantics(snapshot, identity, initial=False):
raise ValueError('operational/construction ownership mismatch')
for jid in identity['jobs']:
if jid not in jobs: raise ValueError('lost paid job')
if initial and (jobs[jid]['progress'] <= 0 or jobs[jid]['state'] != 'BUILDING' or len(jobs[jid]['reserved_cells']) != 6):
starting = jid == identity['starting_job']
stage_ok = (jobs[jid]['progress'] == 0 and jobs[jid]['state'] == 'PLANNED') if starting else (jobs[jid]['progress'] > 0 and jobs[jid]['state'] == 'BUILDING')
if initial and (not stage_ok or not jobs[jid]['construction_cost'] or len(jobs[jid]['reserved_cells']) != 6):
raise ValueError('missing paid old-size progress/reservation')
if identity['starting_job'] not in identity['jobs']: raise ValueError('missing starting stage')
budget = identity['diagnostic_budget']
total = {key:sum(row['cost'].get(key,0) for row in budget['costs']) for key in ('gold','materials')}
total['gold'] += budget['signing'] + budget['food_cost']
deficit = {key:max(0,value-budget['initial'][key]) for key,value in total.items() if value > budget['initial'][key]}
if budget['seed'] != 42588 or budget['food_quantity'] != 8 or total != budget['needed'] or deficit != budget['deltas']:
raise ValueError('diagnostic resource derivation mismatch')
if len(identity['jobs']) < 2 or identity['dorm'] not in facilities: raise ValueError('mixed jobs/completed facility missing')
tasks = indexed(r['staff']['tasks'],'task_id')
if 'patient' not in staff or 'carrier' not in staff: raise ValueError('lost patient/carrier')