code wiki / _hdl_build / nx_night_grade.nx
nx_night_grade.nx
buildroot/runtime/_hdl_build/nx_night_grade.nx
about
nx_night_grade.nx -- SOVEREIGN night-reading benchmark gate (Reader arc, rung W-NIGHT-1).
MEASURES the sourced eye-fatigue mechanism (blue light) per reader theme. The palette SSOT now
lives in the NATIVE content-addressed seg_store (ncfg / nx_native_config) -- NOT a flat .tsv
(operator 2026-06-20: "stop using tsv, nishi ecosystem only, all rungs everywhere"). The gate
SEEDS the 6-theme palette into a fresh per-run store then reads it back BY COLUMN NAME, so it has
ZERO dependency on knowledge/registry/night_themes.tsv (migrated off + removed). For each theme it
computes, from the dominant emitted colors (bg + fg, sRGB 0..255):
blue_emit = bb*BG_W + fb*FG_W (emitted blue, area-weighted)
total_emit = (br+bg+bb)*BG_W + (fr+fg+fb)*FG_W
blue_frac = blue_emit*1000 / total_emit (per-mille -- "how blue is the light", coverage-independent)
BG_W:FG_W = 9:1 = documented assumption that page background covers ~90% of the screen.
Sourced rationale (knowledge/research/2026-06-16-night-reading-sourced.md):
short-wavelength (blue) light drives the circadian/eye-fatigue response (melanopsin/ipRGC); warm
2700-3000K cuts blue; sRGB display white = 6500K (bluish). The night win = LESS BLUE, by composition
-- not merely darkness. Negative controls prove the metric measures blue, not dark.
KAT order in the store (positional rows): 0 light, 1 sepia, 2 dark, 3 night, 4 black, 5 coolnight(neg).
expect_exit: 0 (all assertions green)
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_native_config.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
| none |
functions
| 26 | func ng_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 27 | func ng_putn(v: i64) -> i64 |
| 35 | func ng_assert(label: *u8, cond: i64) -> i64 |
| 40 | func ng_atoi(s: *u8) -> i64 called by 1: ng_load |
| 52 | func ng_fresh_prefix(out: *u8, base: *u8) -> i64 |
| 67 | func ng_row(w: *i64, idx: i64, nm: *u8, v0: *u8, v1: *u8, v2: *u8, v3: *u8, v4: *u8, v5: *u8, kind: *u8) -> i64 |
| 81 | func ng_seed(prefix: *u8) -> i64 |
| 93 | func ng_load(ints: *i64) -> i64 |
| 121 | func main() -> i64 |