ReviewOS

also looking at this

stacks/drone

feat: add shared-clock scoped vehicle simulation sessions

#98
Merged chris wants to merge codex/cargo-fleet-runtime into main
42 files +2764 -127
tests/unit/authority.test.tsmodified+13-0
Changes to tests/unit/authority.test.ts
@@ -101,6 +101,19 @@ test('kill wins over invalid time, cannot be cleared by release or disarm and ne
101101 reset.interlocks.motorsStopped = true
102102 expect(s.update(reset, command(s, 'reset')).state).toBe('disarmed')
103103})
104
105test('a kill event records its valid observation time and retains the prior epoch for invalid clocks', () => {
106 for (const nowMs of [1020, NaN, 999]) {
107 const s = engaged(), kill = observation(nowMs)
108 kill.interlocks.killActive = true
109 const result = s.update(kill)
110 expect(result.state).toBe('killed')
111 expect(result.events.at(-1)!.reason).toBe('kill-input')
112 expect(result.events.at(-1)!.atMs).toBe(nowMs === 1020 ? 1020 : 1000)
113 expect(result.lastCheckedAtMs).toBe(nowMs === 1020 ? 1020 : 1000)
114 expect(s.gate(output(1020), 1020)).toBeNull()
115 }
116})
104117test('RC override revokes autonomous outputs and stays manual after override is released', () => {
105118 const s = engaged(), o = observation(1020); o.rc.override = true
106119 expect(s.update(o).state).toBe('manual')