P08-03: 配置の通常操作受入
This commit is contained in:
@@ -901,6 +901,18 @@ def check(project_root, evidence_dir):
|
||||
require(os_proof['input_method'] == 'native_os' and os_proof['observer_mutations'] == [], 'fake OS provenance')
|
||||
os_pids = [os_phase(n) for n in os_proof['phases']]
|
||||
require(len(os_pids) == 2, 'OS separate PID pair')
|
||||
role_actions = {}
|
||||
for role, pid in zip(('writer', 'reader'), os_pids):
|
||||
actions = [document(name) for name in index['artifacts']
|
||||
if name.startswith('os-pair/') and name.endswith('/request.json')]
|
||||
actions = sorted((a for a in actions if a.get('target_pid') == pid), key=lambda a: a['sequence'])
|
||||
terminal = 'os-pair/'+role+'-terminal.json'
|
||||
if terminal in index['artifacts']:
|
||||
stopped = document(terminal)
|
||||
require(not any(a['sequence'] > stopped['sequence'] for a in actions), 'terminal OS continuation')
|
||||
require(False, 'terminal OS failure')
|
||||
require([a['sequence'] for a in actions] == list(range(1, len(actions)+1)), 'OS request sequence gap')
|
||||
role_actions[pid] = actions
|
||||
os_rows = pair_gate(os_proof['directory'], os_pids, True)
|
||||
lifecycle = []
|
||||
for role, pid in zip(('writer','reader'),os_pids):
|
||||
@@ -928,6 +940,30 @@ def check(project_root, evidence_dir):
|
||||
require(ack['target_pid'] == request['target_pid'] == observed['pid'] == expected_pid
|
||||
and ack['sequence'] == request['sequence'] == observed['sequence'], 'fake OS provenance')
|
||||
require(ack['request_sha256'] == sha(artifact(folder+'request.json')), 'OS ack request mismatch')
|
||||
if request['action'] == 'reveal_palette':
|
||||
def finite(values, size):
|
||||
return isinstance(values, list) and len(values) == size and all(
|
||||
isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v) for v in values)
|
||||
def geometry(data):
|
||||
bar = data.get('bar', {})
|
||||
return (all(finite(data.get(k), 4) for k in ('target_rect', 'target_screen_rect', 'palette_rect', 'thumb_rect'))
|
||||
and finite(data.get('viewport_to_screen'), 6) and isinstance(bar, dict)
|
||||
and finite(bar.get('rect'), 4) and isinstance(bar.get('visible'), bool)
|
||||
and finite([bar.get(k) for k in ('min_value', 'max_value', 'page', 'value')], 4))
|
||||
require(geometry(request) and finite([request.get('scroll_before')], 1)
|
||||
and request.get('direction') in ('left', 'right'), 'unverified palette reveal')
|
||||
require(folder+'reveal.json' in index['artifacts'], 'unverified palette reveal')
|
||||
revealed = document(folder+'reveal.json')
|
||||
require(geometry(revealed) and revealed.get('visible_after') is True
|
||||
and finite([revealed.get('scroll_after')], 1), 'unverified palette reveal')
|
||||
x,y,w,h = revealed['target_rect']; px,py,pw,ph = revealed['palette_rect']
|
||||
require(w >= 0 and h >= 0 and px <= x and py <= y and x+w <= px+pw and y+h <= py+ph,
|
||||
'unverified palette reveal')
|
||||
delta = revealed['scroll_after'] - request['scroll_before']
|
||||
require(delta > 0 if request['direction'] == 'right' else delta < 0, 'palette reveal direction mismatch')
|
||||
following = [a for a in role_actions[expected_pid] if a['sequence'] == request['sequence']+1]
|
||||
require(len(following) == 1 and following[0]['action'] == 'button'
|
||||
and following[0].get('node') == request.get('node') and request.get('node'), 'unverified palette reveal')
|
||||
raw = document(ack['input_receipt'])
|
||||
require(raw['method'] == 'native_os' and raw['target_pid'] == expected_pid and raw['timestamp_ns'] > 0
|
||||
and raw['tool_name'] and raw['tool_call_id'], 'fake OS provenance')
|
||||
|
||||
Reference in New Issue
Block a user