code wiki / _hdl_build / nx_cms_draft_team.nx

nx_cms_draft_team.nx source

↩ module page · 24 lines · 1611 B

1// nx_cms_draft_team.nx -- the TEAM authoring the DRAFT-PREVIEW core for the CMS arc (C9, no Claude 2// logic). The table IS the draft lifecycle: states 0=CLEAN (no pending draft; the public page serves 3// the published content) 1=DRAFTED (a pending draft exists alongside the published page); events 4// 0=SAVE_DRAFT 1=PUBLISH_DRAFT 2=DISCARD_DRAFT. PUBLISH_DRAFT and DISCARD_DRAFT from CLEAN are absent 5// from the table -> the authored core refuses them (-1) and the admin answers 409. Engineer verifies 6// the authored test. Same hands-off division as _pe_pub (CAPREG241): table = spec, emitter = author. 7import "nx_pattern_emit3.nx" 8import "nx_syscalls.nx" 9 10func cdt_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 11 12func main() -> i64 { 13 let t: *i64 = sys_mmap(8*12) as *i64 14 t[0]=0; t[1]=0; t[2]=1 // CLEAN --SAVE_DRAFT--> DRAFTED (working copy, public untouched) 15 t[3]=1; t[4]=0; t[5]=1 // DRAFTED --SAVE_DRAFT--> DRAFTED (keep drafting) 16 t[6]=1; t[7]=1; t[8]=0 // DRAFTED --PUBLISH_DRAFT--> CLEAN (draft promoted atomically) 17 t[9]=1; t[10]=2; t[11]=0 // DRAFTED --DISCARD_DRAFT--> CLEAN (draft set aside, additive) 18 let a: i64 = pe3_author_state_flow("_pe_draft" as *u8, 19 "runtime/_hdl_build/_pe_draft.nx" as *u8, 20 "runtime/_hdl_build/_pe_draft_test.nx" as *u8, t, 4) 21 if a == 1 { cdt_w("TEAM AUTHORED CORE: _pe_draft (STATE_FLOW draft-preview lifecycle, 4 transitions + refuse) -- verify with Engineer\n" as *u8); sys_exit(0) } 22 cdt_w("author failed\n" as *u8); sys_exit(1) 23 return 1 24}