code wiki / (root) / nx_civicmap_gate.nx

nx_civicmap_gate.nx

buildroot/runtime/nx_civicmap_gate.nx

36912 B500 linesdepth 4pulls 8 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_civicmap_gate.nx -- GATE for the civic quality-of-life map: CM1 admission, CM2 county join, CM3 the honest choropleth. Subject: nx_civicmap_lib.nx, imported and exercised IN-PROCESS, so this gate can never report on a stale deployed artifact instead of the source it names. WHAT THIS GATE IS ACTUALLY FOR. The easy version of every one of these teeth is vacuous: * A deny-suite alone proves nothing -- ★A GUARD THAT REFUSES EVERYTHING PASSES EVERY NEGATIVE TEST. So the first tooth is a POSITIVE control (a complete row MUST be admitted) and every refusal tooth asserts WHICH RULE FIRED, not merely that something was refused. * "The map rendered" proves nothing about honesty. The load-bearing tooth is ARITHMETIC: the number of data-value attributes in the emitted page must EQUAL the number of PRESENT counties. An implementation that painted suppressed counties with the bottom bucket still renders, still looks like a map, and fails that count. That is the tooth the trivial wrong version cannot pass. * Every fixture is built HERE, at runtime, under /tmp/nx_civicmap_gate/ -- never in knowledge/store, because a gate that shares a fixture with a production beat measures the beat's races and reports them as the subject's defects. Preconditions use gv_need, so "I could not write my own fixture" ends SKIP and never RED: a gate that reports a broken environment in the same word as a broken subject teaches everyone to ignore it. license_tier: ORIGINAL No hardware writes (Rule 26).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_geo_raster.nx nx_civicmap_lib.nx nx_civicmap_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_geo_raster.nxnx_civicmap_lib.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ gv_check gv_puts ↻ cg_admit_lit cm_layer_admit cm_nfields cm_fld cm_to cm_empty cm_starts cm_eqlit cm_starts ↻ cg_len cm_layer_admit ↻ cg_len ↻ gv_bite gv_puts ↻ sys_mkdir cg_write_file sys_openat_wr

structs

none

consts

24const CG_DIR: *u8 = "/tmp/nx_civicmap_gate"
25const CG_COUNTIES: *u8 = "/tmp/nx_civicmap_gate/counties.conf"
26const CG_DIRTY: *u8 = "/tmp/nx_civicmap_gate/dirty.conf"
27const CG_OUT: *u8 = "/tmp/nx_civicmap_gate/map.html"
28const CG_MODE_755: i64 = 493
29const CG_MODE_644: i64 = 420
30const CG_SCRATCH: i64 = 64
36const CG_PROBE_LAT: i64 = 40500000 // a latitude inside BOTH fixture squares
37const CG_PROBE_LON_WEST: i64 = 74500000 // |longitude| inside the WEST fixture county
38const CG_PROBE_LON_EAST: i64 = 72500000 // |longitude| inside the EAST fixture county
39const CG_PROBE_LON_NOWHERE: i64 = 60000000 // |longitude| outside EVERY fixture county
40const CG_FIPS_WEST: i64 = 10001
41const CG_FIPS_EAST: i64 = 10002
43const CG_QOL_FULL: i64 = 20001 // observed on every declared axis
44const CG_QOL_PARTIAL: i64 = 20002 // observed on exactly one
45const CG_QOL_NONE: i64 = 20003 // observed on nothing at all
46const CG_QOL_DIRPROBE: i64 = 20004 // exists only to probe axis direction
48const CG_ACRE_DISCLOSE: i64 = 30001
49const CG_ACRE_NONDISCLOSE: i64 = 48001
51const CG_ASK_TYPICAL: i64 = 5000 // sits inside the recorded band
52const CG_ASK_ABSURD: i64 = 500000 // far above the recorded ceiling
53const CG_BAND_MEDIAN: i64 = 5000 // the median the fixture band must produce
54const CG_BAND_TOP: i64 = 9000 // the highest recorded per-acre sale in the fixture
55const CG_MEAN_DRAG_FLOOR: i64 = 180000 // the mean must exceed this once the outliers are added
56const CG_CAP_TINY: i64 = 3
57const CG_STATE_LEN: i64 = 2 // a USPS state code is two letters
58const CG_PCTL_LO: i64 = 100 // band floor, as a permil percentile of recorded sales
59const CG_PCTL_HI: i64 = 900 // band ceiling, likewise
60const CG_SAMPLE_CAP: i64 = 64 // comparables the fixture may hold
61const CG_MIN_SALES: i64 = 5 // declared minimum comparables for a usable band
62const CG_MIN_SALES_UNREACHABLE: i64 = 50 // a minimum this fixture deliberately cannot meet
63const CG_ACRE_ONE: i64 = 1000 // milli-acres in one acre
64const CG_ASK_CHEAP: i64 = 100 // an asking price far BELOW the recorded floor
65const CG_GRID: i64 = 16
66const CG_PIX: i64 = 256

functions

68func cg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
70func cg_write_file(path: *u8, body: *u8) -> i64
79func cg_count(buf: *u8, n: i64, lit: *u8) -> i64
called by 1: main calls 1: cg_len
96func cg_admit_lit(row: *u8, f: *i64) -> i64
called by 1: main calls 2: cm_layer_admitcg_len
100func main() -> i64