code wiki / _hdl_build / nx_fixflywheel.nx

nx_fixflywheel.nx

buildroot/runtime/_hdl_build/nx_fixflywheel.nx

13394 B314 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_fixflywheel.nx -- THE HEREDITY RATCHET (bugforge-swe-scale, 2026-07-24). Evolution needs the genome to GROW across generations: every machine-verified green becomes teaching data for the next. This organ harvests verified (buggy->fixed) pairs and folds them into bf_fixcorpus ADDITIVELY, de-duped, so generation N+1 always inherits from a LARGER survivor pool than generation N. SOURCE = a MINED manifest (name|path rows) whose instances the maker resolved GREEN. For each row it reads the emitted candidate's header (// src=<origpath> op=<label>), recovers the buggy fn (the candidate's own mutant, under its real name) and the ORACLE fixed fn (the original at src), and appends `buggy TAB fixed` (multi-line via the 0x01 sentinel, matching nx_fixshot_lib). CONTRACT: only append a pair that fsl_shots would accept (fixed != buggy) AND that is not already present (exact-row de-dup) -- the ratchet is monotone + idempotent (re-run adds nothing new). This is the same additive+preload+dedup discipline the seq756 wipe taught (never REPLACE a live genome). verbs: harvest <manifest> <ledger> | selftest license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_tool_run.nx nx_syscalls.nx nx_fixflywheel.nx

imports: nx_tool_run.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main w sys_write fw_harvest sys_mmap fw_read sys_openat_rd sys_close sys_read w ↻ fw_one fw_green sys_mmap ↻ sfind slen slen ↻ fw_oplen sfind ↻ sys_mmap ↻ fw_read ↻ sfind ↻ fw_extract sys_mmap ↻ sfind ↻ fw_write sys_openat_wr sys_write ↻ sys_close ↻ wn w ↻ sys_mmap ↻ sys_write ↻ fw_selftest fw_oplen ↻ slen ↻ w ↻ sys_mmap ↻ fw_extract ↻ wn ↻ fw_green ↻

structs

none

consts

19const FW_FCAP: i64 = 262144
20const FW_CORCAP: i64 = 524288
21const FW_TCAP: i64 = 4096
22const FW_ZERO: i64 = 48
23const FW_MODE: i64 = 420

functions

25func w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
26func wn(v: i64) -> i64
39func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
40func sfind(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64
53func fw_read(path: *u8, buf: *u8, cap: i64) -> i64
66func fw_write(path: *u8, buf: *u8, n: i64) -> i64
74func fw_extract(src: *u8, n: i64, name: *u8, dst: *u8) -> i64
called by 2: fw_onefw_selftest calls 2: sys_mmapsfind
107func fw_green(led: *u8, ln: i64, cand: *u8) -> i64
called by 2: fw_onefw_selftest calls 2: sys_mmapsfind
136func fw_oplen(inst: *u8, n: i64) -> i64
called by 2: fw_onefw_selftest calls 1: sfind
156func fw_one(iname: *u8, ipath: *u8) -> i64
215func fw_harvest(manp: *u8, ledp: *u8) -> i64
278func fw_selftest() -> i64
called by 1: main calls 7: fw_oplenslenwsys_mmapfw_extractwn+1
306func main(argc: i64, argv: *i64) -> i64