nx_plane_migrate.nx
buildroot/runtime/nx_plane_migrate.nx
about
nx_plane_migrate.nx -- migrate a plane's VALUE ENCODING from flat tab-delimited lines to NXR1 records
(seq1326 rung 2, the actual retirement). ADDITIVE BY CONSTRUCTION: it writes to a NEW destination
prefix and NEVER touches the source, so rule 13 holds and a bad migration costs a wasted prefix, not data.
ORDER OF OPERATIONS IS THE SAFETY PROPERTY:
1. load the source with the HONEST loader
2. REFUSE BEFORE WRITING ANYTHING if the read was truncated or the plane was empty -- migrating a
partial read would silently drop rows into a plane that then looks authoritative. This is the
lesson nx_plane_check taught me by catching my own false GREEN: a checker that has not seen every
row must never act as if it has.
3. write every row as NXR1 under the same q:<seq> key
4. VERIFY by reading the destination back and rendering each record to TSV, comparing byte-for-byte
against the source line. Verification reads the STORE, not the in-memory buffer, so it exercises
the real commit path rather than trusting the writer.
WHY THE KEY STAYS q:<seq> FOR NOW: this rung changes the ENCODING only. Re-keying to business keys is a
separate rung with its own blast radius, and doing both at once would make a failure impossible to
attribute. One change, one gate.
EXIT: 0 migrated+verified · 2 usage · 3 verify mismatch · 4 source empty · 6 source read TRUNCATED
7 too many rows for the row table · 8 commit failed
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 0 importers
imports: nx_record_tsv.nxnx_store_seed_lib.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
| 26 | const PM_CAP: i64 = 16777216 |
| 27 | const PM_RECCAP: i64 = 262144 |
| 28 | const PM_OUTCAP: i64 = 262144 |
| 29 | const PM_MSGCAP: i64 = 4096 |
| 30 | const PM_TYPECAP: i64 = 512 |
| 31 | const PM_FLAGS: i64 = 64 |
| 32 | const PM_MAXROWS: i64 = 65536 |
| 33 | const PM_KEYCAP: i64 = 64 |
| 34 | const PM_NUMCAP: i64 = 32 |
| 35 | const PM_SLACK: i64 = 1048576 |
| 36 | const PM_GROWTH: i64 = 3 // NXR1 adds 7B/field + 6B header; 3x the flat bytes is a safe arena |
| 37 | const PM_NL: i64 = 10 |
| 38 | const PM_CH_I: i64 = 105 |
| 39 | const PM_STDOUT: i64 = 1 |
| 40 | const PM_KIND_LIVE: i64 = 1 |
| 41 | const PM_EXIT_USAGE: i64 = 2 |
| 42 | const PM_EXIT_MISMATCH: i64 = 3 |
| 43 | const PM_EXIT_EMPTY: i64 = 4 |
| 44 | const PM_EXIT_TRUNCATED: i64 = 6 |
| 45 | const PM_EXIT_TOOMANY: i64 = 7 |
| 46 | const PM_EXIT_COMMIT: i64 = 8 |
| 47 | const PM_EXIT_LOSSY: i64 = 9 |
functions
| 49 | func pm_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 50 | func pm_cat(d: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 56 | func main(argc: i64, argv: *i64) -> i64 |