interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-capability / tests / effects.rs

57 lines · 2307 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16use aien_capability::{routing_class, speculation_safe, EffectClass, ToolEffects};
17
18#[test]
19fn highest_declared_bit_wins() {
20 let read_and_send = ToolEffects::READ_NETWORK | ToolEffects::EXTERNAL_IRREVERSIBLE;
21 assert_eq!(
22 routing_class(read_and_send),
23 EffectClass::ExternalIrreversible
24 );
25
26 let write = ToolEffects::READ_FILESYSTEM | ToolEffects::EXTERNAL_WRITE;
27 assert_eq!(routing_class(write), EffectClass::ExternalWrite);
28
29 let world = ToolEffects::WORLD_MUTATION | ToolEffects::READ_FILESYSTEM;
30 assert_eq!(routing_class(world), EffectClass::WorldMutation);
31
32 let compile = ToolEffects::SPAWN_PROCESS | ToolEffects::LOCAL_EPHEMERAL;
33 assert_eq!(routing_class(compile), EffectClass::LocalEphemeral);
34
35 let search = ToolEffects::READ_NETWORK | ToolEffects::SECRET_BEARING;
36 assert_eq!(routing_class(search), EffectClass::ReadOnly);
37
38 assert_eq!(routing_class(ToolEffects::PURE), EffectClass::Pure);
39}
40
41#[test]
42fn speculation_is_safe_only_for_reversible_classes() {
43 assert!(speculation_safe(ToolEffects::PURE));
44 assert!(speculation_safe(ToolEffects::READ_NETWORK));
45 assert!(speculation_safe(
46 ToolEffects::READ_FILESYSTEM | ToolEffects::SECRET_BEARING
47 ));
48 assert!(speculation_safe(ToolEffects::LOCAL_EPHEMERAL));
49 assert!(speculation_safe(ToolEffects::SPAWN_PROCESS));
50
51 assert!(!speculation_safe(ToolEffects::WORLD_MUTATION));
52 assert!(!speculation_safe(ToolEffects::EXTERNAL_WRITE));
53 assert!(!speculation_safe(ToolEffects::EXTERNAL_IRREVERSIBLE));
54 assert!(!speculation_safe(
55 ToolEffects::READ_NETWORK | ToolEffects::EXTERNAL_IRREVERSIBLE
56 ));
57}