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-runtime / tests / requirements_under_bound_test.rs

83 lines · 2905 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
16//! sc#383 item 1: the WHOLE-SYSTEM-E2E contract objective ("write a Markdown
17//! report under 200 words named report.md in the outbox folder") was refused
18//! as an uncertain requirement before any model call, because only the
19//! `at most` family was read. `under|below N words|lines` now reads as fewer
20//! than N and `within N words|lines` as at most N; other nouns and negated
21//! forms stay UNCERTAIN, never dropped.
22use aien_runtime::requirements::{analyze, Requirement};
23
24use Requirement::*;
25
26fn reqs(goal: &str) -> Vec<Requirement> {
27 let ex = analyze(goal);
28 assert!(
29 ex.uncertain.is_empty(),
30 "{goal:?} should be read, uncertain: {:?}",
31 ex.uncertain
32 );
33 ex.requirements
34}
35
36fn uncertain(goal: &str) {
37 let ex = analyze(goal);
38 assert!(
39 !ex.uncertain.is_empty(),
40 "{goal:?} must stay UNCERTAIN, read as {:?}",
41 ex.requirements
42 );
43}
44
45#[test]
46fn the_contract_objective_word_bound_is_read() {
47 // RUN-1-dry-20261010T133749Z row E3, the refused clause, verbatim.
48 let g = "Write a Markdown report under 200 words named report.md in the outbox folder.";
49 assert_eq!(reqs(g), [MaxWords(199)]);
50}
51
52#[test]
53fn under_and_below_are_strict_upper_bounds() {
54 assert_eq!(reqs("Keep it under 200 words."), [MaxWords(199)]);
55 assert_eq!(reqs("Write a poem below twelve lines."), [MaxLines(11)]);
56 assert_eq!(reqs("Write a note under 40 words long."), [MaxWords(39)]);
57 // the same bound as the wording that was already read
58 assert_eq!(
59 reqs("Keep it under 200 words."),
60 reqs("Keep it fewer than 200 words.")
61 );
62}
63
64#[test]
65fn within_is_an_inclusive_upper_bound() {
66 assert_eq!(reqs("Summarise it within 120 words."), [MaxWords(120)]);
67 assert_eq!(
68 reqs("Summarise it within 120 words."),
69 reqs("Summarise it in no more than 120 words.")
70 );
71}
72
73#[test]
74fn other_nouns_and_negations_stay_uncertain() {
75 // a structure, not a bound
76 uncertain("Write the report under three sections.");
77 // a measure no requirement checks
78 uncertain("Keep each line under 80 characters.");
79 // negated
80 uncertain("The summary must not be under 200 words.");
81 // a bound of nothing
82 uncertain("Keep it under 1 words.");
83}