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

GitHub aien-dev/aien-sovereign-core-mv#659 (code only)

closed derived c5a32a540697bf56 #659

Imported from GitHub aien-dev/aien-sovereign-core-mv#659 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 22ea08c4739b8a84f18c042dfb38a16e804f8100 · Head 5285ae5ac95f816c526ab3a6015576a6cde86e60

Apply it

git checkout -b patch-c5a32a540697bf56 22ea08c4739b8a84f18c042dfb38a16e804f8100
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/c5a32a540697bf56.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
659
5285ae5ac95f816c526ab3a6015576a6cde86e60
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":659,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/659","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:47Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index e03ecb9a..cd597812 100644
--- a/.crumb
+++ b/.crumb
@@ -119,14 +119,14 @@
         }
       ],
       "children_root": "sha256:111edf8bf001ed434f7dacbc6d8ab9d75f6bda2cd909d01264fb42bbe38b1d74",
-      "compiled_at": "2026-10-18T14:31:44Z",
+      "compiled_at": "2026-10-18T15:24:59Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:0fa2f5ddee789ea7b983efefd1e4cb12ab60354412716000662dd0535d7376f5",
+      "digest": "sha256:1f01471551e5816afb431c113f9e14af5186bcbfcdbfda64d1811b44421be349",
       "evidence_files": 1578,
       "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160",
       "files": 5891,
-      "generated_at_commit": "ecf36a2429f57b9764215d9e615cd018f83dd5bc",
-      "source_tree": "sha256:449e870b9a0cbc1768dd48686893b0730ae30260103df0973a3d4e4652dcc753"
+      "generated_at_commit": "371e0e887ba923af19e29348b11bcaf9e30d1097",
+      "source_tree": "sha256:cdc9d9091539832173a31167c590bc6f7e4f7d1e89fa13571d54ff500451ad8d"
     }
   },
   "history": [],
diff --git a/tools/aien-test/docs/LOCAL_VERIFICATION.md b/tools/aien-test/docs/LOCAL_VERIFICATION.md
index d8f9951c..35aa0659 100644
--- a/tools/aien-test/docs/LOCAL_VERIFICATION.md
+++ b/tools/aien-test/docs/LOCAL_VERIFICATION.md
@@ -23,6 +23,11 @@ gate whose `cache_scope` is `hardware` cannot count.
 
 ## The plan
 
+An `inputs` entry is a path prefix: `src/` covers everything under `src/`.
+An `inputs_top: [src]` entry covers only the files directly in `src/`, not
+its subfolders and not dot files such as `src/.crumb`. Use it when a gate
+builds from the top of a folder whose subfolders belong to other gates.
+
 Selection is the set of gates whose watched paths (declared `inputs`, the
 D3 implied inputs, the manifest file, the golden file) cover a changed path,
 plus the always set, closed over dependents and then dependencies. Sections:
diff --git a/tools/aien-test/src/identity.rs b/tools/aien-test/src/identity.rs
index 3109689d..bf42eed6 100644
--- a/tools/aien-test/src/identity.rs
+++ b/tools/aien-test/src/identity.rs
@@ -17,7 +17,7 @@
 
 use crate::evidence::{canonical, sha256_hex};
 use crate::graph::Graph;
-use crate::manifest::{CacheScope, Manifest};
+use crate::manifest::{self, CacheScope, Manifest};
 use crate::process;
 use serde_json::{json, Value};
 use std::collections::{BTreeMap, BTreeSet};
