nx_tsvdrain.nx
buildroot/runtime/nx_tsvdrain.nx
about
nx_tsvdrain.nx -- DRAIN THE TSV LANE: migrate every UNCONSUMED .tsv into a sovereign plane, then retire
the third-party file, reversibly. Composes nx_tsvcensus's partition with the two proven organs.
WHY: nx_tsvcensus named 44 unconsumed .tsv files across the two knowledge trees. Doing them by hand is
two tool calls plus a verification each -- the same tooling gap that made the census itself look "too
slow", and a tooling gap is never a licence to sample a subset and call the lane drained.
MIGRATE-THEN-RETIRE IS THE ORDER, AND IT IS NOT COSMETIC. Retiring alone would discard measured rows;
migrating alone would leave the third-party format in the tree. Evidence files are NOT a special case for
the ACTION -- every row survives as sovereign data -- they are only a reason never to retire WITHOUT
migrating first.
FAIL-SAFE BY CONSTRUCTION (rule 26 / the destructive-heuristic law):
- DRY IS THE DEFAULT. Passing nothing prints the plan and changes nothing. Only the literal verb
`apply` acts, so a mistyped argument does nothing rather than something.
- A file is retired ONLY IF its migrate printed TSV-MIGRATE GREEN *and* verified=1. Any other outcome
leaves the source exactly where it is and is counted as SKIPPED, never as done.
- Retirement goes through nx_retire_path, which renames and never deletes.
- If the census cannot prove coverage, NOTHING is planned and NOTHING is applied.
usage: nx_tsvdrain <tsv-root> <src-root> <ext> [apply]
exit 0 OK | 1 SOME-SKIPPED | 3 UNPROVEN (partial coverage -- no plan issued) | 2 usage
license_tier: ORIGINAL Writes only via nx_tsv_migrate (additive) and nx_retire_path (rename). Rule 26.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_tool_run.nxnx_lib_std.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
| 28 | const TD_SHELLTOOL: *u8 = "/volume1/homes/elderwesto/nishihost/nx_shelltool.elf" |
| 29 | const TD_MIGRATE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_tsv_migrate.elf" |
| 30 | const TD_RETIRE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_retire_path.elf" |
| 31 | const TD_PLANE_ROOT: *u8 = "knowledge/store/" |
| 34 | const TD_CAPTURE_CAP: i64 = 8388608 |
| 35 | const TD_SMALL_CAP: i64 = 65536 |
| 36 | const TD_MAXTSV: i64 = 8192 |
| 37 | const TD_RC_SKIPPED: i64 = 1 |
| 38 | const TD_RC_USAGE: i64 = 2 |
| 39 | const TD_RC_UNPROVEN: i64 = 3 |
| 40 | const TD_SLASH: i64 = 47 |
| 41 | const TD_LF: i64 = 10 |
| 42 | const TD_DASH: i64 = 45 |
| 43 | const TD_DOT: i64 = 46 |
functions
| 45 | func td_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 46 | func td_putn(v: i64) -> i64 |
| 59 | func td_at(buf: *u8, i: i64, n: i64, needle: *u8) -> i64 |
| 68 | func td_has(buf: *u8, n: i64, needle: *u8) -> i64 |
| 73 | func td_num_after(buf: *u8, n: i64, needle: *u8) -> i64 |
| 97 | func td_has_span(hay: *u8, hl: i64, nee: *u8, ns: i64, nl: i64) -> i64 called by 1: main |
| 109 | func td_partial(buf: *u8, n: i64) -> i64 |
| 116 | func td_dup(src: *u8, s: i64, l: i64) -> *u8 |
| 135 | func td_plane(path: *u8, pl: i64) -> *u8 |
| 164 | func main(argc: i64, argv: *i64) -> i64 |