code wiki / _hdl_build / nx_reader_coordinate.nx
nx_reader_coordinate.nx source
↩ module page · 65 lines · 5486 B
1// nx_reader_coordinate.nx -- COORDINATE WITH THE NISHI TEAM (operator 2026-06-21: "keep going and coordinate with
2// the nishi team"). The reader/library arc has reached a strong state but carries cross-workstream items that are
3// NOT the reader workstream's to resolve alone. This organ posts structured COORD-HANDOFF rows into the team's
4// shared channel (knowledge/channel/team_out.tsv -- the same "one-read picture" the express lane + conductor read),
5// under the team_out advisory lock (rt_lock), so a concurrent writer can't interleave (mirrors nx_express_lane's
6// locked write-session idiom). Each row names the OWNING workstream + the need + the evidence -> the team picks it
7// up. Coordination, not solo-driving (feedback-sovereign-ops-coordinate-workstreams). expect_exit: 0 ORIGINAL
8import "nx_registry_lock.nx" // rt_lock / rt_unlock (+ nx_syscalls transitive)
9
10func co_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
11func co_fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
12func co_fn(fd: i64, v: i64) -> i64 { let bb: *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{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
13func co_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
14func co_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ dst[off+i]=s[i]; i=i+1 } return off+i }
15
16// one COORD-HANDOFF row to team_out: COORD-HANDOFF\tfrom=nishi-reader\tto=<ws>\tepoch=<now>\tneed=<need>\tevidence=<ev>
17func coord_row(fd: i64, now: i64, to: *u8, need: *u8, ev: *u8) -> i64 {
18 co_fp(fd, "COORD-HANDOFF\tfrom=nishi-reader\tto=" as *u8); co_fp(fd, to)
19 co_fp(fd, "\tepoch=" as *u8); co_fn(fd, now)
20 co_fp(fd, "\tneed=" as *u8); co_fp(fd, need)
21 co_fp(fd, "\tevidence=" as *u8); co_fp(fd, ev)
22 co_fp(fd, "\n" as *u8)
23 return 1
24}
25
26func main() -> i64 {
27 co_p("=== nx_reader_coordinate: post reader-arc cross-workstream handoffs to the team channel ===\n" as *u8)
28 let top: *u8 = "knowledge/channel/team_out.tsv" as *u8
29 __syscall(258, 0-100, "knowledge/channel" as *u8, 0x1ed, 0, 0, 0) // mkdir knowledge/channel (idempotent)
30 let now: i64 = sys_now_realtime_sec()
31
32 // lock the whole write session (team_out advisory lock), as the express lane does.
33 let lkp: *u8 = sys_mmap(512)
34 var lo: i64 = co_cat(lkp, 0, top); lo = co_cat(lkp, lo, ".lock" as *u8); lkp[lo] = 0 as u8
35 let lkfd: i64 = rt_lock(lkp)
36 let fd: i64 = sys_openat_append(top, 0x1a4)
37 if fd < 0 { co_p(" team_out open failed\n" as *u8); if lkfd>=0 { rt_unlock(lkp, lkfd) } sys_exit(1); return 1 }
38
39 co_fp(fd, "COORD-BLOCK from=nishi-reader epoch=" as *u8); co_fn(fd, now)
40 co_fp(fd, " arc=reader/library-sclass: zero-JS reader+shelf, organ-emitted, measured-EXCEEDS=4, a11y, artwork, reading-time, print; published THROUGH the publisher (ledger-verified) + signed receipts. coverage=459permil. NEEDS team coordination on:\n" as *u8)
41
42 var n: i64 = 0
43 n = n + coord_row(fd, now, "compiler-nxc2" as *u8,
44 "fix nx_cc REGALLOC NONDETERMINISM -- nx_pub_reader_receipt COMPILE-FAILs 'empty .s after retries' though the SAME source compiled 7/7 earlier this turn and nx_pub_receipt_gate (1040710B, bigger, same ed25519) compiles GREEN 13/13 now; tried lean-refactor + register-pressure-reduction, no fix" as *u8,
45 "knowledge.knowngood-compiler-regpressure-miscompile; project-nishi-reader-night-pdf-arc-2026-06-16 (TOOLCHAIN SNAG)" as *u8)
46 n = n + coord_row(fd, now, "publisher" as *u8,
47 "RECONCILE the pub_mkdirp addition i made to nx_publisher.nx (create dest PARENT subdirs in pub_deploy so nested artifacts e.g. reader/<slug>/cover.png ship) -- additive, idempotent, flat dests unaffected" as *u8,
48 "nx_pub_reader_handoff_gate 9/0 + publisher deploy/promote/bluegreen/canary STILL 4/4 (no regression)" as *u8)
49 n = n + coord_row(fd, now, "library-foundation" as *u8,
50 "R-ART-2 FOUNDATION: upgrade extracted reader image assets (cover/figures) from djb2 fingerprint to canonical CID + ed25519 + lineage-to-god via nx_library_foundation/nx_ingest_foundation (SC55 PARTIAL->HAVE)" as *u8,
51 "nx_epub_art_gate 11/0; assets content-fingerprinted+served; foundation = library-ws domain" as *u8)
52 n = n + coord_row(fd, now, "sites-daemon" as *u8,
53 "DEPLOY the zero-JS reader+shelf: wire knowledge/publish/reader-live/* into the daemon route + the OPERATOR-GATED outward R8 transport liveroot->nishifamily.com; needs real NAS book content too" as *u8,
54 "reader-live ledger (verify-then-promote) + reader-receipts.tsv (Ed25519-signed); nx_pub_reader_handoff_gate 9/0" as *u8)
55
56 co_fp(fd, "COORD-BLOCK-END from=nishi-reader handoffs=" as *u8); co_fn(fd, n)
57 co_fp(fd, " note=reader-ws continues solo on non-blocked zero-JS capabilities; these 4 need their owning workstreams\n" as *u8)
58 sys_close(fd)
59 if lkfd>=0 { rt_unlock(lkp, lkfd) }
60
61 co_p(" posted " as *u8); co_fn(1, n); co_p(" COORD-HANDOFF rows -> knowledge/channel/team_out.tsv (locked, team-visible)\n" as *u8)
62 co_p(" targets: compiler-nxc2 (nx_cc regalloc) | publisher (pub_mkdirp) | library-foundation (R-ART-2 CID) | sites-daemon (deploy+R8)\n" as *u8)
63 if n == 4 { sys_exit(0); return 0 }
64 sys_exit(1); return 1
65}