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 / cortex-path-m1 / src / fixture.rs

78 lines · 2668 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 serde::{Deserialize, Serialize};
17
18#[derive(Debug, Clone, Deserialize, Serialize)]
19#[serde(rename_all = "camelCase")]
20pub struct EvalFixture {
21 #[serde(default)]
22 pub kind: String,
23 pub cases: Vec<EvalCase>,
24}
25
26#[derive(Debug, Clone, Deserialize, Serialize)]
27#[serde(rename_all = "camelCase")]
28pub struct EvalCase {
29 pub id: String,
30 pub space_slug: String,
31 pub query: String,
32 pub relevant_entity_ids: Vec<String>,
33 pub query_embedding: Vec<f32>,
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
37pub struct FixtureRejection {
38 pub reasons: Vec<String>,
39}
40
41pub fn load_fixture(bytes: &[u8]) -> Result<EvalFixture, String> {
42 serde_json::from_slice(bytes).map_err(|err| format!("fixture JSON: {err}"))
43}
44
45pub fn structural_rejection(fixture: &EvalFixture) -> FixtureRejection {
46 let mut reasons = Vec::new();
47 if fixture.cases.len() < 50 {
48 reasons.push(format!(
49 "fixture has {} cases; a scientific run needs at least 50",
50 fixture.cases.len()
51 ));
52 }
53 let mut seen = std::collections::BTreeSet::new();
54 for case in &fixture.cases {
55 if !seen.insert(case.id.clone()) {
56 reasons.push(format!("duplicate case id {}", case.id));
57 }
58 if case.relevant_entity_ids.is_empty() {
59 reasons.push(format!("case {} has no relevant entities", case.id));
60 }
61 if case.query_embedding.is_empty()
62 || case.query_embedding.iter().any(|value| !value.is_finite())
63 {
64 reasons.push(format!("case {} needs a finite query embedding", case.id));
65 }
66 if case.query.trim().is_empty() || case.space_slug.trim().is_empty() {
67 reasons.push(format!("case {} needs a query and a space", case.id));
68 }
69 }
70 FixtureRejection { reasons }
71}
72
73pub fn relational_case(query: &str, canonical_names: &[String]) -> bool {
74 let needle = query.to_lowercase();
75 canonical_names
76 .iter()
77 .any(|name| !name.to_lowercase().contains(&needle))
78}