code wiki / _hdl_build / nx_update_winwinwin.nx

nx_update_winwinwin.nx source

↩ module page · 36 lines · 1796 B

1// nx_update_winwinwin.nx -- the cross-cutting UPDATE GATE that is the OPPOSITE of awful Windows updates 2// (operator: "when we need to make an update across everything it's easy and doesn't negatively impact the 3// user but improves in a win for the hardware - win for the software - win for the user way"). An update is 4// scored on three axes; the USER axis has an ABSOLUTE veto (we never ship a user regression for our own 5// convenience), no axis may regress, and there must be a net win. license_tier: ORIGINAL Reports via PM. 6 7import "nx_syscalls.nx" 8 9const WWW_REGRESS: i64 = 0 - 1 // this axis gets worse 10const WWW_NEUTRAL: i64 = 0 11const WWW_IMPROVE: i64 = 1 12 13const WWW_APPROVE: i64 = 1 14const WWW_HOLD: i64 = 0 // safe but no benefit -> don't churn 15const WWW_REJECT: i64 = 0 - 1 // harms an axis -> never ship 16 17// the gate. user veto is absolute (the anti-Windows-update law); no regressions; require a net win. 18func www_verdict(hw: i64, sw: i64, user: i64) -> i64 { 19 if user < 0 { return WWW_REJECT } // NEVER negatively impact the user 20 if hw < 0 { return WWW_REJECT } // no hardware regression 21 if sw < 0 { return WWW_REJECT } // no software regression 22 let net: i64 = hw + sw + user 23 if net <= 0 { return WWW_HOLD } // no net improvement -> don't disturb a working system 24 return WWW_APPROVE // win-hardware + win-software + win-user 25} 26 27func www_is_user_safe(user: i64) -> i64 { if user >= 0 { return 1 } return 0 } 28func www_is_win_win_win(hw: i64, sw: i64, user: i64) -> i64 { 29 if hw > 0 { if sw > 0 { if user > 0 { return 1 } } } 30 return 0 31} 32func www_label(v: i64) -> *u8 { 33 if v == WWW_APPROVE { return "APPROVE" as *u8 } 34 if v == WWW_HOLD { return "HOLD" as *u8 } 35 return "REJECT" as *u8 36}