mirror of
https://github.com/openai/codex.git
synced 2026-06-01 19:02:59 +00:00
Simplify hook trust metadata surface
This commit is contained in:
@@ -1559,21 +1559,6 @@ pub enum HookSource {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl HookSource {
|
||||
/// Returns whether hooks from this source are managed and therefore not
|
||||
/// user-configurable.
|
||||
pub fn is_managed(self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::System
|
||||
| Self::Mdm
|
||||
| Self::CloudRequirements
|
||||
| Self::LegacyManagedConfigFile
|
||||
| Self::LegacyManagedConfigMdm
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum HookTrustStatus {
|
||||
@@ -3965,20 +3950,6 @@ mod tests {
|
||||
use tempfile::NamedTempFile;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
fn hook_source_managedness_is_source_derived() {
|
||||
assert_eq!(HookSource::System.is_managed(), true);
|
||||
assert_eq!(HookSource::Mdm.is_managed(), true);
|
||||
assert_eq!(HookSource::CloudRequirements.is_managed(), true);
|
||||
assert_eq!(HookSource::LegacyManagedConfigFile.is_managed(), true);
|
||||
assert_eq!(HookSource::LegacyManagedConfigMdm.is_managed(), true);
|
||||
assert_eq!(HookSource::User.is_managed(), false);
|
||||
assert_eq!(HookSource::Project.is_managed(), false);
|
||||
assert_eq!(HookSource::SessionFlags.is_managed(), false);
|
||||
assert_eq!(HookSource::Plugin.is_managed(), false);
|
||||
assert_eq!(HookSource::Unknown.is_managed(), false);
|
||||
}
|
||||
|
||||
fn sorted_writable_roots(roots: Vec<WritableRoot>) -> Vec<(PathBuf, Vec<PathBuf>)> {
|
||||
let mut sorted_roots: Vec<(PathBuf, Vec<PathBuf>)> = roots
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user