code wiki / (root) / nx_jobfollow_parse.nx

nx_jobfollow_parse.nx

buildroot/runtime/nx_jobfollow_parse.nx

8600 B157 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_jobfollow_parse.nx -- THE PURE HALF of the job-pointer follower: parsing and buffer arithmetic, with NO transport dependency at all. WHY IT IS A SEPARATE FILE. The follower has to live in TWO places: nx_jobfollow_lib (which an explicit caller composes) and nx_https_post_lib (so that EVERY caller of hp_post_json inherits it without editing 81 organs). But nx_jobfollow_lib imports nx_https_post_lib to do its polling, so putting the follow INTO the post lib would close an import cycle. Splitting the pure half out is the standard break: this file imports only nx_syscalls, so both layers above can share ONE implementation and there is still exactly one job-id parser in the estate. AND THE PURE HALF IS THE HALF WORTH GATING. Everything here is buffer arithmetic over inputs a test can construct, so a gate walks it without opening a socket -- the same reason the TLS fragmentation split was pulled out of its loop on the same day. THE ANCHORED PARSE IS THE POINT. jf_job_id matches the whole literal `JOB-STARTED id=`, never a bare `id=`. MEASURED 2026-09-04: a client scanning unanchored read the JOB id as the ORGAN id -- they are both epoch-derived, so 1788537161 looked like a plausible prefix of the real 1788537161795845 -- and then reported a receipt that never existed. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_jobfollow_parse.nx nx_https_post_lib.nx nx_jobfollow_lib.nx nx_jobfollow_parse_gate.nx

imports: nx_syscalls.nx

imported by: nx_https_post_lib.nxnx_jobfollow_lib.nxnx_jobfollow_parse_gate.nx

structs

none

consts

22const JF_PATHCAP: i64 = 256
23const JF_REQCAP: i64 = 4096
24const JF_QUOTE: i64 = 34
25const JF_BACKSLASH: i64 = 92
26const JF_SPACE: i64 = 32
27const JF_DEL: i64 = 127
37const JF_UNKNOWN: *u8 = "\x22stage\x22:\x22read-after-accept\x22" as *u8
38const JF_KEYED: *u8 = "\x22_idem\x22" as *u8
39const JF_REPLAY: *u8 = "NX-IDEM REPLAY" as *u8
40const JF_INFLIGHT: *u8 = "NX-IDEM IN-FLIGHT" as *u8 // the transport's literal (nx_tools_api ta_mcp_call), hyphenated -- verified by grep, not recalled

functions

42func jf_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
43func jf_eo(s: *u8) -> i64 { sys_write(2, s, jf_slen(s)); return 0 }
44func jf_enum(v: i64) -> i64
55func jf_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 2: jf_hasjf_job_id calls 1: jf_slen
69func jf_has(buf: *u8, n: i64, needle: *u8) -> i64 { if jf_find(buf, n, needle) >= 0 { return 1 } return 0 }
71func jf_job_id(buf: *u8, n: i64) -> i64
92func jf_append(out: *u8, o: i64, s: *u8) -> i64
called by 1: hp_follow_job calls 1: jf_slen
99func jf_append_num(out: *u8, o: i64, v: i64) -> i64
called by 1: hp_follow_job calls 1: sys_mmap
113func jf_json_safe(s: *u8, n: i64) -> i64
called by 2: hp_follow_jobmain
128func jf_artifact_ready(buf: *u8, n: i64) -> i64
called by 2: hp_follow_jobmain calls 1: jf_has
136func jf_outcome_unknown(buf: *u8, n: i64) -> i64 { if n <= 0 { return 0 } return jf_has(buf, n, JF_UNKNOWN) }
called by 2: jf_should_reissuemain calls 1: jf_has
138func jf_req_keyed(req: *u8, n: i64) -> i64 { if n <= 0 { return 0 } return jf_has(req, n, JF_KEYED) }
called by 1: jf_should_reissue calls 1: jf_has
140func jf_inflight(buf: *u8, n: i64) -> i64 { if n <= 0 { return 0 } return jf_has(buf, n, JF_INFLIGHT) }
called by 1: jf_should_reissue calls 1: jf_has
143func jf_should_reissue(buf: *u8, n: i64, req: *u8, reqlen: i64) -> i64