commit ad964512f327f1d2a2011dc1a48d8dc2821b8a0d
parent 752a5981330042a4208e938e74a299163656b9d9
Author: triesap <tyson@radroots.org>
Date: Sat, 3 Oct 2026 21:12:20 +0000
repo: define precise runtime ownership data (HCR-003)
- Classify native, web, interop and governance inputs with explicit shared owners
- Reject malformed maps, unsafe paths, overlaps and uncovered native inputs
- Preserve independent native guards and informational output declarations
- Verify forty tooling tests, native checks, fresh desktop tests and independent review
Diffstat:
5 files changed, 840 insertions(+), 0 deletions(-)
diff --git a/config/repository/runtime-ownership.v1.json b/config/repository/runtime-ownership.v1.json
@@ -0,0 +1,380 @@
+{
+ "schema_version": 1,
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ],
+ "inputs": [
+ {
+ "path": "app",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "core",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "gradle",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "build-logic",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/design_catalog",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "build.gradle.kts",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "settings.gradle.kts",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "gradle.properties",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "gradlew",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "gradlew.bat",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "radroots.lib.source-lock.v1.toml",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "config/design/harvestcircle-v1.toml",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "config/detekt/detekt.yml",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "config/licenses/allowed-licenses.json",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "config/product/harvestcircle-v1.properties",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "config/verification/lanes-v3.properties",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "contracts/release/harvestcircle-artifact-contract.v3.json",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "contracts/rshr-201-step-gates.v1.json",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/rshr_201_step_gate.py",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/run-linux-x86_64-development-check.sh",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/test-build-logic-stability.sh",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/test-build-modes.sh",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/verify-storage-api.sh",
+ "kind": "exact",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/xtask",
+ "kind": "prefix",
+ "owners": [
+ "native",
+ "governance"
+ ]
+ },
+ {
+ "path": "web",
+ "kind": "prefix",
+ "owners": [
+ "web"
+ ]
+ },
+ {
+ "path": "contracts/interop",
+ "kind": "prefix",
+ "owners": [
+ "native",
+ "web",
+ "interop"
+ ]
+ },
+ {
+ "path": "tools/interop",
+ "kind": "prefix",
+ "owners": [
+ "native",
+ "web",
+ "interop"
+ ]
+ },
+ {
+ "path": "Makefile",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "AGENTS.md",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "README.md",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "NOTICE",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "CONTRIBUTING.md",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "SECURITY.md",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "LICENSE",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "LICENSES",
+ "kind": "prefix",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": ".gitignore",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": ".gitattributes",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ },
+ {
+ "path": "config/repository/runtime-ownership.v1.json",
+ "kind": "exact",
+ "owners": [
+ "native",
+ "web",
+ "interop",
+ "governance"
+ ]
+ }
+ ],
+ "outputs": [
+ {
+ "path": "build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "core/target",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/xtask/target",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "app/design_system/build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "app/shared/build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "app/desktop/build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "build-logic/contracts/build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "build-logic/plugins/build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ },
+ {
+ "path": "tools/design_catalog/build",
+ "kind": "prefix",
+ "owners": [
+ "native"
+ ]
+ }
+ ]
+}
diff --git a/tools/xtask/Cargo.lock b/tools/xtask/Cargo.lock
@@ -61,16 +61,91 @@ name = "harvestcircle_xtask"
version = "0.1.0-alpha"
dependencies = [
"libc",
+ "serde",
+ "serde_json",
"sha2",
]
[[package]]
+name = "itoa"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+
+[[package]]
name = "libc"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
+name = "memchr"
+version = "2.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.47"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.151"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
+dependencies = [
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
name = "sha2"
version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -82,13 +157,36 @@ dependencies = [
]
[[package]]
+name = "syn"
+version = "3.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
name = "typenum"
version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
[[package]]
+name = "unicode-ident"
+version = "1.0.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
+
+[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "zmij"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
diff --git a/tools/xtask/Cargo.toml b/tools/xtask/Cargo.toml
@@ -11,6 +11,8 @@ publish = false
[dependencies]
libc = "0.2.189"
sha2 = "0.10.9"
+serde = { version = "=1.0.229", features = ["derive"] }
+serde_json = "=1.0.151"
[lints.rust]
unsafe_code = "forbid"
diff --git a/tools/xtask/src/lib.rs b/tools/xtask/src/lib.rs
@@ -1,3 +1,5 @@
+pub mod runtime_ownership;
+
use sha2::{Digest, Sha256};
use std::collections::BTreeSet;
use std::fs::{self, OpenOptions};
@@ -292,11 +294,24 @@ fn repo_audit(root: &Path, inventory: &Inventory, findings: &mut Vec<String>) {
}
}
}
+ runtime_ownership_audit(root, inventory, findings);
runtime_guidance_audit(root, findings);
git_source_policy(root, findings);
native_runtime_boundary(root, findings);
}
+fn runtime_ownership_audit(root: &Path, inventory: &Inventory, findings: &mut Vec<String>) {
+ let result = bounded_no_follow_bytes(root, Path::new(runtime_ownership::MAP_PATH), 64 * 1024)
+ .and_then(|bytes| {
+ String::from_utf8(bytes).map_err(|error| format!("invalid ownership UTF-8: {error}"))
+ })
+ .and_then(|source| runtime_ownership::OwnershipMap::parse(&source))
+ .and_then(|map| map.validate_native_inputs(&inventory.paths));
+ if let Err(error) = result {
+ findings.push(format!("{}: {error}", runtime_ownership::MAP_PATH));
+ }
+}
+
// These small text contracts guard instruction scope, not runtime ownership or
// product implementation. Keep the existing native/source checks independent.
fn runtime_guidance_audit(root: &Path, findings: &mut Vec<String>) {
diff --git a/tools/xtask/src/runtime_ownership.rs b/tools/xtask/src/runtime_ownership.rs
@@ -0,0 +1,345 @@
+//! Runtime input ownership data. Output declarations never exempt source from audits.
+use serde::Deserialize;
+use std::collections::BTreeSet;
+
+pub const MAP_PATH: &str = "config/repository/runtime-ownership.v1.json";
+
+#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd)]
+#[serde(rename_all = "snake_case")]
+pub enum Owner {
+ Native,
+ Web,
+ Interop,
+ Governance,
+}
+
+#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
+#[serde(rename_all = "snake_case")]
+enum Kind {
+ Exact,
+ Prefix,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(deny_unknown_fields)]
+struct Rule {
+ path: String,
+ kind: Kind,
+ owners: Vec<Owner>,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct OwnershipMap {
+ schema_version: u32,
+ owners: Vec<Owner>,
+ inputs: Vec<Rule>,
+ outputs: Vec<Rule>,
+}
+
+#[derive(Debug, Eq, PartialEq)]
+pub struct Classification {
+ pub owners: Vec<Owner>,
+ pub reason: Option<String>,
+}
+
+fn validate_path(path: &str) -> Result<(), String> {
+ if path.is_empty()
+ || path
+ .chars()
+ .any(|c| c.is_control() || matches!(c, '\\' | ':' | '%' | '*' | '?' | '[' | ']'))
+ || path.split('/').any(|part| matches!(part, "" | "." | ".."))
+ {
+ return Err(format!(
+ "invalid repository-relative ownership path: {path:?}"
+ ));
+ }
+ Ok(())
+}
+
+impl Rule {
+ fn matches(&self, path: &str) -> bool {
+ path == self.path
+ || (self.kind == Kind::Prefix
+ && path
+ .strip_prefix(&self.path)
+ .is_some_and(|rest| rest.starts_with('/')))
+ }
+}
+
+impl OwnershipMap {
+ pub fn parse(source: &str) -> Result<Self, String> {
+ // No escaped path aliases, including unicode-escaped separators or field names.
+ if source.contains('\\') {
+ return Err("ownership JSON escapes are not allowed".to_owned());
+ }
+ let map: Self = serde_json::from_str(source)
+ .map_err(|error| format!("invalid ownership JSON: {error}"))?;
+ if map.schema_version != 1 {
+ return Err("unsupported ownership schema version".to_owned());
+ }
+ if map.owners.len() != 4 || map.owners.iter().copied().collect::<BTreeSet<_>>().len() != 4 {
+ return Err(
+ "ownership map must declare each of the four owners exactly once".to_owned(),
+ );
+ }
+ for rules in [&map.inputs, &map.outputs] {
+ if rules.is_empty() {
+ return Err("ownership rule list is empty".to_owned());
+ }
+ for (index, rule) in rules.iter().enumerate() {
+ validate_path(&rule.path)?;
+ if rule.owners.is_empty()
+ || rule.owners.iter().copied().collect::<BTreeSet<_>>().len()
+ != rule.owners.len()
+ {
+ return Err(format!("empty or duplicate owners for {}", rule.path));
+ }
+ for previous in &rules[..index] {
+ if previous.matches(&rule.path) || rule.matches(&previous.path) {
+ return Err(format!(
+ "overlapping ownership declarations: {} and {}",
+ previous.path, rule.path
+ ));
+ }
+ }
+ }
+ }
+ Ok(map)
+ }
+
+ pub fn classify(&self, path: &str) -> Result<Classification, String> {
+ validate_path(path)?;
+ match self.inputs.iter().find(|rule| rule.matches(path)) {
+ Some(rule) => Ok(Classification {
+ owners: rule.owners.clone(),
+ reason: None,
+ }),
+ None => Ok(Classification {
+ owners: self.owners.clone(),
+ reason: Some(format!(
+ "unclassified input {path}: conservatively select all potential owners"
+ )),
+ }),
+ }
+ }
+
+ pub fn validate_native_inputs(&self, paths: &[String]) -> Result<(), String> {
+ for required in required_native_inputs() {
+ if !paths.iter().any(|path| path == required) {
+ return Err(format!("required native input is missing: {required}"));
+ }
+ }
+ for path in paths {
+ if required_native_inputs().contains(&path.as_str())
+ || [
+ "app/",
+ "core/",
+ "gradle/",
+ "build-logic/",
+ "tools/design_catalog/",
+ "tools/xtask/",
+ ]
+ .iter()
+ .any(|prefix| path.starts_with(prefix))
+ {
+ let classification = self.classify(path)?;
+ if classification.reason.is_some()
+ || !classification.owners.contains(&Owner::Native)
+ {
+ return Err(format!("native input has no explicit native owner: {path}"));
+ }
+ }
+ }
+ Ok(())
+ }
+}
+
+fn required_native_inputs() -> Vec<&'static str> {
+ vec![
+ "build.gradle.kts",
+ "settings.gradle.kts",
+ "gradle.properties",
+ "gradlew",
+ "gradlew.bat",
+ "radroots.lib.source-lock.v1.toml",
+ "config/design/harvestcircle-v1.toml",
+ "config/detekt/detekt.yml",
+ "config/licenses/allowed-licenses.json",
+ "config/product/harvestcircle-v1.properties",
+ "config/verification/lanes-v3.properties",
+ "contracts/release/harvestcircle-artifact-contract.v3.json",
+ "contracts/rshr-201-step-gates.v1.json",
+ "tools/rshr_201_step_gate.py",
+ "tools/run-linux-x86_64-development-check.sh",
+ "tools/test-build-logic-stability.sh",
+ "tools/test-build-modes.sh",
+ "tools/verify-storage-api.sh",
+ "core/Cargo.toml",
+ "core/Cargo.lock",
+ "core/rust-toolchain.toml",
+ "core/deny.toml",
+ "core/provenance/harvestcircle-v1.toml",
+ "tools/xtask/Cargo.toml",
+ "tools/xtask/Cargo.lock",
+ "gradle/libs.versions.toml",
+ "gradle/verification-metadata.xml",
+ "gradle/wrapper/gradle-wrapper.jar",
+ "gradle/wrapper/gradle-wrapper.properties",
+ "build-logic/settings.gradle.kts",
+ "build-logic/contracts/build.gradle.kts",
+ "build-logic/plugins/build.gradle.kts",
+ "app/design_system/build.gradle.kts",
+ "app/shared/build.gradle.kts",
+ "app/desktop/build.gradle.kts",
+ "tools/design_catalog/build.gradle.kts",
+ "Makefile",
+ ]
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ const MAP: &str = include_str!("../../../config/repository/runtime-ownership.v1.json");
+
+ #[test]
+ fn rejects_malformed_unknown_and_duplicate_json() {
+ for source in [
+ "{",
+ &MAP.replace("\"schema_version\": 1", "\"schema_version\": 2"),
+ &MAP.replace(
+ "\"schema_version\": 1",
+ "\"schema_version\": 1, \"extra\": true",
+ ),
+ &MAP.replace(
+ "\"schema_version\": 1",
+ "\"schema_version\": 1, \"schema_version\": 1",
+ ),
+ &MAP.replace("\"native\"", "\"invented\""),
+ ] {
+ assert!(OwnershipMap::parse(source).is_err(), "accepted {source}");
+ }
+ }
+
+ #[test]
+ fn rejects_traversal_absolutes_backslashes_and_escapes() {
+ for path in [
+ "../app",
+ "/app",
+ "app/../core",
+ "app/./src",
+ "app//src",
+ "app/",
+ "C:/app",
+ "app\\src",
+ "app/*",
+ "app/%2e%2e",
+ "app\\u002fcore",
+ ] {
+ let source = MAP.replacen("\"app\"", &format!("\"{path}\""), 1);
+ assert!(OwnershipMap::parse(&source).is_err(), "accepted {path}");
+ }
+ }
+
+ #[test]
+ fn rejects_ambiguous_declarations_and_accepts_explicit_shared_owners() {
+ let map = OwnershipMap::parse(MAP).unwrap();
+ let shared = map.classify("tools/xtask/Cargo.lock").unwrap();
+ assert!(shared.owners.contains(&Owner::Native));
+ assert!(shared.owners.contains(&Owner::Governance));
+ let rule = r#"{"path":"app/src", "kind":"prefix", "owners":["web"]}"#;
+ let source = MAP.replacen("\"inputs\": [", &format!("\"inputs\": [{rule},"), 1);
+ assert!(OwnershipMap::parse(&source).is_err());
+ assert!(
+ OwnershipMap::parse(&MAP.replacen(
+ "\"owners\": [\n \"native\"",
+ "\"owners\": [\n \"native\", \"native\"",
+ 1
+ ))
+ .is_err()
+ );
+ }
+
+ #[test]
+ fn prefix_boundaries_and_unknown_inputs_widen_with_reason() {
+ let map = OwnershipMap::parse(MAP).unwrap();
+ assert_eq!(
+ map.classify("app/src/test.kt").unwrap().owners,
+ vec![Owner::Native]
+ );
+ for path in [
+ "application/src/test.kt",
+ "config/new.json",
+ "tools/new.rs",
+ "contracts/new.json",
+ "new_runtime/main.rs",
+ ] {
+ let result = map.classify(path).unwrap();
+ assert_eq!(result.owners.len(), 4);
+ assert!(result.reason.unwrap().contains(path));
+ }
+ assert!(map.classify("../app").is_err());
+ assert!(
+ map.classify("web/src/main.ts")
+ .unwrap()
+ .owners
+ .contains(&Owner::Web)
+ );
+ assert!(
+ map.classify("contracts/interop/food.json")
+ .unwrap()
+ .owners
+ .contains(&Owner::Interop)
+ );
+ }
+
+ #[test]
+ fn current_repository_native_inputs_are_explicitly_covered() {
+ let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
+ let inventory = crate::Inventory::load(&root).unwrap();
+ let mut findings = Vec::new();
+ crate::runtime_ownership_audit(&root, &inventory, &mut findings);
+ assert!(findings.is_empty(), "{findings:?}");
+ }
+
+ #[test]
+ fn outputs_do_not_exempt_tracked_inputs_and_exact_paths_do_not_expand() {
+ let map = OwnershipMap::parse(MAP).unwrap();
+ let output = map.classify("core/target/tracked-malicious.rs").unwrap();
+ assert_eq!(output.owners, vec![Owner::Native]);
+ assert!(map.classify("gradlew-extra").unwrap().reason.is_some());
+ assert!(
+ map.classify("config/design/harvestcircle-v1.toml/child")
+ .unwrap()
+ .reason
+ .is_some()
+ );
+ }
+
+ #[test]
+ fn rejects_uncovered_and_missing_native_inputs() {
+ let map = OwnershipMap::parse(MAP).unwrap();
+ let paths = required_native_inputs()
+ .into_iter()
+ .map(str::to_owned)
+ .collect::<Vec<_>>();
+ assert!(map.validate_native_inputs(&paths).is_ok());
+ for missing in [
+ "core/Cargo.lock",
+ "tools/xtask/Cargo.lock",
+ "core/rust-toolchain.toml",
+ ] {
+ let partial = paths
+ .iter()
+ .filter(|path| path.as_str() != missing)
+ .cloned()
+ .collect::<Vec<_>>();
+ assert!(
+ map.validate_native_inputs(&partial).is_err(),
+ "accepted missing {missing}"
+ );
+ }
+ let wrong = OwnershipMap::parse(&MAP.replace("\"core\",", "\"elsewhere\",")).unwrap();
+ assert!(wrong.validate_native_inputs(&paths).is_err());
+ }
+}