code wiki / _hdl_build / nx_mgmt_api_gate.nx

nx_mgmt_api_gate.nx

buildroot/runtime/_hdl_build/nx_mgmt_api_gate.nx

46970 B707 linesdepth 18pulls 86 transitivereach 0 importersview sourcekind gate/prooftopic mgmt
docsdependenciesstructsconstsfunctions

about

nx_mgmt_api_gate.nx -- SOVEREIGN in-process referee for the ecosystem control-plane API. NO socket, NO curl, NO shell: arms a realm + registers an admin via the real Modern Auth, writes snapshot FIXTURES via syscalls, then feeds crafted HTTP request BYTES straight into the pure router ma_handle and asserts the response bytes. Proves the "true monitoring, no false +/-" property mechanically: T1 GET /api -> 200 + route index (public) T2 POST /api/login (correct) -> 200 + {"token":...} (mint no-cookie session) T3 GET /api/health (degraded) +tok -> 200 DEGRADED + dueling-supervisors + crash-loop (no false-GREEN) T4 GET /api/health NO tok -> 401 (infra state default-deny) T5 GET /api/services(degraded) +tok -> 200 + the down/loop svc + "dup":1 (per-svc truth) T6 POST /api/deploy NO tok -> 401 (privileged route GUARDED) T7 POST /api/deploy +tok -> 501 (route reserved; honest, not faked) T8 GET /api/health (healthy) +tok -> 200 + overall OK (no false-RED) T9 GET /api/bogus -> 404 T10 GET /api/health (MISSING snap) +tok -> 200 + UNKNOWN + no-snapshot (no false-GREEN on absent data) GREEN iff T1..T10 hold. Sovereign: nx_mgmt_api + nx_modern_auth_flow + nx_syscalls. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_mgmt_api.nx nx_gate_verdict.nx nx_modern_auth_flow.nx nx_syscalls.nx nx_mgmt_api_gate.nx

imports: nx_mgmt_api.nxnx_gate_verdict.nxnx_modern_auth_flow.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mg_organ_capacity_gate gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ sys_now_ms sys_mmap ↻ sys_clock_gettime_mono sys_mkdir sys_chdir sys_mmap ↻ sys_openat_exclusive sys_write ↻ sys_close oa_call sys_mmap ↻ ma_do_organ_run ma_emit_400 sd_cat ma_emit_json sd_cat ↻ sd_catn sd_body_off

structs

none

consts

29const MG_CHECKS: i64 = 22

functions

33func g_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: g_rowmg_api_legacy_main calls 1: sys_write
34func g_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
35func g_row(name: *u8, ok: i64) -> i64
called by 1: mg_api_legacy_main calls 1: g_w
42func g_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o + i] = s[i]; i = i + 1 } return o + i }
called by 1: mg_api_legacy_main
43func g_find(hay: *u8, hn: i64, ndl: *u8) -> i64 { var nl: i64=0; while ndl[nl]!=(0 as u8){nl=nl+1} if nl==0 { return 0-1 } var s: i64=0; while s+nl<=hn { var m: i64=1; var k: i64=0; while k<nl { if hay[s+k]!=ndl[k] { m=0; k=nl } else { k=k+1 } } if m==1 { return s } s=s+1 } return 0-1 }
called by 1: mg_api_legacy_main
44func g_cat_n(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { d[o + i] = s[i]; i = i + 1 } return o + n }
called by 1: mg_api_legacy_main
45func g_trunc(path: *u8) -> i64 { let fd: i64 = sys_openat_wr(path, 0x180); if fd >= 0 { sys_close(fd) } return 0 }
46func g_log(s: *u8) -> i64
51func g_write_file(path: *u8, s: *u8) -> i64
58func g_starts(buf: *u8, n: i64, s: *u8) -> i64
65func g_contains(hay: *u8, n: i64, needle: *u8) -> i64
77func g_extract_token(resp: *u8, n: i64, out: *u8) -> i64
called by 1: mg_api_legacy_main
102func mg_args_case(label: *u8, input: *u8, encoded: i64, cap: i64, maxargs: i64, expected: i64, ctr: *i64) -> i64
109func mg_args_gate() -> i64
145func mg_release_identity_gate(expected: *u8) -> i64
173func mg_tc_fixture_elf(path: *u8, tag: i64) -> i64
183func mg_tc_tag(path: *u8) -> i64
192func mg_tc_bank_gate() -> i64
235func oa_contains(b:*u8,n:i64,s:*u8)->i64{let z:i64=sd_len(s);var p:i64=0;while p+z<=n{var k:i64=0;while k<z{if b[p+k]!=s[k]{break};k=k+1};if k==z{return 1};p=p+1};return 0}
236func oa_call(form:*u8,out:*u8)->i64
241func oa_refuse(c:*i64,label:*u8,form:*u8,out:*u8)->i64
245func mg_organ_capacity_gate()->i64
291func main(argc: i64, argv: *i64) -> i64
299func mg_api_legacy_main() -> i64