@@ -74,8 +74,17 @@ fn git_ls_files(root: &Path, spec: &str) -> Result<Vec<(String, String)>, String
 pub fn input_blob_ids(m: &Manifest, root: &Path) -> Result<Vec<Value>, String> {
     let mut rows: BTreeMap<String, Option<String>> = BTreeMap::new();
     for input in &m.inputs {
-        let spec = input.trim_end_matches('/');
-        let found = git_ls_files(root, spec)?;
+        let (spec, found) = match manifest::shallow_dir(input) {
+            Some(dir) => {
+                let mut found = git_ls_files(root, dir)?;
+                found.retain(|(path, _)| manifest::directly_in(dir, path));
+                (input.as_str(), found)
+            }
+            None => {
+                let spec = input.trim_end_matches('/');
+                (spec, git_ls_files(root, spec)?)
+            }
+        };
         if found.is_empty() {
             rows.entry(spec.to_string()).or_insert(None);
         }
@@ -120,6 +129,24 @@ pub fn declared_dependencies(m: &Manifest) -> Vec<String> {
 pub fn input_blob_ids_from_rows(m: &Manifest, tree: &BTreeMap<String, String>) -> Vec<Value> {
     let mut rows: BTreeMap<String, Option<String>> = BTreeMap::new();
     for input in &m.inputs {
+        if let Some(dir) = manifest::shallow_dir(input) {
+            // Same null-row key as `input_blob_ids`: the entry as written (`<dir>/*`).
+            let prefix = format!("{dir}/");
+            let mut found = false;
+            for (path, blob) in tree.range(prefix.clone()..) {
+                if !path.starts_with(&prefix) {
+                    break;
+                }
+                if manifest::directly_in(dir, path) {
+                    rows.insert(path.clone(), Some(blob.clone()));
+                    found = true;
+                }
+            }
+            if !found {
+                rows.entry(input.clone()).or_insert(None);
+            }
+            continue;
+        }
         let spec = input.trim_end_matches('/');
         let prefix = format!("{spec}/");
         let mut found = false;
@@ -267,12 +294,12 @@ pub fn graph_identities(
 pub fn select_changed(graph: &Graph, changed: &[String]) -> BTreeSet<usize> {
     let touched: Vec<usize> = (0..graph.len())
         .filter(|&i| {
-            graph.node(i).manifest.inputs.iter().any(|input| {
-                let dir = input.trim_end_matches('/');
-                changed
-                    .iter()
-                    .any(|c| c == dir || c.starts_with(&format!("{dir}/")))
-            })
+            graph
+                .node(i)
+                .manifest
+                .inputs
+                .iter()
+                .any(|input| changed.iter().any(|c| manifest::input_covers(input, c)))
         })
         .collect();
     let mut seeds = touched;
@@ -624,3 +651,49 @@ mod rows_tests {
         assert_eq!(a, r);
     }
 }
+
+#[cfg(test)]
+mod inputs_top_tests {
+    use super::*;
+    use crate::testutil::init_repo;
+    use std::process::Command;
+
+    /// omega#524: an `inputs_top` folder contributes only its direct, non-dot files, and the
+    /// index listing and the tree listing agree (including the null row for an empty folder).
+    #[test]
+    fn inputs_top_rows_are_direct_files_only_in_both_listings() {
+        let g = "gate: A\nmanifest_version: 2\nowner: t\nrequires:\n  - host\ninputs_top:\n  - src\n  - empty\nrun:\n  exec: run.sh\nexpects:\n  exit: 0\n  verdict: PASS\ntimeout: 5s\n";
+        let t = init_repo(
+            "ident-top",
+            &[
+                ("a.gate", g, false),
+                ("run.sh", "#!/bin/sh\n", true),
+                ("src/a.c", "a\n", false),
+                ("src/.crumb", "{}\n", false),
+                ("src/lane/l.c", "l\n", false),
+                ("src-x/b.c", "b\n", false),
+                ("empty/sub/x.c", "x\n", false),
+            ],
+        );
+        let m = manifest::parse(g.as_bytes()).unwrap();
+        let from_index = input_blob_ids(&m, t.path()).unwrap();
+        let mut cmd = Command::new("git");
+        cmd.arg("-C").arg(t.path()).args(["ls-tree", "-r", "HEAD"]);
+        let out = process::output_gated(&mut cmd).unwrap();
+        let mut tree = BTreeMap::new();
+        for line in String::from_utf8_lossy(&out.stdout).lines() {
+            let (meta, path) = line.split_once('\t').unwrap();
+            tree.insert(
+                path.to_string(),
+                meta.split(' ').nth(2).unwrap().to_string(),
+            );
+        }
+        assert_eq!(from_index, input_blob_ids_from_rows(&m, &tree));
+        let paths: Vec<&str> = from_index
+            .iter()
+            .map(|r| r["path"].as_str().unwrap())
+            .collect();
+        assert_eq!(paths, ["empty/*", "src/a.c"]);
+        assert!(from_index[0]["blob_id"].is_null());
+    }
+}
diff --git a/tools/aien-test/src/manifest.rs b/tools/aien-test/src/manifest.rs
index a7deafc7..e211925f 100644
--- a/tools/aien-test/src/manifest.rs
+++ b/tools/aien-test/src/manifest.rs
@@ -220,6 +220,28 @@ pub fn valid_obs_name(s: &str) -> bool {
     chars.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '.' || c == '-')
 }
 
+/// The folder of an `inputs_top` entry (`<dir>/*` in `inputs`), or None for a plain input.
+pub fn shallow_dir(input: &str) -> Option<&str> {
+    input.strip_suffix("/*")
+}
+
+/// `path` is a file directly inside `dir` whose name does not start with a dot.
+pub fn directly_in(dir: &str, path: &str) -> bool {
+    path.strip_prefix(dir)
+        .and_then(|r| r.strip_prefix('/'))
+        .is_some_and(|n| !n.is_empty() && !n.contains('/') && !n.starts_with('.'))
+}
+
+/// A changed `path` falls under one entry of `inputs`: the input itself or anything below
+/// it, or, for an `inputs_top` entry, a file directly inside its folder.
+pub fn input_covers(input: &str, path: &str) -> bool {
+    if let Some(dir) = shallow_dir(input) {
+        return directly_in(dir, path);
+    }
+    let dir = input.trim_end_matches('/');
+    path == dir || path.starts_with(&format!("{dir}/"))
+}
+
 fn valid_rel_path(s: &str) -> bool {
     !s.is_empty() && !s.starts_with('/') && !s.contains('\0') && !s.split('/').any(|c| c == "..")
 }
@@ -465,13 +487,14 @@ pub const REQUIRES_V2: [&str; 9] = [
     "operator",
 ];
 
-const V2_KEYS: [&str; 6] = [
+const V2_KEYS: [&str; 7] = [
     "exactness",
     "tolerance",
     "backends",
     "fallback",
     "cache_scope",
     "oracle",
+    "inputs_top",
 ];
 
 fn bad<T>(msg: String) -> Result<T, ManifestError> {
@@ -702,13 +725,14 @@ pub fn parse(bytes: &[u8]) -> Result<Manifest, ManifestError> {
     }
     let entries = parse_entries(text)?;
 
-    const KNOWN: [&str; 19] = [
+    const KNOWN: [&str; 20] = [
         "gate",
         "manifest_version",
         "owner",
         "requires",
         "depends_on",
         "inputs",
+        "inputs_top",
         "build",
         "run",
         "expects",
@@ -793,17 +817,32 @@ pub fn parse(bytes: &[u8]) -> Result<Manifest, ManifestError> {
             return Err(ManifestError(format!("invalid depends_on id {d:?}")));
         }
     }
-    let inputs = match get("inputs") {
+    let mut inputs = match get("inputs") {
         Some(e) => list(e)?,
         None => Vec::new(),
     };
     for i in &inputs {
-        if !valid_rel_path(i) {
+        if !valid_rel_path(i) || shallow_dir(i).is_some() {
             return Err(ManifestError(format!(
                 "inputs path must be repo-relative: {i:?}"
             )));
         }
     }
+    // `inputs_top` (v2, omega#524): only the tracked files directly inside each folder, not
+    // its subfolders and not its dotfiles (`.crumb`). Kept in `inputs` as `<dir>/*`, which
+    // `shallow_dir` and `input_covers` read. A plain input may not end in `/*`, and a binary
+    // older than this key refuses the manifest (unknown key) instead of misreading it.
+    if let Some(e) = get("inputs_top") {
+        for d in list(e)? {
+            let d = d.trim_end_matches('/');
+            if !valid_rel_path(d) || d.contains('*') {
+                return Err(ManifestError(format!(
+                    "inputs_top folder must be repo-relative: {d:?}"
+                )));
+            }
+            inputs.push(format!("{d}/*"));
+        }
+    }
 
     let build = match get("build") {
         None => None,
@@ -1234,6 +1273,39 @@ mod tests {
         assert_eq!(m.oracle.compare.as_deref(), Some("G-0"));
     }
 
+    #[test]
+    fn inputs_top_parses_into_shallow_entries() {
+        let m =
+            parse(v2("inputs:\n  - mk/\ninputs_top:\n  - src\n  - tools/\n").as_bytes()).unwrap();
+        assert_eq!(m.inputs, ["mk/", "src/*", "tools/*"]);
+        assert_eq!(shallow_dir("src/*"), Some("src"));
+        assert_eq!(shallow_dir("src/"), None);
+        // v1 does not know the key; plain inputs may not spell the shallow form.
+        let e = parse(with("inputs_top:\n  - src\n").as_bytes())
+            .unwrap_err()
+            .0;
+        assert!(e.contains("requires manifest_version 2"), "{e}");
+        assert!(v2_err("inputs:\n  - src/*\n").contains("repo-relative"));
+        for bad in ["/abs", "a/../b", "src/*/x", "*"] {
+            let e = v2_err(&format!("inputs_top:\n  - {bad}\n"));
+            assert!(e.contains("inputs_top folder"), "{bad}: {e}");
+        }
+    }
+
+    #[test]
+    fn input_covers_reads_both_forms() {
+        assert!(input_covers("src/", "src/visor/a.c"));
+        assert!(input_covers("src", "src"));
+        assert!(!input_covers("src", "srcx/a.c"));
+        assert!(input_covers("src/*", "src/a.c"));
+        assert!(!input_covers("src/*", "src/visor/a.c"));
+        assert!(!input_covers("src/*", "src/.crumb"));
+        assert!(!input_covers("src/*", "src"));
+        assert!(!input_covers("src/*", "src-x/a.c"));
+        assert!(directly_in("a/b", "a/b/c.h"));
+        assert!(!directly_in("a/b", "a/bc.h"));
+    }
+
     #[test]
     fn v2_refusals() {
         let tol = "tolerance:\n  metric: m\n  abs: 1\n  rel_ppm: 1\n";
diff --git a/tools/aien-test/src/plan.rs b/tools/aien-test/src/plan.rs
index e24aa846..c924277e 100644
--- a/tools/aien-test/src/plan.rs
+++ b/tools/aien-test/src/plan.rs
@@ -466,8 +466,12 @@ pub fn watched(m: &Manifest, rel: &str, rows: &BTreeMap<String, String>) -> Vec<
     v
 }
 
-/// `input` is `path` or a directory above it.
+/// `input` is `path` or a directory above it; an `inputs_top` entry (`<dir>/*`)
+/// covers only the files directly inside its folder.
 pub fn covers(input: &str, path: &str) -> bool {
+    if let Some(dir) = manifest::shallow_dir(input) {
+        return manifest::directly_in(dir, path);
+    }
     let input = input.trim_end_matches('/');
     input.is_empty() || path == input || path.starts_with(&format!("{input}/"))
 }
@@ -1494,6 +1498,36 @@ mod tests {
         assert_eq!(p.unmapped, ["src/kern/other.rs"]);
     }
 
+    /// omega#524: a gate that names `src` in `inputs_top` is selected by a file directly in
+    /// `src/`, not by one in a subfolder and not by the folder's `.crumb`.
+    #[test]
+    fn inputs_top_selects_only_files_directly_in_the_folder() {
+        let top = gate("TOP", &["mk/"], "inputs_top:\n  - src\n");
+        let lane = gate("LANE", &["src/lane/"], "");
+        let t = init_repo(
+            "plan-top",
+            &[
+                ("gates/top.gate", top.as_str(), false),
+                ("gates/lane.gate", lane.as_str(), false),
+                ("run.sh", "#!/bin/sh\n", true),
+                ("mk/a.mk", "x\n", false),
+                ("src/core.c", "int a;\n", false),
+                ("src/.crumb", "{}\n", false),
+                ("src/lane/l.c", "int l;\n", false),
+            ],
+        );
+        commit(&t, &[("src/lane/l.c", "int l2;\n")]);
+        assert_eq!(all_gates(&plan_of(&t)), ["LANE"]);
+        commit(&t, &[("src/.crumb", "{\"v\":2}\n")]);
+        assert!(plan_of(&t).entries.is_empty());
+        commit(&t, &[("src/core.c", "int b;\n")]);
+        let p = plan_of(&t);
+        assert_eq!(all_gates(&p), ["TOP"]);
+        assert!(p.unmapped.is_empty());
+        commit(&t, &[("src/new.h", "x\n")]);
+        assert_eq!(all_gates(&plan_of(&t)), ["TOP"]);
+    }
+
     #[test]
     fn a_manifest_edit_selects_its_own_gate() {
         let t = repo();
diff --git a/tools/aien-test/src/runner.rs b/tools/aien-test/src/runner.rs
index 04f57e51..05e32917 100644
--- a/tools/aien-test/src/runner.rs
+++ b/tools/aien-test/src/runner.rs
@@ -341,6 +341,25 @@ fn collect_files(root: &Path, rel: &str, out: &mut BTreeSet<String>) {
     }
 }
 
+/// The files directly inside `dir` (an `inputs_top` entry), no dotfiles; none at all
+/// is recorded as the entry itself with a null digest, like a missing plain input.
+fn collect_top_files(root: &Path, dir: &str, entry: &str, out: &mut BTreeSet<String>) {
+    let mut any = false;
+    if let Ok(rd) = fs::read_dir(root.join(dir)) {
+        for e in rd.flatten() {
+            let rel = format!("{dir}/{}", e.file_name().to_string_lossy());
+            let is_file = fs::symlink_metadata(e.path()).is_ok_and(|m| m.is_file());
+            if is_file && manifest::directly_in(dir, &rel) {
+                out.insert(rel);
+                any = true;
+            }
+        }
+    }
+    if !any {
+        out.insert(entry.to_string());
+    }
+}
+
 /// Where `run.exec` is, for a run without the sandbox (the runner's PATH).
 /// See [`exec_path_for`].
 pub fn exec_path(root: &Path, exec: &str) -> Option<PathBuf> {
@@ -388,7 +407,10 @@ fn exec_path_in(root: &Path, exec: &str, path: Option<std::ffi::OsString>) -> Op
 pub fn build_inputs_digest(root: &Path, manifest_rel: Option<&Path>, m: &Manifest) -> String {
     let mut paths: BTreeSet<String> = BTreeSet::new();
     for i in &m.inputs {
-        collect_files(root, i, &mut paths);
+        match manifest::shallow_dir(i) {
+            Some(dir) => collect_top_files(root, dir, i, &mut paths),
+            None => collect_files(root, i, &mut paths),
+        }
     }
     if let Some(rel) = manifest_rel {
         let dir = rel.parent().unwrap_or(Path::new(""));