code wiki / _hdl_build / nx_ale_grade.nx

nx_ale_grade.nx

buildroot/runtime/_hdl_build/nx_ale_grade.nx

6295 B149 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic ale
docsdependenciesstructsconstsfunctions

about

nx_ale_grade.nx -- sovereign ALE DETERMINISTIC grader-runner core (rung ALE-R1a). THE scoring engine the whole ALE-R1 harness routes through: the smallest load-bearing slice (deterministic, code-graded, [0,1], no leakage). PURE function of two files: argv[1] = REFERENCE path (list of grading-unit lines "unit|<name>|<value>") argv[2] = ARTIFACT path (the agent-produced deliverable, same line grammar) argv[3] = scratch OUT path (optional): the milli-score is written here as decimal text + newline, so the gate reads back a value in 0..1000 WITHOUT hitting the 0..255 process-exit-code ceiling. The score also goes to stdout. SCORE (milli-units, 1000 == 1.0), data-driven, NO magic numbers: total = number of "unit|" grading-unit lines in the REFERENCE (the rubric owns it) matched= number of reference grading-unit lines that appear VERBATIM (name+value) as a complete line in the ARTIFACT raw = (matched * 1000) / total # per-unit weight = 1000/total, DERIVED score = clamp(raw, 0, 1000) # BOUNDED into [0,1] inclusive total == 0 -> score 0 (degenerate empty reference: nothing to credit) Deterministic by construction: no clock, no rand -- only the two files decide the score. No-leakage: the grader reads argv[1] (reference) ONLY; the score is independent of when/ where the reference existed during the (separate) agent phase. Landmines respected: nested ifs (no &&/||), flat exprs, <=6 args/func, no empty-string literal, strings via Write, openat_wr has no O_TRUNC (scratch file is fresh per gate run). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_ale_grade.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main sys_exit sys_mmap ag_read sys_openat_rd sys_read sys_close ag_len ag_is_bol ag_seg_eq ag_line_end ag_line_in ag_is_bol ↻ ag_seg_eq ↻ sys_openat_wr ag_wn nxi_fd sys_mmap ↻ ccz_cat_num sys_write sys_munmap sys_close ↻

structs

none

consts

23const K_MAGIC_262144: i64 = 262144

functions

26func ag_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
41func ag_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
44func ag_seg_eq(buf1: *u8, seg: i64, seglen: i64, buf2: *u8, pos2: i64) -> i64
called by 2: ag_line_inmain
54func ag_is_bol(buf: *u8, pos: i64) -> i64
called by 2: ag_line_inmain
61func ag_line_end(buf: *u8, n: i64, start: i64) -> i64
called by 1: main
73func ag_line_in(buf1: *u8, seg: i64, segend: i64, buf2: *u8, n2: i64) -> i64
called by 1: main calls 2: ag_is_bolag_seg_eq
97func ag_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
99func main(argc: i64, argv: *i64) -> i64