- 5615
assert!(autonomy_rank("banana") < autonomy_rank("autonomous")); - 5616
} - 5617
- 5618
#[test] - 5619
fn plugin_resolved_allow_deny_network_matrix() { - 5620
let mut resolved = PluginResolved::default(); - 5621
assert!(resolved.is_enabled("test-plugin")); - 5622
assert!(!resolved.is_network_allowed("test-plugin")); - 5623
- 5624
// Enable network - 5625
resolved.network_allow = Some(vec!["test-plugin".into()]); - 5626
assert!(resolved.is_network_allowed("test-plugin")); - 5627
- 5628
// Global or channel deny takes priority - 5629
resolved.network_deny.push("test-plugin".into()); - 5630
assert!(!resolved.is_network_allowed("test-plugin")); - 5631
assert!(resolved.is_enabled("test-plugin")); - 5632
- 5633
// Disabling or denying plugin shuts it off completely - 5634
resolved.disabled.push("test-plugin".into()); - 5635
assert!(!resolved.is_enabled("test-plugin")); - 5636
assert!(!resolved.is_network_allowed("test-plugin")); - 5637
} - 5638
- 5639
#[test] - 5640
fn channel_policy_merges_plugin_network_and_allow_deny() { - 5641
let bot = ChannelPolicy { - 5642
plugins_allow: Some(vec!["test-plugin-a".into(), "test-plugin-b".into()]), - 5643
plugins_deny: vec!["untrusted-plugin".into()], - 5644
plugins_network_deny: vec!["test-plugin-b".into()], - 5645
..ChannelPolicy::default() - 5646
}; - 5647
let chat = ChannelPolicy { - 5648
plugins_allow: Some(vec!["test-plugin-a".into()]), - 5649
plugins_deny: vec!["banned-plugin".into()], - 5650
plugins_network_deny: vec!["test-plugin-a".into()], - 5651
..ChannelPolicy::default() - 5652
}; - 5653
let merged = ChannelPolicy::merge(&bot, &chat); - 5654
assert_eq!(merged.plugins_allow, Some(vec!["test-plugin-a".into()])); - 5655
assert!( - 5656
merged - 5657
.plugins_deny - 5658
.contains(&"untrusted-plugin".to_string()) - 5659
); - 5660
assert!(merged.plugins_deny.contains(&"banned-plugin".to_string())); - 5661
assert!( - 5662
merged - 5663
.plugins_network_deny - 5664
.contains(&"test-plugin-b".to_string()) - 5665
); - 5666
assert!( - 5667
merged - 5668
.plugins_network_deny - 5669
.contains(&"test-plugin-a".to_string()) - 5670
); - 5671
} - 5672
- 5673
/// The persisted TOML field was renamed from `subagents` to `workers`. - 5674
/// An existing `vak.toml` with the old key (and no `workers` key) must - 5675
/// still be honored rather than silently falling back to the default. - 5676
#[test] - 5677
fn legacy_subagents_key_is_honored_as_workers() { - 5678
let dir = tempfile::tempdir().unwrap(); - 5679
let path = project_path(dir.path()); - 5680
std::fs::create_dir_all(path.parent().unwrap()).unwrap(); - 5681
std::fs::write(&path, "subagents = false\n").unwrap(); - 5682
- 5683
let (fc, warnings) = parse_file(&path).unwrap(); - 5684
assert_eq!(fc.workers, Some(false)); - 5685
assert!( - 5686
warnings.is_empty(), - 5687
"legacy `subagents` key should not warn as unknown: {warnings:?}" - 5688
); - 5689
- 5690
let cfg = load_with_trust(dir.path(), true).unwrap(); - 5691
assert!(!cfg.workers); - 5692
} - 5693
} - 5694
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.