code wiki / _hdl_build / nx_property_registry_gate.nx

nx_property_registry_gate.nx source

↩ module page · 36 lines · 3162 B

1// nx_property_registry_gate.nx -- gate the platform PROPERTY REGISTRY: data-driven domain->port, multi-domain 2// businesses rolling up to one backend, default fallthrough, comments. license_tier: ORIGINAL expect_exit: 0 3import "nx_syscalls.nx" 4import "_hdl_build/nx_property_registry.nx" 5import "nx_gate_verdict.nx" 6 7func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 8func g_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 9func g_check(name: *u8, cond: i64) -> i64 { if cond==1 { g_puts(" ok " as *u8); g_puts(name); g_puts("\n" as *u8); return 0 } g_puts(" FAIL " as *u8); g_puts(name); g_puts("\n" as *u8); return 1 } 10 11func main() -> i64 { 12 g_puts("=== nx_property_registry gate (data-driven domain -> backend port) ===\n" as *u8) 13 let cfg: *u8 = "# platform property registry: domain port tenancy group\nandelinwest.com 8453 third andelin-law\nnishifamily.com 8443 first personal\nwestindustrialdirect.com 8454 first west-industrial\nshop.westindustrialdirect.com 8454 first west-industrial\n" as *u8 14 let cn: i64 = g_slen(cfg) 15 var fails: i64 = 0 16 fails = fails + g_check("T1 andelinwest.com -> 8453 (third-party client)" as *u8, pr_lookup(cfg, cn, "andelinwest.com" as *u8, 15, 9999)==8453) 17 fails = fails + g_check("T2 nishifamily.com -> 8443 (first-party personal)" as *u8, pr_lookup(cfg, cn, "nishifamily.com" as *u8, 15, 9999)==8443) 18 fails = fails + g_check("T3 westindustrialdirect.com -> 8454 (first-party business)" as *u8, pr_lookup(cfg, cn, "westindustrialdirect.com" as *u8, 24, 9999)==8454) 19 fails = fails + g_check("T4 shop.westindustrialdirect.com -> 8454 (SAME business, multi-domain)" as *u8, pr_lookup(cfg, cn, "shop.westindustrialdirect.com" as *u8, 29, 9999)==8454) 20 fails = fails + g_check("T5 unknown.com -> default (so nothing breaks)" as *u8, pr_lookup(cfg, cn, "unknown.com" as *u8, 11, 9999)==9999) 21 fails = fails + g_check("T6 a comment line is not a route" as *u8, pr_lookup(cfg, cn, "#" as *u8, 1, 9999)==9999) 22 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, ENRICHMENT form). This gate 23 // enumerated NO checks -- it printed one summary line -- and the base class REFUSES to emit 24 // GREEN with zero checks (gv_verdict requires ctr[1] > 0), which is right: a gate that checked 25 // nothing must not read GREEN. So the only expressible migration enumerates the gate's OWN 26 // GREEN condition as exactly ONE check -- the guard below is copied verbatim, not rewritten. 27 // The PASS/FAIL vector therefore goes 0 -> 1. That is an ENRICHMENT, not a divergence, and 28 // nx_gate_migrate accepts it only because exit code and judge verdict are both preserved. 29 var t1__dry: i64 = 0 30 if fails==0 { t1__dry = 1 } 31 let ctr__dry: *i64 = gv_ctr() 32 gv_check("original GREEN condition (enumerated by nx_gate_dry_apply; the gate itself counted nothing)" as *u8, t1__dry, ctr__dry) 33 let rc__dry: i64 = gv_verdict("PROPERTY-REGISTRY-GATE" as *u8, ctr__dry, "teeth unchanged; verdict emission migrated onto the shared base class" as *u8) 34 sys_exit(rc__dry) 35 return rc__dry 36}