Add typed field-flight prototype and preserve native qualification failures

This commit is contained in:
2026-09-19 21:01:20 +02:00
parent 83ea247e62
commit 61e165ef5b
91 changed files with 40570 additions and 85 deletions
+8 -4
View File
@@ -40,10 +40,14 @@ def validate_approach_evidence(content, nonce, look_proof, proof):
try:
need(type(proof) is dict and proof.get('requested') is True and proof.get('completed') is True and proof.get('nonce')==nonce, 'approach did not complete under this nonce')
need(not proof.get('error') and proof.get('paired_release_errors')==[] and proof.get('unconfirmed_held_key') is None, 'approach input did not end cleanly')
profile=proof.get('profile','standard')
need(type(profile) is str and profile in ('standard','coarse'), 'unknown approach profile')
max_pixels,max_angle,max_pulses=(384,35,16) if profile=='coarse' else (128,15,12)
result['profile']=profile
start=number(proof['started_monotonic']); finish=number(proof['finished_monotonic']); deadline=number(proof['deadline_monotonic'])
need(0 <= start < finish <= deadline and deadline-start <= 35, 'approach helper deadline invalid')
events=proof['events']; stops=proof['stops']; motions=proof['motions']; references=proof['samples']
need(type(events) is list and 2 <= len(events) <= 24 and len(events)%2==0, 'expected bounded W key pairs')
need(type(events) is list and 2 <= len(events) <= 2*max_pulses and len(events)%2==0, 'expected bounded W key pairs')
need(type(stops) is list and len(stops)*2==len(events), 'each W pair needs a native full-stop interval')
need(type(motions) is list and len(motions)<=16 and type(references) is list and 2 <= len(references) <= 450, 'route reference bounds invalid')
ids=[r['sample'] for r in references]
@@ -110,16 +114,16 @@ def validate_approach_evidence(content, nonce, look_proof, proof):
need(.01<=abs(gain)<=.5, 'native calibration gain outside approach range')
for motion in motions:
before,after=motion['after_sample'],motion['response_sample']; dx=motion['dx'];at=number(motion['monotonic'])
need(type(dx) is int and 1<=abs(dx)<=128 and type(motion['dy']) is int and motion['dy']==0,'relative step exceeds route bounds')
need(type(dx) is int and 1<=abs(dx)<=max_pixels and type(motion['dy']) is int and motion['dy']==0,'relative step exceeds route bounds')
need(type(before) is int and type(after) is int and previous_motion<=before<after<=last and start<=at<=finish,'relative motion references/order invalid')
need(previous_motion_time<=at and before in receipts and after in receipts and receipts[before]<=at<=receipts[after] and at-receipts[before]<=.5, 'relative motion timestamps contradict native receipts')
previous_motion_time=at
a,b=samples[before],samples[after];change=angle(yaw(b['look']['direction']),yaw(a['look']['direction']))
need(.05<=abs(change)<=15 and change*dx*gain>0,'native turn did not acknowledge proposal')
need(.05<=abs(change)<=max_angle and change*dx*gain>0,'native turn did not acknowledge proposal')
for i in range(before,after+1):
need(neutral(samples[i]) and horizontal(samples[i]['input']['origin'],a['input']['origin'])<=.05,'body moved during heading correction')
turn=angle(yaw(samples[i]['look']['direction']),yaw(a['look']['direction']))
need(abs(turn)<=15 and (abs(turn)<.05 or turn*dx*gain>0), 'intermediate native turn exceeded bounds or reversed')
need(abs(turn)<=max_angle and (abs(turn)<.05 or turn*dx*gain>0), 'intermediate native turn exceeded bounds or reversed')
stable_end(after);pixels+=abs(dx);previous_motion=after
need(all(not (events[i]['monotonic'] <= m['monotonic'] <= events[i+1]['monotonic']) for m in motions for i in range(0,len(events),2)), 'mouse motion overlaps W hold')
need(pixels<=2048,'relative pixel sum exceeds route bound')