refactor(vm)!: remove publication and logical guard opcodes
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good

Remove INDEX_GUARD, ARRAY_CHECK_LENGTH, STORAGE_PUBLISH and FIELDS_PUBLISH
from decoding, metadata, tooling, verification and execution. Keep ARRAY_LEN
and overlap-safe ARRAY_COPY with complete-group ownership and early charging
of calculable copy work, including refused attempts.

Update specifications, producer handoff, qualification evidence and lessons.
Share collection test support and remove redundant Copy clones for Clippy.

Validation: make ci-domains passed with 1,095 workspace tests, five separately
executed debugger socket tests and all 15 unchanged coverage domain gates.
VM release, resource diagnostics and layer/quality suites also passed.

BREAKING CHANGE: PBX using opcodes 0xA7, 0xA8, 0xAA or 0xAB is rejected,
including unreachable instructions. Consumers must adapt their emission and
collection algorithms or operational guarantees.
This commit is contained in:
2026-10-23 23:37:56 +01:00
parent 69ad1931de
commit dcf6561ea7
27 changed files with 1407 additions and 1013 deletions
@@ -132,3 +132,39 @@ fn collection_load_limits_and_analysis_refusals_keep_context_and_refund_scratch(
assert_eq!(budget.used(LoadResource::RegistryBytes), 0);
}
}
#[test]
fn removed_storage_opcodes_reject_even_in_unreachable_instruction_positions() {
use prometeu_bytecode::load_limits::{LoadCode, LoadReason};
use prometeu_vm::VmInitError;
for opcode in [0xa7u16, 0xa8, 0xaa, 0xab] {
for dead in [false, true] {
let mut code = if dead { vec![1, 0] } else { vec![] };
let pc = code.len() as u32;
code.extend_from_slice(&opcode.to_le_bytes());
let VmInitError::RegistryLoadFailed(error) = load(&code).unwrap_err() else { panic!() };
assert_eq!(error.code, LoadCode::InvalidCode);
assert_eq!(error.reason, LoadReason::UnknownOpcode);
assert_eq!((error.function, error.pc), (Some(0), Some(pc)));
}
}
// The same bytes are accepted as an Int64 immediate, never decoded as opcodes.
let code = [0x14, 0, 0xa7, 0, 0xa8, 0, 0xaa, 0, 0xab, 0, 1, 0];
assert_eq!(
run(&code),
[Value::Int64(i64::from_le_bytes([0xa7, 0, 0xa8, 0, 0xaa, 0, 0xab, 0]))]
);
}
#[test]
fn neutral_pbx_copy_moves_a_range_and_preserves_physical_length() {
let code=assemble("PUSH_I64 2\nARRAY_NEW 11\nSET_GLOBAL 0\nGET_GLOBAL 0\nPUSH_I64 0\nPUSH_I32 42\nARRAY_SET 11\nGET_GLOBAL 0\nPUSH_I64 0\nGET_GLOBAL 0\nPUSH_I64 1\nPUSH_I64 1\nARRAY_COPY 11\nGET_GLOBAL 0\nPUSH_I64 1\nARRAY_GET 11\nGET_GLOBAL 0\nARRAY_LEN 11\nHALT").unwrap();
assert_eq!(run(&code), [Value::Int64(2), Value::Int32(42)]);
for text in [
"HALT\nARRAY_COPY 9",
"HALT\nARRAY_COPY 99",
"PUSH_I64 1\nARRAY_NEW 11\nPUSH_I64 0\nPUSH_I64 1\nARRAY_NEW 11\nPUSH_I64 0\nPUSH_BOOL 1\nARRAY_COPY 11\nHALT",
] {
assert!(load(&assemble(text).unwrap()).is_err(), "{text}");
}
}