interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / si / aien-harness / test.om

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