code wiki / _hdl_build / nx_queue_drain.nx

nx_queue_drain.nx

buildroot/runtime/_hdl_build/nx_queue_drain.nx

9471 B148 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic queue
docsdependenciesstructsconstsfunctions

about

nx_queue_drain.nx -- THE ANTI-PUBLISHER-DEATH SPINE: decide + disposition every queued gap so the queue DRAINS, never "clogs and dies." Operator 2026-07-04: "we need THEM to DECIDE and get these things FIXED till they are trusted like you are -- i can't have the nishi publisher situation where the queue clogs and dies." GROUNDED (researcher): dead-letter queue (a failed item gets a FAILED disposition, is NEVER silently dropped/ stuck -- drain_deadletter.raw) + Little's law (if arrival-rate > service-rate, depth -> infinity = the death; so we MEASURE fill-vs-drain and ALARM -- drain_littleslaw.raw). COMPOSES the proven anti-clog primitives: nx_eval_queue (the work items + the new _key/_status/_close enumeration) + the hostop_watchdog pattern (heartbeat so a hung drainer is RESTARTED, not silently dead). THE GUARANTEE (why it can't clog + die): (1) EVERY OPEN item gets a DISPOSITION each pass -- routed to its owner (a council proposal for high-blast; auto-close for done-evidence) or DEAD-LETTERED with a reason if it cannot be processed. Nothing stays silently OPEN forever. (2) The drainer HEARTBEATS -> a watchdog relaunches it if it hangs. (3) A HEALTH census reports remaining/dead-lettered + ALARMS if remaining only grows (fill > drain) -- the publisher-death DETECTOR that was missing. HONEST: it DECIDES + ROUTES + tracks every item; it does not claim to auto-FIX arbitrary gaps (targeted synthesis is the team's open arc) -- unfixable-here items are dead-lettered + ESCALATED (visible), the trust-building transparency. license_tier: ORIGINAL genealogy_id: international-research-sources/{dead_letter_queue,littles_law} + operator-2026-07-04-queue-death lineage_id: nishi_queue_drain_v1 expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_eval_queue.nx nx_queue_drain.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_eval_queue.nx

imported by: nobody (leaf or entry point)

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

main qd_puts sys_write qd_beat sys_openat_wr sys_now_realtime_sec sys_mmap sys_clock_gettime_real sys_mmap ↻ sys_write ↻ sys_close nx_eval_queue_count sys_mmap ↻ ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn sys_mmap ↻ ss_cat ss_readall sys_munmap ss_scan_seglist ss_len sys_mmap ↻ ss_cat ↻ ss_readall ↻ ss_r32 EQ_PREFIX qd_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap ↻ sys_mmap ↻ nx_eval_queue_key sys_mmap ↻

structs

none

consts

24const QD_HEARTBEAT: *u8 = "knowledge/status/queue_drain.hb\x00" // watchdog-monitored liveness beat
25const QD_HEALTH: *u8 = "knowledge/status/queue_health.log\x00" // fill/drain/alarm signal (UI + monitor)
26const QD_MAX_PASS: i64 = 4096 // JPL bounded loop (never unbounded)

functions

28func qd_puts(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 1: main calls 1: sys_write
33func qd_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
34func qd_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: qd_field
35func qd_eq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
called by 2: qd_dispositionmain
38func qd_beat() -> i64
51func qd_disposition(status: *u8) -> *u8
called by 1: main calls 1: qd_eq
59func qd_field(fd: i64, key: *u8, num: i64) -> i64
68func qd_health_line(depth: i64, disp: i64, inrev: i64, dead: i64, stuck: i64, alarm: i64) -> i64
85func main() -> i64