omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / si / aien-harness / test.om
| 1 | om2 |
| 2 | note si/aien-harness/test.om: Standalone OM-2 behavioral test suite for aien-harness. |
| 3 | note Tests all 4 upstream schemas (engineering_fix, harness_change, research_handoff, python_result), |
| 4 | note slop_gate (10 forbidden phrases + antithesis), workflow state machines, strict 6-word verdict vocabulary, |
| 5 | note multi-run flakiness detection, and fail-closed gate decisions (including NOT_RUN/BLOCKED_* and 0-run refusal). |
| 6 | |
| 7 | global inbuf uchar 32768 |
| 8 | global decbuf uchar 32 |
| 9 | global fldcnt ulong 16 |
| 10 | global evalnames uchar 4096 |
| 11 | global evallens ulong 64 |
| 12 | global evalfirst ulong 64 |
| 13 | global evalflaky ulong 64 |
| 14 | global st ulong 20 |
| 15 | |
| 16 | const s_inlen ulong 0 |
| 17 | const s_schema ulong 1 |
| 18 | const s_badprop ulong 2 |
| 19 | const s_badlen ulong 3 |
| 20 | const s_missfld ulong 4 |
| 21 | const s_slop ulong 5 |
| 22 | const s_badwf ulong 6 |
| 23 | const s_runs ulong 7 |
| 24 | const s_passruns ulong 8 |
| 25 | const s_nonpass ulong 9 |
| 26 | const s_badverd ulong 10 |
| 27 | const s_flaky ulong 11 |
| 28 | const s_evalcnt ulong 12 |
| 29 | const s_badline ulong 13 |
| 30 | |
| 31 | const sch_none ulong 0 |
| 32 | const sch_eng ulong 1 |
| 33 | const sch_hc ulong 2 |
| 34 | const sch_res ulong 3 |
| 35 | const sch_py ulong 4 |
| 36 | |
| 37 | const v_inv ulong 0 |
| 38 | const v_pass ulong 1 |
| 39 | const v_fail ulong 2 |
| 40 | const v_notrun ulong 3 |
| 41 | const v_bhw ulong 4 |
| 42 | const v_bop ulong 5 |
| 43 | const v_miss ulong 6 |
| 44 | |
| 45 | text p_schema "schema " |
| 46 | text p_field "field " |
| 47 | text p_text "text " |
| 48 | text p_wf "workflow " |
| 49 | text p_eval "eval " |
| 50 | |
| 51 | text sn_eng "engineering_fix" |
| 52 | text sn_hc "harness_change" |
| 53 | text sn_res "research_handoff" |
| 54 | text sn_py "python_result" |
| 55 | text sn_pywf "python_pipeline" |
| 56 | |
| 57 | text fk_bug "bug" |
| 58 | text fk_repro "reproduction_steps" |
| 59 | text fk_fev "failure_evidence" |
| 60 | text fk_rtest "regression_test" |
| 61 | text fk_diff "diff_summary" |
| 62 | text fk_ret "retest_evidence" |
| 63 | text fk_chg "change" |
| 64 | text fk_why "why" |
| 65 | text fk_rep "replay_report" |
| 66 | text fk_evr "eval_results" |
| 67 | text fk_rbk "rollback" |
| 68 | text fk_q "question" |
| 69 | text fk_clm "claims" |
| 70 | text fk_src "sources" |
| 71 | text fk_oq "open_questions" |
| 72 | text fk_goal "goal" |
| 73 | text fk_code "code" |
| 74 | text fk_out "stdout" |
| 75 | text fk_ok "ok" |
| 76 | text fk_ev "evidence" |
| 77 | |
| 78 | text vv_pass "PASS" |
| 79 | text vv_fail "FAIL" |
| 80 | text vv_notrun "NOT_RUN" |
| 81 | text vv_bhw "BLOCKED_HARDWARE" |
| 82 | text vv_bop "BLOCKED_OPERATOR" |
| 83 | text vv_miss "MISSING_IMPLEMENTATION" |
| 84 | |
| 85 | text ws_repro "reproduce" |
| 86 | text ws_rfail "regression_fail" |
| 87 | text ws_impl "implement" |
| 88 | text ws_retest "retest" |
| 89 | text ws_rev "review" |
| 90 | text ws_done "done" |
| 91 | text ws_col "collect" |
| 92 | text ws_val "validate" |
| 93 | text ws_esrc "eval_sources" |
| 94 | text ws_del "deliver" |
| 95 | text ws_prop "propose" |
| 96 | text ws_rply "replay" |
| 97 | text ws_app "apply" |
| 98 | text ws_ver "verify" |
| 99 | text ws_wr "write" |
| 100 | text ws_run "run" |
| 101 | text ws_eval "eval" |
| 102 | text ws_rem "remember" |
| 103 | text ws_ref "refine" |
| 104 | |
| 105 | text sl_01 "this is the part where" |
| 106 | text sl_02 "the part everyone's missing" |
| 107 | text sl_03 "the part everyone is missing" |
| 108 | text sl_04 "in today's fast-paced" |
| 109 | text sl_05 "game-changer" |
| 110 | text sl_06 "delve into" |
| 111 | text sl_07 "unlock the power" |
| 112 | text sl_08 "at the end of the day" |
| 113 | text sl_09 "it is important to note" |
| 114 | text sl_10 "in conclusion," |
| 115 | text sl_not "not " |
| 116 | text sl_its "it's " |
| 117 | text sl_itis "it is " |
| 118 | |
| 119 | note Test cases |
| 120 | text tc_eng_ok "schema engineering_fix\nfield bug Register pressure overflow in omc\nfield reproduction_steps Compile large fn\nfield failure_evidence omc: line 42: error 12\nfield regression_test test_reg_ok\nfield diff_summary Split helper function cleanly\nfield retest_evidence Compiled twice identical ELF\ntext Direct execution of pure Omega binary on AArch64.\nworkflow engineering_fix reproduce regression_fail\nworkflow engineering_fix regression_fail implement\nworkflow engineering_fix implement retest\nworkflow engineering_fix retest review\nworkflow engineering_fix review done\neval unit_a PASS\neval unit_a PASS\neval unit_b PASS\n" |
| 121 | text tc_hc_ok "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\nworkflow harness_change propose replay\nworkflow harness_change replay apply\nworkflow harness_change apply verify\nworkflow harness_change verify done\neval replay_all PASS\n" |
| 122 | text tc_res_ok "schema research_handoff\nfield question Does omc compile deterministically?\nfield claims Two omc runs produce byte-identical ELF output.\nfield sources https://interplane.io/drakestapleton/omega-mv\nfield open_questions \neval source_check PASS\n" |
| 123 | text tc_py_ok "schema python_result\nfield goal Check hash\nfield code sha256(b'abc')\nfield stdout ba7816bf\nfield ok yes\nfield evidence sha256_kat\nworkflow python_pipeline write run\nworkflow python_pipeline run eval\nworkflow python_pipeline eval deliver\nworkflow python_pipeline deliver done\neval py_eval PASS\n" |
| 124 | |
| 125 | text tc_bad_sch_fields "schema engineering_fix\nfield bug short\nfield reproduction_steps Compile large fn\nfield failure_evidence omc: line 42: error 12\nfield regression_test test_reg_ok\nfield diff_summary Split helper function cleanly\nfield extra_bogus unauthorized\neval unit_a PASS\n" |
| 126 | text tc_unk_sch "schema nonexistent_schema\neval unit_a PASS\n" |
| 127 | text tc_slop "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\ntext In today's fast-paced world, delve into this.\ntext This is not a bug, it's a feature.\neval replay_all PASS\n" |
| 128 | text tc_bad_wf "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\nworkflow engineering_fix reproduce done\nworkflow harness_change propose apply\nworkflow python_pipeline write done\neval replay_all PASS\n" |
| 129 | text tc_bad_verd "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\neval v1 OK\neval v2 PASSED\neval v3 SKIP\neval v4 pass\n" |
| 130 | text tc_flaky "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\neval flaky_unit PASS\neval flaky_unit FAIL\n" |
| 131 | text tc_nonpass_vocab "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\neval e_nr NOT_RUN\neval e_hw BLOCKED_HARDWARE\neval e_op BLOCKED_OPERATOR\neval e_mi MISSING_IMPLEMENTATION\n" |
| 132 | text tc_zero_runs "schema harness_change\nfield change Enforce strict verdict vocabulary\nfield why Prevent silent partial gate passes\nfield replay_report Replayed 4 historical failures cleanly\nfield eval_results slop_gate PASS\nfield rollback Revert commit cleanly via git\n" |
| 133 | |
| 134 | text p_1 "PASS pos_engineering_fix_schema_wf_multirun\n" |
| 135 | text p_2 "PASS pos_harness_change_research_python_schemas\n" |
| 136 | text p_3 "PASS neg_schema_missing_short_extra_and_unknown_refused\n" |
| 137 | text p_4 "PASS neg_slop_gate_phrases_and_antithesis_caught\n" |
| 138 | text p_5 "PASS neg_illegal_workflow_transitions_refused\n" |
| 139 | text p_6 "PASS neg_invalid_verdict_vocabulary_refused\n" |
| 140 | text p_7 "PASS neg_flaky_multirun_eval_detected_and_refused\n" |
| 141 | text p_8 "PASS neg_nonpass_valid_verdicts_and_zero_runs_fail_closed\n" |
| 142 | text p_all "AIEN-HARNESS TEST SUITE PASS (8/8)\n" |
| 143 | text f_msg "FAIL test case " |
| 144 | text t_nl "\n" |
| 145 | |
| 146 | fn write_all fd int src view uchar * off ulong n ulong to void |
| 147 | p = ulong 0 |
| 148 | while lt p n bound 4096 |
| 149 | k = write fd src add off p sub n p |
| 150 | if le k 0 |
| 151 | exit 2 |
| 152 | end |
| 153 | p = add p ulong k |
| 154 | end |
| 155 | end |
| 156 | |
| 157 | fn wstr fd int s view uchar * to void |
| 158 | write_all fd s 0 len s |
| 159 | end |
| 160 | |
| 161 | fn wdec fd int v ulong to void |
| 162 | i = ulong 32 |
| 163 | n = v |
| 164 | while true bound 24 |
| 165 | i = sub i 1 |
| 166 | put decbuf i uchar add rem n 10 48 |
| 167 | n = div n 10 |
| 168 | if eq n 0 |
| 169 | break |
| 170 | end |
| 171 | end |
| 172 | p = i |
| 173 | while lt p 32 bound 32 |
| 174 | k = write fd decbuf p sub 32 p |
| 175 | if le k 0 |
| 176 | exit 2 |
| 177 | end |
| 178 | p = add p ulong k |
| 179 | end |
| 180 | end |
| 181 | |
| 182 | fn fail_case id ulong to void |
| 183 | wstr 2 f_msg |
| 184 | wdec 2 id |
| 185 | wstr 2 t_nl |
| 186 | exit 1 |
| 187 | end |
| 188 | |
| 189 | fn load_in s view uchar * to void |
| 190 | n = len s |
| 191 | i = ulong 0 |
| 192 | while lt i n bound 8192 |
| 193 | put inbuf i get s i |
| 194 | i = add i 1 |
| 195 | end |
| 196 | put st s_inlen n |
| 197 | end |
| 198 | |
| 199 | fn to_lower c uchar to uchar |
| 200 | if and ge c 65 le c 90 |
| 201 | ret add c 32 |
| 202 | end |
| 203 | ret c |
| 204 | end |
| 205 | |
| 206 | fn is_word_ch c uchar to bool |
| 207 | if and ge c 48 le c 57 |
| 208 | ret true |
| 209 | end |
| 210 | if and ge c 65 le c 90 |
| 211 | ret true |
| 212 | end |
| 213 | if and ge c 97 le c 122 |
| 214 | ret true |
| 215 | end |
| 216 | ret or eq c 95 eq c 45 |
| 217 | end |
| 218 | |
| 219 | fn in_eq off ulong n ulong lit view uchar * to bool |
| 220 | if ne n len lit |
| 221 | ret false |
| 222 | end |
| 223 | i = ulong 0 |
| 224 | while lt i n bound 256 |
| 225 | if ne get inbuf add off i get lit i |
| 226 | ret false |
| 227 | end |
| 228 | i = add i 1 |
| 229 | end |
| 230 | ret true |
| 231 | end |
| 232 | |
| 233 | fn in_starts off ulong lim ulong pfx view uchar * to bool |
| 234 | pl = len pfx |
| 235 | if gt add off pl lim |
| 236 | ret false |
| 237 | end |
| 238 | i = ulong 0 |
| 239 | while lt i pl bound 256 |
| 240 | if ne get inbuf add off i get pfx i |
| 241 | ret false |
| 242 | end |
| 243 | i = add i 1 |
| 244 | end |
| 245 | ret true |
| 246 | end |
| 247 | |
| 248 | fn in_starts_ci off ulong lim ulong pat view uchar * to bool |
| 249 | pl = len pat |
| 250 | if gt add off pl lim |
| 251 | ret false |
| 252 | end |
| 253 | i = ulong 0 |
| 254 | while lt i pl bound 256 |
| 255 | if ne to_lower get inbuf add off i to_lower get pat i |
| 256 | ret false |
| 257 | end |
| 258 | i = add i 1 |
| 259 | end |
| 260 | ret true |
| 261 | end |
| 262 | |
| 263 | fn in_contains_ci off ulong lim ulong pat view uchar * to bool |
| 264 | pl = len pat |
| 265 | if lt sub lim off pl |
| 266 | ret false |
| 267 | end |
| 268 | endp = add sub lim pl 1 |
| 269 | p = off |
| 270 | while lt p endp bound 4096 |
| 271 | if in_starts_ci p lim pat |
| 272 | ret true |
| 273 | end |
| 274 | p = add p 1 |
| 275 | end |
| 276 | ret false |
| 277 | end |
| 278 | |
| 279 | fn find_sp pos ulong lim ulong to ulong |
| 280 | p = pos |
| 281 | while lt p lim bound 4096 |
| 282 | if eq get inbuf p 32 |
| 283 | ret p |
| 284 | end |
| 285 | p = add p 1 |
| 286 | end |
| 287 | ret lim |
| 288 | end |
| 289 | |
| 290 | fn has_antithesis off ulong lim ulong to bool |
| 291 | p = off |
| 292 | while lt p lim bound 4096 |
| 293 | ok_wb = true |
| 294 | if gt p off |
| 295 | if is_word_ch get inbuf sub p 1 |
| 296 | ok_wb = false |
| 297 | end |
| 298 | end |
| 299 | if and ok_wb in_starts_ci p lim sl_not |
| 300 | q = add p 4 |
| 301 | saw_w = false |
| 302 | while lt q lim bound 128 |
| 303 | c = get inbuf q |
| 304 | if eq c 44 |
| 305 | if saw_w |
| 306 | r = add q 1 |
| 307 | while lt r lim bound 16 |
| 308 | if ne get inbuf r 32 |
| 309 | break |
| 310 | end |
| 311 | r = add r 1 |
| 312 | end |
| 313 | if or in_starts_ci r lim sl_its in_starts_ci r lim sl_itis |
| 314 | ret true |
| 315 | end |
| 316 | end |
| 317 | break |
| 318 | end |
| 319 | if is_word_ch c |
| 320 | saw_w = true |
| 321 | else |
| 322 | if ne c 32 |
| 323 | break |
| 324 | end |
| 325 | end |
| 326 | q = add q 1 |
| 327 | end |
| 328 | end |
| 329 | p = add p 1 |
| 330 | end |
| 331 | ret false |
| 332 | end |
| 333 | |
| 334 | fn check_slop off ulong lim ulong to bool |
| 335 | if in_contains_ci off lim sl_01 |
| 336 | ret true |
| 337 | end |
| 338 | if in_contains_ci off lim sl_02 |
| 339 | ret true |
| 340 | end |
| 341 | if in_contains_ci off lim sl_03 |
| 342 | ret true |
| 343 | end |
| 344 | if in_contains_ci off lim sl_04 |
| 345 | ret true |
| 346 | end |
| 347 | if in_contains_ci off lim sl_05 |
| 348 | ret true |
| 349 | end |
| 350 | if in_contains_ci off lim sl_06 |
| 351 | ret true |
| 352 | end |
| 353 | if in_contains_ci off lim sl_07 |
| 354 | ret true |
| 355 | end |
| 356 | if in_contains_ci off lim sl_08 |
| 357 | ret true |
| 358 | end |
| 359 | if in_contains_ci off lim sl_09 |
| 360 | ret true |
| 361 | end |
| 362 | if in_contains_ci off lim sl_10 |
| 363 | ret true |
| 364 | end |
| 365 | ret has_antithesis off lim |
| 366 | end |
| 367 | |
| 368 | fn parse_verdict off ulong n ulong to ulong |
| 369 | if in_eq off n vv_pass |
| 370 | ret v_pass |
| 371 | end |
| 372 | if in_eq off n vv_fail |
| 373 | ret v_fail |
| 374 | end |
| 375 | if in_eq off n vv_notrun |
| 376 | ret v_notrun |
| 377 | end |
| 378 | if in_eq off n vv_bhw |
| 379 | ret v_bhw |
| 380 | end |
| 381 | if in_eq off n vv_bop |
| 382 | ret v_bop |
| 383 | end |
| 384 | if in_eq off n vv_miss |
| 385 | ret v_miss |
| 386 | end |
| 387 | ret v_inv |
| 388 | end |
| 389 | |
| 390 | fn eval_name_eq idx ulong off ulong n ulong to bool |
| 391 | if ne get evallens idx n |
| 392 | ret false |
| 393 | end |
| 394 | base = mul idx 64 |
| 395 | i = ulong 0 |
| 396 | while lt i n bound 64 |
| 397 | if ne get evalnames add base i get inbuf add off i |
| 398 | ret false |
| 399 | end |
| 400 | i = add i 1 |
| 401 | end |
| 402 | ret true |
| 403 | end |
| 404 | |
| 405 | fn record_eval_run noff ulong nlen ulong vcode ulong to void |
| 406 | put st s_runs add get st s_runs 1 |
| 407 | if eq vcode v_inv |
| 408 | put st s_badverd add get st s_badverd 1 |
| 409 | ret |
| 410 | end |
| 411 | if eq vcode v_pass |
| 412 | put st s_passruns add get st s_passruns 1 |
| 413 | else |
| 414 | put st s_nonpass add get st s_nonpass 1 |
| 415 | end |
| 416 | clen = nlen |
| 417 | if gt clen 64 |
| 418 | clen = ulong 64 |
| 419 | end |
| 420 | cnt = get st s_evalcnt |
| 421 | idx = ulong 0 |
| 422 | while lt idx cnt bound 64 |
| 423 | if eval_name_eq idx noff clen |
| 424 | if ne get evalfirst idx vcode |
| 425 | if eq get evalflaky idx 0 |
| 426 | put evalflaky idx 1 |
| 427 | put st s_flaky add get st s_flaky 1 |
| 428 | end |
| 429 | end |
| 430 | ret |
| 431 | end |
| 432 | idx = add idx 1 |
| 433 | end |
| 434 | if lt cnt 64 |
| 435 | base = mul cnt 64 |
| 436 | i = ulong 0 |
| 437 | while lt i clen bound 64 |
| 438 | put evalnames add base i get inbuf add noff i |
| 439 | i = add i 1 |
| 440 | end |
| 441 | put evallens cnt clen |
| 442 | put evalfirst cnt vcode |
| 443 | put evalflaky cnt 0 |
| 444 | put st s_evalcnt add cnt 1 |
| 445 | end |
| 446 | end |
| 447 | |
| 448 | fn wf_eng_ok fo ulong fnl ulong to_o ulong tn ulong to bool |
| 449 | if in_eq fo fnl ws_repro |
| 450 | ret in_eq to_o tn ws_rfail |
| 451 | end |
| 452 | if in_eq fo fnl ws_rfail |
| 453 | ret in_eq to_o tn ws_impl |
| 454 | end |
| 455 | if in_eq fo fnl ws_impl |
| 456 | ret in_eq to_o tn ws_retest |
| 457 | end |
| 458 | if in_eq fo fnl ws_retest |
| 459 | ret or in_eq to_o tn ws_rev in_eq to_o tn ws_impl |
| 460 | end |
| 461 | if in_eq fo fnl ws_rev |
| 462 | ret or in_eq to_o tn ws_done in_eq to_o tn ws_impl |
| 463 | end |
| 464 | ret false |
| 465 | end |
| 466 | |
| 467 | fn wf_res_ok fo ulong fnl ulong to_o ulong tn ulong to bool |
| 468 | if in_eq fo fnl ws_col |
| 469 | ret in_eq to_o tn ws_val |
| 470 | end |
| 471 | if in_eq fo fnl ws_val |
| 472 | ret or in_eq to_o tn ws_esrc in_eq to_o tn ws_col |
| 473 | end |
| 474 | if in_eq fo fnl ws_esrc |
| 475 | ret or in_eq to_o tn ws_del in_eq to_o tn ws_col |
| 476 | end |
| 477 | if in_eq fo fnl ws_del |
| 478 | ret in_eq to_o tn ws_done |
| 479 | end |
| 480 | ret false |
| 481 | end |
| 482 | |
| 483 | fn wf_hc_ok fo ulong fnl ulong to_o ulong tn ulong to bool |
| 484 | if in_eq fo fnl ws_prop |
| 485 | ret in_eq to_o tn ws_rply |
| 486 | end |
| 487 | if in_eq fo fnl ws_rply |
| 488 | ret or in_eq to_o tn ws_app in_eq to_o tn ws_prop |
| 489 | end |
| 490 | if in_eq fo fnl ws_app |
| 491 | ret in_eq to_o tn ws_ver |
| 492 | end |
| 493 | if in_eq fo fnl ws_ver |
| 494 | ret or in_eq to_o tn ws_done in_eq to_o tn ws_prop |
| 495 | end |
| 496 | ret false |
| 497 | end |
| 498 | |
| 499 | fn wf_py_ok fo ulong fnl ulong to_o ulong tn ulong to bool |
| 500 | if in_eq fo fnl ws_wr |
| 501 | ret in_eq to_o tn ws_run |
| 502 | end |
| 503 | if in_eq fo fnl ws_run |
| 504 | ret in_eq to_o tn ws_eval |
| 505 | end |
| 506 | if in_eq fo fnl ws_eval |
| 507 | ret or in_eq to_o tn ws_del in_eq to_o tn ws_rem |
| 508 | end |
| 509 | if in_eq fo fnl ws_rem |
| 510 | ret in_eq to_o tn ws_ref |
| 511 | end |
| 512 | if in_eq fo fnl ws_ref |
| 513 | ret in_eq to_o tn ws_run |
| 514 | end |
| 515 | if in_eq fo fnl ws_del |
| 516 | ret in_eq to_o tn ws_done |
| 517 | end |
| 518 | ret false |
| 519 | end |
| 520 | |
| 521 | fn check_wf_line ls ulong lim ulong to void |
| 522 | p1 = add ls 9 |
| 523 | s1 = find_sp p1 lim |
| 524 | if ge s1 lim |
| 525 | put st s_badwf add get st s_badwf 1 |
| 526 | ret |
| 527 | end |
| 528 | p2 = add s1 1 |
| 529 | s2 = find_sp p2 lim |
| 530 | if ge s2 lim |
| 531 | put st s_badwf add get st s_badwf 1 |
| 532 | ret |
| 533 | end |
| 534 | p3 = add s2 1 |
| 535 | ok = false |
| 536 | if in_eq p1 sub s1 p1 sn_eng |
| 537 | ok = wf_eng_ok p2 sub s2 p2 p3 sub lim p3 |
| 538 | else |
| 539 | if in_eq p1 sub s1 p1 sn_res |
| 540 | ok = wf_res_ok p2 sub s2 p2 p3 sub lim p3 |
| 541 | else |
| 542 | if in_eq p1 sub s1 p1 sn_hc |
| 543 | ok = wf_hc_ok p2 sub s2 p2 p3 sub lim p3 |
| 544 | else |
| 545 | if in_eq p1 sub s1 p1 sn_pywf |
| 546 | ok = wf_py_ok p2 sub s2 p2 p3 sub lim p3 |
| 547 | end |
| 548 | end |
| 549 | end |
| 550 | end |
| 551 | if not ok |
| 552 | put st s_badwf add get st s_badwf 1 |
| 553 | end |
| 554 | end |
| 555 | |
| 556 | fn apply_field_eng ko ulong kl ulong vl ulong to void |
| 557 | slot = ulong 99 |
| 558 | minl = ulong 0 |
| 559 | if in_eq ko kl fk_bug |
| 560 | slot = ulong 0 |
| 561 | minl = ulong 8 |
| 562 | else |
| 563 | if in_eq ko kl fk_repro |
| 564 | slot = ulong 1 |
| 565 | minl = ulong 4 |
| 566 | else |
| 567 | if in_eq ko kl fk_fev |
| 568 | slot = ulong 2 |
| 569 | minl = ulong 8 |
| 570 | else |
| 571 | if in_eq ko kl fk_rtest |
| 572 | slot = ulong 3 |
| 573 | minl = ulong 4 |
| 574 | else |
| 575 | if in_eq ko kl fk_diff |
| 576 | slot = ulong 4 |
| 577 | minl = ulong 8 |
| 578 | else |
| 579 | if in_eq ko kl fk_ret |
| 580 | slot = ulong 5 |
| 581 | minl = ulong 8 |
| 582 | end |
| 583 | end |
| 584 | end |
| 585 | end |
| 586 | end |
| 587 | end |
| 588 | if eq slot 99 |
| 589 | put st s_badprop add get st s_badprop 1 |
| 590 | ret |
| 591 | end |
| 592 | if lt vl minl |
| 593 | put st s_badlen add get st s_badlen 1 |
| 594 | ret |
| 595 | end |
| 596 | put fldcnt slot add get fldcnt slot 1 |
| 597 | end |
| 598 | |
| 599 | fn apply_field_hc ko ulong kl ulong vl ulong to void |
| 600 | slot = ulong 99 |
| 601 | minl = ulong 0 |
| 602 | if in_eq ko kl fk_chg |
| 603 | slot = ulong 0 |
| 604 | minl = ulong 8 |
| 605 | else |
| 606 | if in_eq ko kl fk_why |
| 607 | slot = ulong 1 |
| 608 | minl = ulong 8 |
| 609 | else |
| 610 | if in_eq ko kl fk_rep |
| 611 | slot = ulong 2 |
| 612 | minl = ulong 8 |
| 613 | else |
| 614 | if in_eq ko kl fk_evr |
| 615 | slot = ulong 3 |
| 616 | minl = ulong 4 |
| 617 | else |
| 618 | if in_eq ko kl fk_rbk |
| 619 | slot = ulong 4 |
| 620 | minl = ulong 8 |
| 621 | end |
| 622 | end |
| 623 | end |
| 624 | end |
| 625 | end |
| 626 | if eq slot 99 |
| 627 | put st s_badprop add get st s_badprop 1 |
| 628 | ret |
| 629 | end |
| 630 | if lt vl minl |
| 631 | put st s_badlen add get st s_badlen 1 |
| 632 | ret |
| 633 | end |
| 634 | put fldcnt slot add get fldcnt slot 1 |
| 635 | end |
| 636 | |
| 637 | fn apply_field_res ko ulong kl ulong vl ulong to void |
| 638 | slot = ulong 99 |
| 639 | minl = ulong 0 |
| 640 | if in_eq ko kl fk_q |
| 641 | slot = ulong 0 |
| 642 | minl = ulong 8 |
| 643 | else |
| 644 | if in_eq ko kl fk_clm |
| 645 | slot = ulong 1 |
| 646 | minl = ulong 12 |
| 647 | else |
| 648 | if in_eq ko kl fk_src |
| 649 | slot = ulong 2 |
| 650 | minl = ulong 8 |
| 651 | else |
| 652 | if in_eq ko kl fk_oq |
| 653 | slot = ulong 3 |
| 654 | minl = ulong 0 |
| 655 | end |
| 656 | end |
| 657 | end |
| 658 | end |
| 659 | if eq slot 99 |
| 660 | put st s_badprop add get st s_badprop 1 |
| 661 | ret |
| 662 | end |
| 663 | if lt vl minl |
| 664 | put st s_badlen add get st s_badlen 1 |
| 665 | ret |
| 666 | end |
| 667 | put fldcnt slot add get fldcnt slot 1 |
| 668 | end |
| 669 | |
| 670 | fn apply_field_py ko ulong kl ulong vl ulong to void |
| 671 | slot = ulong 99 |
| 672 | minl = ulong 0 |
| 673 | if in_eq ko kl fk_goal |
| 674 | slot = ulong 0 |
| 675 | minl = ulong 4 |
| 676 | else |
| 677 | if in_eq ko kl fk_code |
| 678 | slot = ulong 1 |
| 679 | minl = ulong 4 |
| 680 | else |
| 681 | if in_eq ko kl fk_out |
| 682 | slot = ulong 2 |
| 683 | minl = ulong 0 |
| 684 | else |
| 685 | if in_eq ko kl fk_ok |
| 686 | slot = ulong 3 |
| 687 | minl = ulong 2 |
| 688 | else |
| 689 | if in_eq ko kl fk_ev |
| 690 | slot = ulong 4 |
| 691 | minl = ulong 2 |
| 692 | end |
| 693 | end |
| 694 | end |
| 695 | end |
| 696 | end |
| 697 | if eq slot 99 |
| 698 | put st s_badprop add get st s_badprop 1 |
| 699 | ret |
| 700 | end |
| 701 | if lt vl minl |
| 702 | put st s_badlen add get st s_badlen 1 |
| 703 | ret |
| 704 | end |
| 705 | put fldcnt slot add get fldcnt slot 1 |
| 706 | end |
| 707 | |
| 708 | fn handle_field_line ls ulong lim ulong to void |
| 709 | ko = add ls 6 |
| 710 | sp = find_sp ko lim |
| 711 | kl = sub sp ko |
| 712 | vo = sp |
| 713 | if lt sp lim |
| 714 | vo = add sp 1 |
| 715 | end |
| 716 | vl = sub lim vo |
| 717 | sid = get st s_schema |
| 718 | if eq sid sch_eng |
| 719 | apply_field_eng ko kl vl |
| 720 | else |
| 721 | if eq sid sch_hc |
| 722 | apply_field_hc ko kl vl |
| 723 | else |
| 724 | if eq sid sch_res |
| 725 | apply_field_res ko kl vl |
| 726 | else |
| 727 | if eq sid sch_py |
| 728 | apply_field_py ko kl vl |
| 729 | else |
| 730 | put st s_badprop add get st s_badprop 1 |
| 731 | end |
| 732 | end |
| 733 | end |
| 734 | end |
| 735 | end |
| 736 | |
| 737 | fn handle_eval_line ls ulong lim ulong to void |
| 738 | p1 = add ls 5 |
| 739 | sp = find_sp p1 lim |
| 740 | if or eq sp p1 ge sp lim |
| 741 | put st s_badverd add get st s_badverd 1 |
| 742 | ret |
| 743 | end |
| 744 | p2 = add sp 1 |
| 745 | vc = parse_verdict p2 sub lim p2 |
| 746 | record_eval_run p1 sub sp p1 vc |
| 747 | end |
| 748 | |
| 749 | fn evaluate_loaded to int |
| 750 | tot = get st s_inlen |
| 751 | for i ulong 14 |
| 752 | if ne i s_inlen |
| 753 | put st i 0 |
| 754 | end |
| 755 | end |
| 756 | for j ulong 16 |
| 757 | put fldcnt j 0 |
| 758 | end |
| 759 | pos = ulong 0 |
| 760 | while lt pos tot bound 32768 |
| 761 | ls = pos |
| 762 | while lt pos tot bound 32768 |
| 763 | if eq get inbuf pos 10 |
| 764 | break |
| 765 | end |
| 766 | pos = add pos 1 |
| 767 | end |
| 768 | ll = sub pos ls |
| 769 | if gt ll 0 |
| 770 | if ne get inbuf ls 35 |
| 771 | if in_starts ls pos p_schema |
| 772 | so = add ls 7 |
| 773 | sl = sub pos so |
| 774 | if in_eq so sl sn_eng |
| 775 | put st s_schema sch_eng |
| 776 | else |
| 777 | if in_eq so sl sn_hc |
| 778 | put st s_schema sch_hc |
| 779 | else |
| 780 | if in_eq so sl sn_res |
| 781 | put st s_schema sch_res |
| 782 | else |
| 783 | if in_eq so sl sn_py |
| 784 | put st s_schema sch_py |
| 785 | else |
| 786 | put st s_schema sch_none |
| 787 | put st s_badline add get st s_badline 1 |
| 788 | end |
| 789 | end |
| 790 | end |
| 791 | end |
| 792 | else |
| 793 | if in_starts ls pos p_field |
| 794 | handle_field_line ls pos |
| 795 | else |
| 796 | if in_starts ls pos p_text |
| 797 | if check_slop add ls 5 pos |
| 798 | put st s_slop add get st s_slop 1 |
| 799 | end |
| 800 | else |
| 801 | if in_starts ls pos p_wf |
| 802 | check_wf_line ls pos |
| 803 | else |
| 804 | if in_starts ls pos p_eval |
| 805 | handle_eval_line ls pos |
| 806 | else |
| 807 | put st s_badline add get st s_badline 1 |
| 808 | end |
| 809 | end |
| 810 | end |
| 811 | end |
| 812 | end |
| 813 | end |
| 814 | end |
| 815 | if lt pos tot |
| 816 | pos = add pos 1 |
| 817 | end |
| 818 | end |
| 819 | sid = get st s_schema |
| 820 | if or eq sid sch_none gt get st s_badline 0 |
| 821 | ret 2 |
| 822 | end |
| 823 | req = ulong 0 |
| 824 | if eq sid sch_eng |
| 825 | req = ulong 6 |
| 826 | else |
| 827 | if eq sid sch_hc |
| 828 | req = ulong 5 |
| 829 | else |
| 830 | if eq sid sch_res |
| 831 | req = ulong 4 |
| 832 | else |
| 833 | req = ulong 5 |
| 834 | end |
| 835 | end |
| 836 | end |
| 837 | i = ulong 0 |
| 838 | while lt i req bound 8 |
| 839 | if eq get fldcnt i 0 |
| 840 | put st s_missfld add get st s_missfld 1 |
| 841 | end |
| 842 | i = add i 1 |
| 843 | end |
| 844 | sch_err = add add get st s_missfld get st s_badprop get st s_badlen |
| 845 | if gt sch_err 0 |
| 846 | ret 1 |
| 847 | end |
| 848 | if gt get st s_slop 0 |
| 849 | ret 1 |
| 850 | end |
| 851 | if gt get st s_badwf 0 |
| 852 | ret 1 |
| 853 | end |
| 854 | if eq get st s_runs 0 |
| 855 | ret 1 |
| 856 | end |
| 857 | if gt get st s_badverd 0 |
| 858 | ret 1 |
| 859 | end |
| 860 | if gt get st s_flaky 0 |
| 861 | ret 1 |
| 862 | end |
| 863 | if gt get st s_nonpass 0 |
| 864 | ret 1 |
| 865 | end |
| 866 | ret 0 |
| 867 | end |
| 868 | |
| 869 | fn main to int |
| 870 | note Test 1: valid engineering_fix schema + workflow + consistent multi-run PASS |
| 871 | load_in tc_eng_ok |
| 872 | if ne evaluate_loaded 0 |
| 873 | fail_case 1 |
| 874 | end |
| 875 | if or ne get st s_runs 3 ne get st s_evalcnt 2 |
| 876 | fail_case 1 |
| 877 | end |
| 878 | wstr 1 p_1 |
| 879 | |
| 880 | note Test 2: valid harness_change, research_handoff, and python_result schemas |
| 881 | load_in tc_hc_ok |
| 882 | if ne evaluate_loaded 0 |
| 883 | fail_case 2 |
| 884 | end |
| 885 | load_in tc_res_ok |
| 886 | if ne evaluate_loaded 0 |
| 887 | fail_case 2 |
| 888 | end |
| 889 | load_in tc_py_ok |
| 890 | if ne evaluate_loaded 0 |
| 891 | fail_case 2 |
| 892 | end |
| 893 | wstr 1 p_2 |
| 894 | |
| 895 | note Test 3: negative control - missing required field, short field, unknown property, unknown schema |
| 896 | load_in tc_bad_sch_fields |
| 897 | if ne evaluate_loaded 1 |
| 898 | fail_case 3 |
| 899 | end |
| 900 | if or ne get st s_badlen 1 or ne get st s_badprop 1 ne get st s_missfld 2 |
| 901 | fail_case 3 |
| 902 | end |
| 903 | load_in tc_unk_sch |
| 904 | if ne evaluate_loaded 2 |
| 905 | fail_case 3 |
| 906 | end |
| 907 | wstr 1 p_3 |
| 908 | |
| 909 | note Test 4: negative control - slop_gate forbidden phrase and antithesis pattern |
| 910 | load_in tc_slop |
| 911 | if ne evaluate_loaded 1 |
| 912 | fail_case 4 |
| 913 | end |
| 914 | if ne get st s_slop 2 |
| 915 | fail_case 4 |
| 916 | end |
| 917 | wstr 1 p_4 |
| 918 | |
| 919 | note Test 5: negative control - illegal workflow transitions |
| 920 | load_in tc_bad_wf |
| 921 | if ne evaluate_loaded 1 |
| 922 | fail_case 5 |
| 923 | end |
| 924 | if ne get st s_badwf 3 |
| 925 | fail_case 5 |
| 926 | end |
| 927 | wstr 1 p_5 |
| 928 | |
| 929 | note Test 6: negative control - invalid verdict vocabulary words |
| 930 | load_in tc_bad_verd |
| 931 | if ne evaluate_loaded 1 |
| 932 | fail_case 6 |
| 933 | end |
| 934 | if ne get st s_badverd 4 |
| 935 | fail_case 6 |
| 936 | end |
| 937 | wstr 1 p_6 |
| 938 | |
| 939 | note Test 7: negative control - flaky multi-run eval (PASS then FAIL) |
| 940 | load_in tc_flaky |
| 941 | if ne evaluate_loaded 1 |
| 942 | fail_case 7 |
| 943 | end |
| 944 | if ne get st s_flaky 1 |
| 945 | fail_case 7 |
| 946 | end |
| 947 | wstr 1 p_7 |
| 948 | |
| 949 | note Test 8: negative control - non-PASS valid verdicts & 0-run gate both fail closed |
| 950 | load_in tc_nonpass_vocab |
| 951 | if ne evaluate_loaded 1 |
| 952 | fail_case 8 |
| 953 | end |
| 954 | if or ne get st s_badverd 0 ne get st s_nonpass 4 |
| 955 | fail_case 8 |
| 956 | end |
| 957 | load_in tc_zero_runs |
| 958 | if ne evaluate_loaded 1 |
| 959 | fail_case 8 |
| 960 | end |
| 961 | wstr 1 p_8 |
| 962 | |
| 963 | wstr 1 p_all |
| 964 | ret 0 |
| 965 | end |