code wiki / _hdl_build / nx_signal_capture.nx
nx_signal_capture.nx source
↩ module page · 54 lines · 4721 B
1// nx_signal_capture.nx -- the ENGINEER's SIGNAL CAPTURER (operator: "we dont want dodging -- all of this
2// should hit the backlog with a nishi team member capturing these signals"). When a build/run anomaly is
3// OBSERVED (compile-fail, runtime segfault, no-output miscompile, OR a workaround/dodge applied), this organ
4// FILES it as a tracked backlog signal -- with a REPRO and a root-cause route -- so nothing is silently
5// dodged. Composes the PM (WSJF) + the issues/review logs, the same intake the monitors call. The build
6// runner + the polite loop call sig_file() on every anomaly; main() here seeds the REAL signals observed this
7// session (the recursive-reach miscompile + the iterative workaround as debt). license_tier: ORIGINAL
8import "nx_pm_decision_matrix.nx"
9import "nx_pm_review_log.nx"
10import "nx_syscalls.nx"
11
12func sc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
13func sc_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(1,b,k); return 0 }
14
15// FILE one observed signal as a tracked backlog item (issues log + PM). kind/severity classify it; fix is the
16// root-cause route; repro is the module that reproduces it. Reusable -- any monitor/gate/loop calls this.
17func sig_file(ifd: i64, pm: i64, kind: *u8, module: *u8, sev: i64, eff: i64, tutor: i64, fix: *u8, repro: *u8) -> i64 {
18 let wsjf: i64 = dm_wsjf(sev*10, eff)
19 pm_w(ifd, "SIGNAL kind=" as *u8); pm_w(ifd, kind); pm_w(ifd, " module=" as *u8); pm_w(ifd, module)
20 pm_w(ifd, " sev=" as *u8); let b: *u8=sys_mmap(8); var m: i64=sev; var k: i64=0; if m==0{b[0]=48 as u8;k=1}; while m>0{b[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var z: i64=0; let r: *u8=sys_mmap(8); while z<k{r[z]=b[k-1-z];z=z+1}; sys_write(ifd,r,k)
21 pm_w(ifd, " repro=" as *u8); pm_w(ifd, repro); pm_w(ifd, " :: " as *u8); pm_w(ifd, fix); pm_w(ifd, "\n" as *u8)
22 if tutor == 1 { pm_flag(pm, "SIGNAL-TUTOR" as *u8, module, "NEEDS-TUTOR" as *u8, kind, fix) }
23 else { pm_flag(pm, "SIGNAL-OWNED" as *u8, module, "TEAM-OWNED" as *u8, kind, fix) }
24 return wsjf
25}
26
27func main() -> i64 {
28 sc_puts("=== SIGNAL CAPTURE -- build/run anomalies -> tracked backlog (no silent dodging) ===\n\n" as *u8)
29 let ifd: i64 = sys_openat_append("/tmp/nishi_issues.log" as *u8, 0x1a4)
30 pm_w(ifd, "\n# SIGNAL CAPTURE 2026-06-06 (observed anomalies filed -- the dodge is now visible work)\n" as *u8)
31 let pm: i64 = pm_open("/tmp/nishi_pm_review.log" as *u8)
32
33 // SIGNAL 1 -- the real one we hit: STABLE compile, runtime SEGFAULT = a miscompile (NOT the known
34 // nondeterminism; the determinism guard PASSED retries=0). Root cause suspected in the regalloc (W2 keystone).
35 let w1: i64 = sig_file(ifd, pm,
36 "RUNTIME-SEGFAULT-ON-STABLE-COMPILE" as *u8, "nx_backlog_loop" as *u8, 9, 6, 1,
37 "sovereign cc emits a byte-stable binary that SEGFAULTS at runtime -> codegen MISCOMPILE (recursive bl_reach suspect). Add the recursive-reach module to the compiler test CORPUS as a KAT; root-cause in regalloc -> folds into W2; Claude tutors the regalloc fix; Engineer gates byte-stable+correct." as *u8,
38 "nx_backlog_loop" as *u8)
39 sc_puts("FILED #1 wsjf=" as *u8); sc_num(w1); sc_puts(" RUNTIME-SEGFAULT-ON-STABLE-COMPILE (nx_backlog_loop) -> tutor/W2\n" as *u8)
40
41 // SIGNAL 2 -- the DODGE itself, filed as DEBT so it is not hidden: we substituted iterative reach to make
42 // progress, but the recursive path stays BROKEN until signal #1 is fixed. Revert-to-recursive is the gate.
43 let w2: i64 = sig_file(ifd, pm,
44 "WORKAROUND-DEBT" as *u8, "nx_polite_loop" as *u8, 5, 2, 0,
45 "iterative reach substituted to dodge signal#1 so the loop runs; this is DEBT -- recursion stays broken. Tracked so the dodge does not hide the root cause; after W2 fixes the miscompile, revert nx_polite_loop to the recursive path and confirm it runs = the regression test." as *u8,
46 "nx_polite_loop" as *u8)
47 sc_puts("FILED #2 wsjf=" as *u8); sc_num(w2); sc_puts(" WORKAROUND-DEBT (nx_polite_loop iterative dodge) -> team-owned, revert-after-W2\n" as *u8)
48
49 sys_close(ifd); sys_close(pm)
50 sc_puts("\n>>> 2 signals captured to /tmp/nishi_issues.log + the PM review log. The dodge is now VISIBLE WORK\n" as *u8)
51 sc_puts(">>> linked to the W2 regalloc keystone, with nx_backlog_loop as the repro/KAT. STANDING: the build\n" as *u8)
52 sc_puts(">>> runner + polite loop call sig_file() on every anomaly -> the team captures, never dodges silently.\n" as *u8)
53 sys_exit(0); return 0
54}