feat(dev): correlate telemetry recovery, safety stops and passive drive evidence

This commit is contained in:
DCCONSTRUCTIONS
2026-11-21 20:58:26 +03:00
parent 43d4916331
commit d4ed96f3cd
73 changed files with 4188 additions and 349 deletions
@@ -57,7 +57,7 @@ test('duplicate arm clicks while request pending create exactly one lease reques
}));
test('throttle uses explicit percent units and starts with zero demand',async()=>fixture(async f=>{
assert.equal(await f.c.arm(30,50,'duty'),true);await flush();
assert.deepEqual(f.calls.find(x=>x.url.endsWith('/arm')).body,{standstill_confirmed:true,current_a:30,max_duty_percent:50});
assert.deepEqual(f.calls.find(x=>x.url.endsWith('/arm')).body,{standstill_confirmed:true,current_a:30,max_duty_percent:50,telemetry_stop_ms:1000});
assert.equal(f.calls.at(-1).body.left,0);assert.equal(f.calls.at(-1).body.right,0);
}));
@@ -102,7 +102,7 @@ test('transport loss reacquires a new neutral session only after stable stopped
assert.equal(f.calls.filter(x=>x.url.endsWith('/arm')).length,1);
f.advance(600);f.poll();await flush();
assert.equal(f.calls.filter(x=>x.url.endsWith('/arm')).length,2);
assert.deepEqual(f.calls.filter(x=>x.url.endsWith('/arm')).at(-1).body,{standstill_confirmed:true,current_a:30,max_duty_percent:70});
assert.deepEqual(f.calls.filter(x=>x.url.endsWith('/arm')).at(-1).body,{standstill_confirmed:true,current_a:30,max_duty_percent:70,telemetry_stop_ms:1000});
assert.equal(f.calls.at(-1).body.left,0);assert.equal(f.calls.at(-1).body.right,0);
f.c.setDemand({left:1,right:1});await flush();assert.equal(f.calls.at(-1).body.left,0,'previous input guard must be retired');
}));
@@ -261,3 +261,11 @@ test('transient 409 admission races preserve recovery but ownership conflicts re
});
}
});
test('active telemetry tolerance does not relabel data fresh or change command inputs',async()=>fixture(async f=>{
assert.equal(await f.c.arm(30,70,'duty',2000),true);await flush();
assert.equal(f.calls.find(x=>x.url.endsWith('/arm')).body.telemetry_stop_ms,2000);
const p=f.delayPoll();f.poll();p.resolve(response({...idle,fresh:false,control_fresh:true,controlling:true,telemetry_age_ms:1300,telemetry_stop_ms:2000,snapshot:{...idle.snapshot,state:'ready',session_id:'new-session'}}));await flush();
assert.equal(f.calls.filter(x=>x.body?.stop===true).length,0);
f.heartbeat();await flush();assert.equal('telemetry_stop_ms' in f.calls.at(-1).body,false);
}));