From cb6935b55e77a827117f12d7155f2076f4aa92af Mon Sep 17 00:00:00 2001 From: Zachary Canann Date: Fri, 4 Dec 2026 05:35:29 +0000 Subject: [PATCH] bootstrap: author terminal call and conversion refusal fixtures Keep the twelve constructor programs, selected package sources and expected diagnostic coordinates in the existing Omega fixture format. The service-reach gate still checks the returned refusal bytes. Proof: All 160 gate packets and expectations agree with the previous generation, and all twelve selected baseline controls passed the supplied constructor. Agent: Codex | Model: unavailable | Effort: unavailable | Tokens: unavailable in (unavailable cached), unavailable out | Steps: unavailable | Time: unavailable | Steers: unavailable --- tests/bootstrap/independent/service_reach.py | 25 +++++++++---------- .../byte_conversion_refusals/cases.tsv | 6 +++++ .../byte_conversion_refusals/hex-carrier.omg | 1 + .../nine-bit-mask.omg | 1 + .../noncontiguous-mask.omg | 1 + .../byte_conversion_refusals/overflow-hex.omg | 1 + .../overflow-wide-hex.omg | 1 + .../unproved-byte-cast.omg | 1 + .../terminal_call_arguments/cases.tsv | 6 +++++ .../terminal_call_arguments/packages.json | 4 +++ .../terminal-argument-carrier/app/main.omg | 2 ++ .../terminal-argument-type/app/main.omg | 2 ++ .../terminal-expression-type/app/main.omg | 2 ++ .../terminal-extra-argument/app/main.omg | 2 ++ .../terminal-missing-argument/app/main.omg | 2 ++ .../terminal-valid-negative/app/main.omg | 2 ++ 16 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/cases.tsv create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/hex-carrier.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/nine-bit-mask.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/noncontiguous-mask.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-hex.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-wide-hex.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/unproved-byte-cast.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/cases.tsv create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/packages.json create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-carrier/app/main.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-type/app/main.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-expression-type/app/main.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-extra-argument/app/main.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-missing-argument/app/main.omg create mode 100644 tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-valid-negative/app/main.omg diff --git a/tests/bootstrap/independent/service_reach.py b/tests/bootstrap/independent/service_reach.py index 753d9073ad2..85044572357 100644 --- a/tests/bootstrap/independent/service_reach.py +++ b/tests/bootstrap/independent/service_reach.py @@ -12,6 +12,15 @@ from compiled import add_invocation_budget, execute, pack, stamp from conformance.vectors import epsilon_request from independent.byte_input_cases import byte_input_cases +from independent.compiler_cases import fixture_rows + + +def authored_refusals(suite): + directory = ROOT / 'tests/fixtures/bootstrap/compiler_cases' / suite + for name, packet, outcome, location in fixture_rows(directory): + if outcome != 'refuse' or not isinstance(location, tuple): + raise ValueError(f'{directory}: {name} needs an exact refusal coordinate') + yield name, packet, struct.pack('u8 {fake()}', (1, 0, b'fake()')) - call = import_exit + b'machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process(' - yield trial('terminal-argument-type', call + b'true);}', (1, 0, b'true')) - yield trial('terminal-argument-carrier', call + b'255u32);}', (1, 0, b'255u32')) - yield trial('terminal-missing-argument', call + b');}', (1, 0, b'|process_exit|::ProcessExit::exit_process')) - yield trial('terminal-extra-argument', call + b'0, 1);}', (1, 0, b'|process_exit|::ProcessExit::exit_process')) - yield trial('terminal-valid-negative', call + b'-2147483648i32);}', (2, 1, b'boundary trait ProcessExit')) - yield trial('terminal-expression-type', call + b'false)}', (1, 0, b'false')) + yield from authored_refusals('terminal_call_arguments') yield trial('pure-unit-entry', b'machine main(){}', 0, standalone=True) yield trial('unit-entry-calls-helper', b'machine helper(){} machine main(){helper();}', 0) @@ -312,12 +315,8 @@ def trial(name, source, outcome): b'{true -> yes(), _ -> no()} machine yes()->u8{42} machine no()->u8{9}}', 42) yield trial('zero-mask-still-evaluates', b'machine fail()->i32 crashes? Trap {crash Trap;} ' b'machine main()->u8 crashes? Trap {(0i32 & fail()) as u8}', 'trap') - yield trial('unproved-byte-cast', b'machine f(x:i32)->u8{x as u8} machine main()->u8{f(7)}', (2, b'x as')) - yield trial('nine-bit-mask', b'machine f(x:i32)->u8{(x & 0x1FF) as u8} machine main()->u8{f(7)}', (2, b'(x &')) - yield trial('noncontiguous-mask', b'machine f(x:i32)->u8{(x & 0xAA) as u8} machine main()->u8{f(7)}', (2, b'&')) - yield trial('overflow-hex', b'machine main()->u8{0x100u8}', (1, b'0x100')) - yield trial('overflow-wide-hex', b'machine main()->u8{let x:u64=0x1_0000_0000_0000_0000u64;42}', (1, b'0x1')) - yield trial('hex-carrier', b'machine main()->u8{0x2Au32}', (1, b'0x2A')) + yield from authored_refusals('byte_conversion_refusals') + def build_scope_cases(): encode = runpy.run_path(str(ROOT / 'tests/bootstrap/independent/construct.py'))['encode'] diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/cases.tsv b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/cases.tsv new file mode 100644 index 00000000000..cb064904c01 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/cases.tsv @@ -0,0 +1,6 @@ +unproved-byte-cast refuse 2 0 x as +nine-bit-mask refuse 2 0 (x & +noncontiguous-mask refuse 2 0 & +overflow-hex refuse 1 0 0x100 +overflow-wide-hex refuse 1 0 0x1 +hex-carrier refuse 1 0 0x2A diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/hex-carrier.omg b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/hex-carrier.omg new file mode 100644 index 00000000000..30ba9a8b7a3 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/hex-carrier.omg @@ -0,0 +1 @@ +machine main()->u8{0x2Au32} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/nine-bit-mask.omg b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/nine-bit-mask.omg new file mode 100644 index 00000000000..af7fa817bd7 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/nine-bit-mask.omg @@ -0,0 +1 @@ +machine f(x:i32)->u8{(x & 0x1FF) as u8} machine main()->u8{f(7)} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/noncontiguous-mask.omg b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/noncontiguous-mask.omg new file mode 100644 index 00000000000..d0c69611c24 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/noncontiguous-mask.omg @@ -0,0 +1 @@ +machine f(x:i32)->u8{(x & 0xAA) as u8} machine main()->u8{f(7)} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-hex.omg b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-hex.omg new file mode 100644 index 00000000000..cd58fd5b2a3 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-hex.omg @@ -0,0 +1 @@ +machine main()->u8{0x100u8} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-wide-hex.omg b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-wide-hex.omg new file mode 100644 index 00000000000..225163b2ca6 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/overflow-wide-hex.omg @@ -0,0 +1 @@ +machine main()->u8{let x:u64=0x1_0000_0000_0000_0000u64;42} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/unproved-byte-cast.omg b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/unproved-byte-cast.omg new file mode 100644 index 00000000000..35323201488 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/byte_conversion_refusals/unproved-byte-cast.omg @@ -0,0 +1 @@ +machine f(x:i32)->u8{x as u8} machine main()->u8{f(7)} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/cases.tsv b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/cases.tsv new file mode 100644 index 00000000000..226c605a012 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/cases.tsv @@ -0,0 +1,6 @@ +terminal-argument-type refuse 1 0 true +terminal-argument-carrier refuse 1 0 255u32 +terminal-missing-argument refuse 1 0 |process_exit|::ProcessExit::exit_process +terminal-extra-argument refuse 1 0 |process_exit|::ProcessExit::exit_process +terminal-valid-negative refuse 2 1 boundary trait ProcessExit +terminal-expression-type refuse 1 0 false diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/packages.json b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/packages.json new file mode 100644 index 00000000000..40e1c58f8b6 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/packages.json @@ -0,0 +1,4 @@ +[ + {"name": "app", "files": ["main.omg"]}, + {"name": "omega_language_core", "role": 1, "root": "source/library/core", "files": ["process_exit.omg", "never.omg"]} +] diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-carrier/app/main.omg b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-carrier/app/main.omg new file mode 100644 index 00000000000..a5ae5b88c39 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-carrier/app/main.omg @@ -0,0 +1,2 @@ +use {omega}/language/core/process_exit.omg; +machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process(255u32);} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-type/app/main.omg b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-type/app/main.omg new file mode 100644 index 00000000000..73c0bc2b35e --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-argument-type/app/main.omg @@ -0,0 +1,2 @@ +use {omega}/language/core/process_exit.omg; +machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process(true);} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-expression-type/app/main.omg b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-expression-type/app/main.omg new file mode 100644 index 00000000000..b0758b0198d --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-expression-type/app/main.omg @@ -0,0 +1,2 @@ +use {omega}/language/core/process_exit.omg; +machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process(false)} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-extra-argument/app/main.omg b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-extra-argument/app/main.omg new file mode 100644 index 00000000000..738300b1f59 --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-extra-argument/app/main.omg @@ -0,0 +1,2 @@ +use {omega}/language/core/process_exit.omg; +machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process(0, 1);} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-missing-argument/app/main.omg b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-missing-argument/app/main.omg new file mode 100644 index 00000000000..f4315925fec --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-missing-argument/app/main.omg @@ -0,0 +1,2 @@ +use {omega}/language/core/process_exit.omg; +machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process();} \ No newline at end of file diff --git a/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-valid-negative/app/main.omg b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-valid-negative/app/main.omg new file mode 100644 index 00000000000..7fa530117dc --- /dev/null +++ b/tests/fixtures/bootstrap/compiler_cases/terminal_call_arguments/terminal-valid-negative/app/main.omg @@ -0,0 +1,2 @@ +use {omega}/language/core/process_exit.omg; +machine main()->u8 reaches |process_exit|::ProcessExit {|process_exit|::ProcessExit::exit_process(-2147483648i32);} \ No newline at end of file