code wiki / _hdl_build / nx_deploy_provenance.nx

nx_deploy_provenance.nx source

↩ module page · 34 lines · 1794 B

1// nx_deploy_provenance.nx -- the team addresses the ROOT CAUSE of the deploy uncertainty (operator: 2// "build the team to address the risk and uncertainty"). The live sites.elf's source is LOST because no 3// deploy ever recorded WHERE it was built from. Fix: every deploy STAMPS provenance -- source location + 4// source content-hash + build id -- so the source is always re-findable and a rebuild is always 5// verifiable. An artifact with no provenance is UNTRACEABLE (exactly what bit us); the team refuses to 6// TRUST an untraceable binary for a risky re-deploy, and re-stamps on the next clean build to restore 7// traceability going forward. license_tier: ORIGINAL Pairs with nx_deploy_verify + the Genealogist. 8 9import "nx_syscalls.nx" 10 11// a provenance stamp is COMPLETE only with all three (so the source is always re-findable). 12func prov_complete(has_source_loc: i64, has_source_hash: i64, has_build_id: i64) -> i64 { 13 if has_source_loc != 1 { return 0 } 14 if has_source_hash != 1 { return 0 } 15 if has_build_id != 1 { return 0 } 16 return 1 17} 18 19// traceable = we can locate the exact source to rebuild + verify (requires a complete stamp). 20func prov_traceable(provenance_complete: i64) -> i64 { return provenance_complete } 21 22// the team only TRUSTS an artifact for a risky re-deploy if it is traceable AND its source-hash verifies. 23func prov_trust_for_redeploy(traceable: i64, hash_verifies: i64) -> i64 { 24 if traceable != 1 { return 0 } 25 if hash_verifies != 1 { return 0 } 26 return 1 27} 28 29// restore-on-next-build: an untraceable live artifact becomes traceable once the next clean build stamps it. 30func prov_restored(was_traceable: i64, next_build_stamped: i64) -> i64 { 31 if was_traceable == 1 { return 1 } 32 if next_build_stamped == 1 { return 1 } 33 return 0 34}