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 / scripts / prefill-gate / mutant.sh

65 lines · 2599 bytes Raw Blame History
1#!/usr/bin/env bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# PREFILL-GATE mutation check (shell only).
18#
19# Runs the prefill-gate tests with one mutant cargo feature switched on. The
20# mutant features are off by default and exist only for this check:
21# no_check aien-scheduler/prefill_mutant_no_check
22# (M1: scheduler readiness check removed)
23# ready_at_alloc aien-kv-cache/prefill_mutant_ready_at_alloc
24# (M2: block tables marked ready at allocation, no fence)
25# ready_at_alloc_e2e M2 again, caught end to end through aien-runtime
26#
27# Exit 0 ONLY when the mutant is caught: cargo test fails AND at least one test
28# whose name contains "prefill_gate" is reported FAILED. A build error is not a
29# catch and exits 1. A mutant that survives (all tests pass) exits 1.
30#
31# Usage: bash scripts/prefill-gate/mutant.sh no_check|ready_at_alloc|ready_at_alloc_e2e
32set -u
33
34ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
35MODE="${1:-}"
36case "$MODE" in
37 no_check)
38 ARGS=(-p aien-scheduler --features prefill_mutant_no_check) ;;
39 ready_at_alloc)
40 ARGS=(-p aien-kv-cache --features prefill_mutant_ready_at_alloc) ;;
41 ready_at_alloc_e2e)
42 ARGS=(-p aien-runtime --features aien-kv-cache/prefill_mutant_ready_at_alloc) ;;
43 *)
44 echo "usage: $0 no_check|ready_at_alloc|ready_at_alloc_e2e" >&2
45 exit 2 ;;
46esac
47
48LOG="$(mktemp -t "prefill-mutant-${MODE}-XXXXXX.log")"
49cd "$ROOT" || exit 2
50cargo test "${ARGS[@]}" --no-fail-fast >"$LOG" 2>&1
51RC=$?
52
53CAUGHT_RE='^test .*prefill_gate.* \.\.\. FAILED$'
54if [ "$RC" -eq 0 ]; then
55 echo "MUTANT SURVIVED ($MODE): every test passed with the mutant on. Log: $LOG"
56 exit 1
57fi
58if grep -Eq "$CAUGHT_RE" "$LOG"; then
59 echo "MUTANT CAUGHT ($MODE): cargo test exit $RC"
60 grep -E "$CAUGHT_RE" "$LOG"
61 exit 0
62fi
63echo "MUTANT NOT CAUGHT BY A PREFILL GATE TEST ($MODE): cargo exit $RC with no prefill_gate test failure (build error?). Log: $LOG"
64tail -n 30 "$LOG"
65exit 1