P08-03: 配置の通常操作受入
This commit is contained in:
@@ -559,11 +559,20 @@ def action_gate(row, typed, root=HERE.parent):
|
||||
expected_reason = REASONS[label][0] if label in REASONS else {'missing_connection':'STAIR_LANDING_MISSING', 'refused_demolition':'STAIR_LANDING_IN_USE'}.get(label, '')
|
||||
require(row.get('expected', expected_reason) == expected_reason, 'required refusal reason changed')
|
||||
results = row.get('results', [])
|
||||
if kind == 'build' and results and results[0]['code'] != 'OK':
|
||||
reason = results[0]['details'].get('reason', results[0]['code'])
|
||||
require(not row['report']['can_build'], 'preview/command disagreement')
|
||||
require(reason in row['report']['error_codes'], 'preview reason differs from Runtime reason')
|
||||
if label in REASONS:
|
||||
code, message = REASONS[label]
|
||||
require(row['report']['error_codes'][0] == code and row['status'] == message, 'reason mismatch')
|
||||
require(not row['report']['can_build'] and not results, 'preview rejection bypassed')
|
||||
preserve(before, after, results)
|
||||
elif label == 'missing_connection' and not results:
|
||||
require(not row['report']['can_build'], 'preview/command disagreement')
|
||||
require('STAIR_LANDING_MISSING' in row['report']['error_codes'], 'preview reason differs from Runtime reason')
|
||||
require(row['report']['reasons'] and row['status'] == row['report']['reasons'][0]['message'], 'connection reason mismatch')
|
||||
preserve(before, after, [])
|
||||
elif kind == 'cancel':
|
||||
require(not results and row['status'] == '撤去を取り消しました。', 'cancel submitted command')
|
||||
preserve(before, after, results)
|
||||
@@ -584,7 +593,16 @@ def action_gate(row, typed, root=HERE.parent):
|
||||
else:
|
||||
require(result['code'] == 'OK', 'positive rejected')
|
||||
if kind == 'demolish':
|
||||
require(row['status'] == '%s | %s | %s' % (result['code'], result['details'].get('reason', ''), result['message']), 'displayed domain reason mismatch')
|
||||
tokens = (result['code'], result['details'].get('reason', ''), ' | ')
|
||||
require(not any(token and token in row['status'] for token in tokens), 'raw demolition token in status')
|
||||
if row['expected']:
|
||||
require(row['status'] == '撤去できません: '+result['message'], 'demolition refusal message mismatch')
|
||||
else:
|
||||
titles = {'gold':'所持金', 'mana':'マナ', 'materials':'資材', 'faith':'信仰'}
|
||||
refund = result['details']['refund']
|
||||
amounts = ['%s %d' % (titles.get(k, k), int(refund[k])) for k in sorted(refund) if int(refund[k]) != 0]
|
||||
expected_status = '撤去しました(返金: '+ '、'.join(amounts)+')' if amounts else '撤去しました(返金なし)'
|
||||
require(row['status'] == expected_status, 'demolition refund display mismatch')
|
||||
if not row['expected']:
|
||||
fid = row['instance_id']
|
||||
old = keyed(a['systems']['runtime']['construction']['facilities'], 'instance_id')
|
||||
@@ -606,7 +624,7 @@ def action_gate(row, typed, root=HERE.parent):
|
||||
require(row['report']['connection']['status'] == 'CONNECTED', 'positive connection absent')
|
||||
if label == 'missing_connection':
|
||||
require(row['status'] == '操作に失敗しました: '+result['message'], 'connection reason mismatch')
|
||||
require(row['report']['can_build'], 'connection refusal did not reach Runtime')
|
||||
require(not row['report']['can_build'], 'preview/command disagreement')
|
||||
|
||||
def check(project_root, evidence_dir):
|
||||
root, evidence = Path(project_root).resolve(), Path(evidence_dir).resolve()
|
||||
|
||||
Reference in New Issue
Block a user