code wiki / (root) / nx_field_beat_lib.nx

nx_field_beat_lib.nx

buildroot/runtime/nx_field_beat_lib.nx

9295 B193 linesdepth 2pulls 2 transitivereach 5 importersview sourcekind librarytopic field
docsdependenciesstructsconstsfunctions

about

nx_field_beat_lib.nx -- THE DECISION CORE OF THE FIELD BEAT (/compare/fieldwatch FW4, 2026-09-05). Pure functions only, so nx_field_beat_gate drives every decision in-process on fixtures assembled at runtime: which domains a list names, what a discover receipt says, how one run is classified, where the stamp goes and what it says. The program (nx_field_beat) owns the forks and the file writes; nothing here touches the network or the evidence store. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_field_beat_lib.nx nx_field_beat.nx nx_field_beat_gate.nx nx_field_seedgen_lib.nx

imports: nx_syscalls.nx

imported by: nx_field_beat.nxnx_field_beat_gate.nxnx_field_seedgen_lib.nx

structs

none

consts

8const FB_NAME_CAP: i64 = 64 // one domain name slot; the longest name on regen.list is 16 bytes, a longer one is cut and the cut is visible in the stamp's domains= count staying honest
9const FB_MAX_DOMAINS: i64 = 256 // regen.list carries 111 domains today; a list past this sets capped=1 (a FLOOR, announced), never a silent cut
10const FB_CH_NL: i64 = 10
11const FB_CH_CR: i64 = 13
12const FB_CH_HASH: i64 = 35
13const FB_CH_SP: i64 = 32
14const FB_CH_EQ: i64 = 61
15const FB_CH_MINUS: i64 = 45
16const FB_CH_0: i64 = 48
17const FB_CH_9: i64 = 57
18const FB_NUM_BASE: i64 = 10
19const FB_NUM_W: i64 = 24
20const FB_UNPARSED: i64 = 0 - 1 // a field the receipt did not carry: its own bucket, never a zero
21const FB_CLASS_OK: i64 = 1
22const FB_CLASS_SKIP: i64 = 2 // no seeds file: the domain has declared no field yet, so there is nothing to re-read
23const FB_CLASS_FAIL: i64 = 3
24const FB_STAMP_DEFAULT: *u8 = "knowledge/status/fieldbeat.stamp"
25const FB_STAMP_SUFFIX: *u8 = ".stamp"
26const FB_OK_LINE: *u8 = "FIELD-OK "
27const FB_STAMP_HEAD: *u8 = "fieldbeat" // every stamp key is space-preceded, so one span reader serves receipt and stamp

functions

29func fb_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
30func fb_streq(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: mainsg_is_stop
31func fb_puts(fd: i64, s: *u8) -> i64 { sys_write(fd, s, fb_slen(s)); return 0 }
32func fb_putn(fd: i64, v: i64) -> i64
44func fb_cat(dst: *u8, off: i64, s: *u8, cap: i64) -> i64
52func fb_domain_at(names: *u8, i: i64) -> *u8 { return ((names as i64) + i * FB_NAME_CAP) as *u8 }
56func fb_list_domains(b: *u8, n: i64, names: *u8, capped: *i64) -> i64
called by 3: mainmainmain calls 1: fb_domain_at
87func fb_prefix_at(b: *u8, s: i64, e: i64, lit: *u8) -> i64
94func fb_ok_line(cap: *u8, n: i64, s_out: *i64, e_out: *i64) -> i64
106func fb_span_int(b: *u8, s: i64, e: i64, key: *u8) -> i64
129func fb_receipt_ok(cap: *u8, n: i64) -> i64
called by 2: fw_beatmain calls 2: sys_mmapfb_ok_line
134func fb_receipt_int(cap: *u8, n: i64, key: *u8) -> i64
142func fb_classify(rc: i64, ok: i64, seeds_present: i64) -> i64
called by 2: fw_beatmain
147func fb_class_name(c: i64) -> *u8
called by 2: fw_beatfb_jrnl_row
154func fb_stamp_path(list: *u8, is_default: i64, dst: *u8, cap: i64) -> i64
called by 2: mainmain calls 1: fb_cat
159func fb_stamp_verdict(ok: i64, failed: i64) -> *u8
165func fb_stamp_write(fd: i64, ts: i64, list: *u8, domains: i64, ok: i64, failed: i64, skipped: i64, cands: i64, capped: i64, drifted: i64) -> i64
183func fb_jrnl_row(fd: i64, ts: i64, dom: *u8, cls: i64, rc: i64, cands: i64, named: i64, failed_seeds: i64) -> i64
called by 1: fw_beat calls 3: fb_putsfb_putnfb_class_name