nx_alpha_release_workflow_gate_t343.nx source
↩ module page · 48 lines · 8097 B
1import "nx_site_publish_alpha_candidate_t343.nx"
2import "nx_wflow_engine.nx"
3import "nx_gate_verdict.nx"
4func wa_same(path:*u8,expected:*u8)->i64{let n:i64=vw_slen(expected);let b:*u8=sys_mmap_try(n+1);if (b as i64)<=0{return 0};let got:i64=pb_read_bounded(path,b,n+1);return pb_same_bytes(b,got,expected,n)}
5func wa_state(cx:*i64,rid:*u8)->i64{let n:*i64=sys_mmap(8) as *i64;let b:*u8=wf_readall(cx[2] as *u8,n);let t:*u8=sys_mmap(256);wf_obs_tok(t,rid);return wf_run_state(b,n[0],t)}
6func main(argc:i64,argv:*i64)->i64{
7 if argc!=2{return 2};if sys_mkdir(argv[1] as *u8,0x1ed)!=0||sys_chdir(argv[1] as *u8)!=0{return 3}
8 let fd:i64=sys_openat_wr("qualification-full.log",FSX_MODE_RW);if fd<0||sys_dup3(fd,1,0)!=1{return 4};sys_close(fd)
9 sys_mkdir("sites",0x1ed);sys_mkdir("sites/gatesite",0x1ed);sys_mkdir("sites/gatesite/alpha",0x1ed);sys_mkdir("sites/gatesite/releases",0x1ed);sys_mkdir("knowledge",0x1ed);sys_mkdir("knowledge/gates",0x1ed)
10 let conf:*u8="gatesite\tsites/gatesite\tknowledge/pub-\thttps://example.invalid\tGate\tprivate/\n"
11 if ss_writefile("knowledge/pub_sites.conf",conf,ss_len(conf))!=0{return 5}
12 let row:*i64=ss_begin_cap(64);ss_add(row,1,"q:n","0",1);if ss_commit("knowledge/pub-",row,ss_next_segid("knowledge/pub-"))!=0{return 5}
13 if pl_register_asset("knowledge/pub-","alpha/index.html","experimental workflow fixture")!=1{return 5}
14 let old:*u8="old consumer\n";if fsx_write("sites/gatesite/alpha/index.html",old,vw_slen(old))!=vw_slen(old){return 5}
15 let catalog:*u8="site_prepare\t/volume1/homes/elderwesto/nishihost/buildroot/_build/nx_site_publish_alpha_cli_t343.sov.elf\tGREEN\n"
16 if ss_writefile("connectors.conf",catalog,ss_len(catalog))!=0{return 5}
17 let c:*i64=gv_ctr();let initial:i64=ss_max_segid("knowledge/pub-");let a:*i64=sys_mmap(40) as *i64;a[0]="nx_site_publish" as *u8 as i64;a[1]="release-alpha-manifest" as *u8 as i64;a[4]=0
18 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-beta-t343.json" as *u8 as i64;a[3]="a1726a235a859b018ed0dbfd428fad4d9d36c582066edf15a087cfc35f5b27eb" as *u8 as i64;gv_check("actual manifest beta refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
19 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-traversal-t343.json" as *u8 as i64;a[3]="6263b16708359e50e4e882d49d3beed6285c6bb6fb09975eaf4090ede3e8548d" as *u8 as i64;gv_check("actual manifest traversal refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
20 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-backslash-t343.json" as *u8 as i64;a[3]="5ece208980eac36d6cfabf8d02c9e33a2442c02e1c53ff352329057d305a43ec" as *u8 as i64;gv_check("actual manifest backslash refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
21 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-encoded-t343.json" as *u8 as i64;a[3]="457338bb0fe0836f4086f88f4a18432cf825af5734258797e1ce2833c2a5705a" as *u8 as i64;gv_check("actual manifest encoded refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
22 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-dep-beta-t343.json" as *u8 as i64;a[3]="6ea0e7bdd253f87a5c41ec17a0a71ffa0b1823811d784f847c83d916397dfcbd" as *u8 as i64;gv_check("actual manifest dep-beta refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
23 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-dep-traversal-t343.json" as *u8 as i64;a[3]="92f9147cf15df52d214e087baa6e577327c36ad6ac1bea0c63eee888cf6c1bf4" as *u8 as i64;gv_check("actual manifest dep-traversal refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
24 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-dep-encoded-t343.json" as *u8 as i64;a[3]="5c9f2e94527ddd559157513fa27dc939892aa55d89a25cb13a7670c605cfe4e4" as *u8 as i64;gv_check("actual manifest dep-encoded refuses before registration or publication",sp_main(4,a)!=0&&ss_max_segid("knowledge/pub-")==initial&&wa_same("sites/gatesite/alpha/index.html",old)==1,c)
25 let cx:*i64=sys_mmap(40) as *i64;let flows:*i64=sys_mmap(512) as *i64
26 let nf:i64=wf_cx_files("/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/component-release-preparation-candidate-t343.flows","/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/component-release-preparation-candidate-t343.steps","runs.log","connectors.conf",cx,flows)
27 if nf!=2{return 6}
28 let event:*u8="release-alpha-experimental~stage=alpha~product=gate~component=character~manifest=/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-fixture-t343.json~manifest_sha256=397740555e7e4f3ec2c2d4cf81910b6fcd033b3a96fd99e4f1f91480c4732bc3~id=GOOD"
29 let fired:i64=wf_fire(cx,flows,nf,event)
30 gv_check("durable workflow published and DONE",fired==1&&wa_state(cx,"GOOD.component-alpha-experimental")==3&&wa_same("sites/gatesite/alpha/index.html.prev",old)==1,c)
31 let gen:i64=ss_max_segid("knowledge/pub-")
32 a[2]="/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-negative-dep-immutable-t343.json" as *u8 as i64;a[3]="2d47eab40ff3ccdba28a79a09e416ecdd51b33697706561e5edb0822f2bf5b87" as *u8 as i64
33 gv_check("existing shared release identity cannot be replaced",sp_main(4,a)==PB_RC_CONFLICT&&ss_max_segid("knowledge/pub-")==gen&&rm2_existing("sites/gatesite/releases/connected-body-static-0c3b7cdd15bd81990fe7bc0f6e23096ec0bde00d74cf00df1568eb8dd2e0956e.json","1261","0c3b7cdd15bd81990fe7bc0f6e23096ec0bde00d74cf00df1568eb8dd2e0956e")==0,c)
34 gv_check("same event deduplicates",wf_fire(cx,flows,nf,event)==(0-100)&&ss_max_segid("knowledge/pub-")==gen,c)
35 let rid:*u8="CRASH.component-alpha-experimental";let fid:*u8="component-alpha-experimental"
36 if wf_emit("runs.log",rid,fid,0,"START",0)!=0{return 7};if wf_bind_event(cx,rid,event)<0{return 7}
37 if wf_emit("runs.log",rid,fid,1,"OK",1)!=0{return 7};if wf_emit("runs.log",rid,fid,2,"OK",1)!=0{return 7};if wf_emit("runs.log",rid,fid,3,"OK",1)!=0{return 7};if wf_emit("runs.log",rid,fid,4,"ATT",1)!=0{return 7}
38 gv_check("committed ATT without OK is running not DONE",wa_state(cx,rid)==0,c)
39 gv_check("uncertain commit resume unchanged and DONE",wf_resume(cx)==1&&wa_state(cx,rid)==3&&ss_max_segid("knowledge/pub-")==gen&&wa_same("sites/gatesite/alpha/index.html.prev",old)==1,c)
40 let bad:*u8="release-alpha-experimental~stage=alpha~product=gate~component=character~manifest=/volume1/homes/elderwesto/nishihost/buildroot/knowledge/gates/alpha-workflow-fixture-t343.json~manifest_sha256=0000000000000000000000000000000000000000000000000000000000000000~id=FAIL"
41 gv_check("started is not delivered on terminal failure",wf_fire(cx,flows,nf,bad)==1&&wa_state(cx,"FAIL.component-alpha-experimental")==2,c)
42 gv_check("terminal failure not automatically resumed",wf_resume(cx)==0,c)
43 let parkflows:*i64=sys_mmap(8) as *i64;parkflows[0]="park|review|-" as *u8 as i64;let parksteps:*i64=sys_mmap(8) as *i64;parksteps[0]="park|1|approve|operator|fixture-only|1" as *u8 as i64
44 let pc:*i64=sys_mmap(40) as *i64;pc[0]=parksteps as i64;pc[1]=1;pc[2]="park.log" as *u8 as i64;pc[3]=0;pc[4]=1
45 gv_check("parked remains distinct from DONE",wf_fire(pc,parkflows,1,"review~id=PARK")==1&&wa_state(pc,"PARK.park")==1,c)
46 wf_obs_board("runs.log");wf_obs_board("park.log")
47 return gv_verdict("ALPHA-DURABLE-RELEASE",c,"isolated native store, real descriptor dependency, no production mutation; served review separate")
48}