code wiki / (root) / nx_srcreach_gate.nx

nx_srcreach_gate.nx

buildroot/runtime/nx_srcreach_gate.nx

10676 B174 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_srcreach_gate.nx -- THE GATE FOR THE SOURCE REGISTRY READER AND THE PACE BUDGET (/compare/researchreach RR1, RR3). IN-PROCESS ON PURPOSE. It imports nx_srcreg_lib and calls sr_classify and sr_pace directly rather than forking a deployed elf, for three reasons: it is deterministic (no network, no host in the loop, so it cannot flake), it is fast enough to sit on a roster, and it is MUTATION-SENSITIVE -- a change to the classifier or the budget arithmetic shows up here immediately, which is what makes nx_gate_bite able to say anything about it at all. WHY THIS GATE EXISTS: nx_srcreach decides which of the estate's declared research sources are usable and how many outbound requests a sweep may spend. A reader that silently drops a row it cannot parse under-reports coverage in the FLATTERING direction, and a budget that understates its cost is how an array gets hammered. Both failures are quiet, so both need a gate that fires rather than a habit that remembers. EVERY BAD CLASS IS PLANTED AND EVERY PLANT MUST BE CAUGHT, and the POSITIVE CONTROL is the half that matters most: a clean registry must read entirely OK. A classifier that refused everything would pass every planted-defect tooth while being useless, so the clean-reads-clean teeth are what separate a working ruler from a broken one. THE BUDGET IS ASSERTED AGAINST HAND-COMPUTED VALUES with gv_check_eq, so the number tested and the number printed are the same expression and cannot drift apart. Fixtures are assembled at RUNTIME in this gate's own /tmp directory, never shared with a production beat. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_srcreg_lib.nx nx_srcreach_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_srcreg_lib.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 ↻ sys_mkdir srg_write sys_openat_wr sys_write ↻ sys_close gv_check gv_puts ↻ sys_mmap ↻ sr_load sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻ sr_count_rows sr_line_end sr_line_starts gv_check_eq

structs

none

consts

24const SRG_DIR: *u8 = "/tmp/nx_srcreach_gate"
25const SRG_CLEAN: *u8 = "/tmp/nx_srcreach_gate/clean.conf"
26const SRG_DIRTY: *u8 = "/tmp/nx_srcreach_gate/dirty.conf"
27const SRG_DIRMODE: i64 = 0x1ed
28const SRG_FILEMODE: i64 = 0x1a4
29const SRG_I64: i64 = 8
30const SRG_SLOTS: i64 = 64
31const SRG_BUDGET_SLOTS: i64 = 4
33const SRG_B_REQUESTS: i64 = 0
34const SRG_B_LONGEST: i64 = 1
35const SRG_B_TOTAL: i64 = 2
39const SRG_CLEAN_BODY: *u8 = "src|a|preprint|atom-api|https://a.example|3000|none|open|clean\nsrc|b|index|rest-json|https://b.example|1000|none|cc0|clean\nsrc|c|registry|oai-pmh|https://c.example|5000|none|open|clean\n"
41const SRG_DIRTY_BODY: *u8 = "src|a|preprint|atom-api|https://a.example|3000|none|open|clean\nsrc|b|index|rest-json|https://b.example|1000|none|cc0|clean\nsrc|c|registry|oai-pmh|https://c.example|5000|none|open|clean\nsrc|k|WIDGET|rest-json|https://d.example|2000|none|open|planted bad kind\nsrc|p|forge|carrier-pigeon|https://e.example|2000|none|open|planted bad proto\nsrc|z|index|html|https://f.example|soon|none|open|planted bad pace\nsrc|f|index|html|https://g.example\n"
42const SRG_CLEAN_ROWS: i64 = 3
43const SRG_DIRTY_ROWS: i64 = 7
44const SRG_REQS: i64 = 4
46const SRG_EXP_REQUESTS: i64 = 12
48const SRG_EXP_LONGEST: i64 = 20000
50const SRG_EXP_TOTAL: i64 = 36000

functions

52func srg_write(path: *u8, data: *u8) -> i64
64func srg_pace(st: *i64, pace: *i64, nrows: i64, reqs: i64, out: *i64) -> i64
82func main(argc: i64, argv: *i64) -> i64