code wiki / _hdl_build / nx_swebv_ingest.nx
nx_swebv_ingest.nx
buildroot/runtime/_hdl_build/nx_swebv_ingest.nx
about
nx_swebv_ingest.nx -- F787 rung-2: parse the five fetched SWE-bench Verified /rows pages
(knowledge/fetched/swebv_rows_{000..400}.raw, ingested by nx_swebv_research_fetch) into the
per-instance INDEX plane knowledge/store/swebvinst- : one 6-col row per instance
instance_id<TAB>repo<TAB>base_commit<TAB>version<TAB>difficulty<TAB>page-tag
The plane is the queryable index; the big fields (patch/test_patch/problem_statement/
FAIL_TO_PASS/PASS_TO_PASS) STAY in the .raw corpus, addressed by page-tag + instance_id.
PARSER SOUNDNESS: anchors start with a BARE quote byte; inside any JSON string value every
quote is escaped (backslash-quote), so a bare-quote needle can never match inside a value --
plus a prev-byte backslash check. Field order per row (features 0..12) means sequential
forward scanning; difficulty is the last field before the next row anchor.
TOOTH (D001 verdict contract): exactly 500 rows parsed + seeded -> verdict=GREEN, else RED.
ONE sts_seed commit = idempotent re-run. Envelope: page cap 4MiB/file, out cap 256KiB.
expect_exit: 0 license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const SVI_PREFIX: *u8 = "knowledge/store/swebvinst-" as *u8 |
| 23 | const SVI_FCAP: i64 = 4194304 |
| 24 | const SVI_OCAP: i64 = 262144 |
| 25 | const SVI_VCAP: i64 = 256 |
| 26 | const SVI_TAB: i64 = 9 |
| 27 | const SVI_NL: i64 = 10 |
| 28 | const SVI_Q: i64 = 34 |
| 29 | const SVI_BSL: i64 = 92 |
| 30 | const SVI_STDERR: i64 = 2 |
| 31 | const SVI_WANT: i64 = 500 |
| 32 | const SVI_EXIT_IO: i64 = 1 |
| 33 | const SVI_EXIT_RED: i64 = 3 |
| 34 | const SVI_D0: i64 = 48 |
| 35 | const SVI_B10: i64 = 10 |
| 36 | const SVI_NUMB: i64 = 24 |
functions
| 38 | func sv_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(SVI_STDERR, s, n); return 0 } |
| 39 | func sv_wn(v: i64) -> i64 |
| 51 | func sv_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 53 | func sv_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 68 | func sv_find(buf: *u8, n: i64, needle: *u8, from: i64) -> i64 |
| 84 | func sv_field(buf: *u8, n: i64, needle: *u8, from: i64, val: *u8) -> i64 |
| 104 | func sv_emit(s: *u8) -> i64 called by 1: sv_scan |
| 109 | func sv_emitc(c: i64) -> i64 called by 1: sv_scan |
| 114 | func sv_scan(buf: *u8, n: i64, tag: *u8) -> i64 |
| 164 | func sv_page(path: *u8, tag: *u8, fbuf: *u8) -> i64 |
| 171 | func main() -> i64 |