code wiki / (root) / nx_barfresh_gate.nx

nx_barfresh_gate.nx

buildroot/runtime/nx_barfresh_gate.nx

16866 B219 linesdepth 4pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_barfresh_gate.nx -- GATE for the bar-age ruler (nx_barfresh_lib), driven IN-PROCESS on planted plan rows with the current month HANDED IN, so every state is reached deterministically: a fresh bar, an older bar nobody looked for this month (the hard fail), an older bar attested this month as the newest the listing has, an older bar a this-month scan contradicts, an attestation from LAST month (does not count), an attestation for a DIFFERENT listing (does not count), a plan with no bars (NO-BAR, not refused), malformed and future months, a year wrap, NUL-terminated lines as the ranker hands them over, a mixed board whose partition must sum, a declaration made twice (a repeated bar id, a repeated same-day scan) refused with its rule named while two scans on different days stay two attestations, the month-of-epoch derivation against the estate's own civil date at a month boundary, and the two-tree plan read on /tmp trees. Every fixture asserts its own condition first. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gatekit_lib.nx nx_barfresh_lib.nx nx_gate_verdict.nx nx_barfresh_gate.nx

imports: nx_syscalls.nxnx_gatekit_lib.nxnx_barfresh_lib.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ bf_ym_index sys_mmap ↻ gv_check_eq gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap bf_ym_year bf_ym_month bf_parse_ym bf_is_digit bf_ym_index ↻ bf_parse_newest bf_parse_ym ↻ bf_ym_of_epoch sys_mmap ↻ civil_from_days

structs

none

consts

15const G_ROOT: *u8 = "/tmp/nx_barfresh_gate"
16const G_TREE_A: *u8 = "/tmp/nx_barfresh_gate/a/"
17const G_TREE_B: *u8 = "/tmp/nx_barfresh_gate/b/"
18const G_TREE_A_DIR: *u8 = "/tmp/nx_barfresh_gate/a"
19const G_TREE_B_DIR: *u8 = "/tmp/nx_barfresh_gate/b"
20const G_PLAN_B: *u8 = "/tmp/nx_barfresh_gate/b/probe.plan"
21const G_DOM: *u8 = "probe"
22const G_DOM_ABSENT: *u8 = "nowhere"
23const G_I64: i64 = 8
24const G_MAX_BARS: i64 = 8
26const G_CUR_Y: i64 = 2026
27const G_CUR_M: i64 = 9
28const G_WRAP_Y: i64 = 2026
29const G_WRAP_M: i64 = 1
31const G_EPOCH_AUG31: i64 = 1788134400
32const G_EPOCH_SEP01: i64 = 1788220800
33const G_DAY_2026_09_06: i64 = 20702
34const G_Y_1970: i64 = 1970
36const G_FRESH: *u8 = "rung|X1|a rung|sym|d|Organ|1|-\nsotabar|B1|2026-09|aspect extraction|what september says|k1|note\n"
37const G_UNATTESTED: *u8 = "rung|X1|a rung|sym|d|Organ|1|-\nsotabar|B1|2026-08|aspect extraction|what august says|k1|note\n"
38const G_ATTESTED: *u8 = "rung|X1|a rung|sym|d|Organ|1|-\nsotabar|B1|2026-08|aspect extraction|what august says|k1|note\nbarscan|2026-09-06|k1|newest=2026-08|the listing was read, newest entry august\n"
39const G_CONTRADICTED: *u8 = "sotabar|B1|2026-07|aspect extraction|what july says|k1|note\nbarscan|2026-09-06|k1|newest=2026-08|the listing has an august entry the bar ignores\n"
40const G_OLD_SCAN: *u8 = "sotabar|B1|2026-08|aspect extraction|what august says|k1|note\nbarscan|2026-08-30|k1|newest=2026-08|a scan from last month\n"
41const G_OTHER_REF: *u8 = "sotabar|B1|2026-08|aspect extraction|what august says|k1|note\nbarscan|2026-09-06|k2|newest=2026-08|a scan of a different listing\n"
42const G_NOBAR: *u8 = "rung|X1|a rung|sym|d|Organ|1|-\nlog|1|X1|measure|no bars declared\n"
43const G_MALFORMED: *u8 = "sotabar|B1|2026-13|subject|says|k1|thirteenth month\n"
44const G_FUTURE: *u8 = "sotabar|B1|2026-10|subject|says|k1|a month that has not happened\n"
45const G_WRAP: *u8 = "sotabar|B1|2025-12|subject|says|k1|note\nbarscan|2026-01-03|k1|newest=2025-12|december attested in january\n"
46const G_MIXED: *u8 = "sotabar|B1|2026-09|subject|says|k1|fresh\nsotabar|B2|2026-08|subject|says|k2|nobody looked\n"
47const G_MIXED_BARS: i64 = 2
50const G_DUPBAR: *u8 = "sotabar|B1|2026-09|subject|says|k1|declared once\nsotabar|B1|2026-09|subject|says again|k1|declared twice\n"
51const G_DUPBAR_BARS: i64 = 2
52const G_DUPSCAN: *u8 = "sotabar|B1|2026-08|subject|says|k1|note\nbarscan|2026-09-06|k1|newest=2026-08|read once\nbarscan|2026-09-06|k1|newest=2026-08|the same read landed twice\n"
53const G_DUPSCAN_SCANS: i64 = 2
54const G_TWO_SCANS: *u8 = "sotabar|B1|2026-08|subject|says|k1|note\nbarscan|2026-09-02|k1|newest=2026-08|read early in the month\nbarscan|2026-09-06|k1|newest=2026-08|read again on another day\n"
55const G_RULE_BAR_DUP: *u8 = "BAR-DUPLICATE"
56const G_RULE_SCAN_DUP: *u8 = "SCAN-DUPLICATE"
57const G_RULE_NONE: *u8 = "NONE"

functions

60func g_str_is(a: *u8, b: *u8) -> i64
called by 1: main calls 1: bf_slen
68func g_copy(src: *u8) -> *u8
called by 1: main calls 2: bf_slensys_mmap
79func g_run(fx: *u8, cur: i64, c: *i64, st0: *i64, seen0: *i64) -> i64
called by 1: main calls 3: sys_mmapbf_classifybf_slen
91func main() -> i64