mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
ci: extend Windows secrets ACL timeout (#2654)
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
co-authored by
Steven Enamakel
parent
b1b919a92a
commit
5bd47bbcf1
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! A `Vault` points at a local directory; on `vault.sync` we walk it, route
|
||||
//! files to extractors by extension, and feed them into the memory pipeline
|
||||
//! under namespace `vault:<id>`. Per-file dedup uses (path, mtime, content
|
||||
//! under a vault-derived namespace. Per-file dedup uses (path, mtime, content
|
||||
//! hash) so re-syncs only touch what changed.
|
||||
|
||||
pub mod ops;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use chrono::Utc;
|
||||
use futures::FutureExt;
|
||||
use sha2::{Digest, Sha256};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::openhuman::config::Config;
|
||||
@@ -15,6 +16,21 @@ use super::store;
|
||||
use super::sync;
|
||||
use super::types::{Vault, VaultFile, VaultSyncState, VaultSyncStatus};
|
||||
|
||||
/// Derive a stable memory namespace for a vault without embedding the raw UUID.
|
||||
///
|
||||
/// Memory writes reject namespace/key values that resemble PII. Raw UUID hex can
|
||||
/// occasionally match strict alphanumeric identifier patterns, so vault
|
||||
/// namespaces use an alphabet-only digest suffix instead.
|
||||
pub(crate) fn vault_namespace_for_id(id: &str) -> String {
|
||||
let digest = Sha256::digest(id.as_bytes());
|
||||
let suffix: String = digest
|
||||
.iter()
|
||||
.take(24)
|
||||
.map(|byte| char::from(b'a' + (byte % 26)))
|
||||
.collect();
|
||||
format!("vault-{suffix}")
|
||||
}
|
||||
|
||||
/// Create a new vault pointing at a local folder.
|
||||
pub async fn vault_create(
|
||||
config: &Config,
|
||||
@@ -46,7 +62,7 @@ pub async fn vault_create(
|
||||
include_globs.len(),
|
||||
exclude_globs.len(),
|
||||
);
|
||||
let namespace = format!("vault:{id}");
|
||||
let namespace = vault_namespace_for_id(&id);
|
||||
let vault = Vault {
|
||||
id: id.clone(),
|
||||
name: trimmed_name.to_string(),
|
||||
|
||||
@@ -344,6 +344,42 @@ async fn vault_create_returns_current_host_os() {
|
||||
assert_eq!(outcome.value.host_os.as_deref(), Some(std::env::consts::OS));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn vault_create_uses_pii_safe_memory_namespace() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let config = make_config(&tmp);
|
||||
|
||||
let outcome = ops::vault_create(
|
||||
&config,
|
||||
"Test",
|
||||
tmp.path().to_str().unwrap(),
|
||||
vec![],
|
||||
vec![],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let namespace = &outcome.value.namespace;
|
||||
assert!(namespace.starts_with("vault-"));
|
||||
assert!(!namespace.contains(&outcome.value.id));
|
||||
assert!(!crate::openhuman::memory_store::safety::has_likely_secret(
|
||||
namespace
|
||||
));
|
||||
assert!(!crate::openhuman::memory_store::safety::pii::has_likely_pii(namespace));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vault_namespace_derivation_does_not_embed_pii_like_ids() {
|
||||
let namespace = ops::vault_namespace_for_id("VECJ880326XK4");
|
||||
|
||||
assert!(namespace.starts_with("vault-"));
|
||||
assert!(!namespace.contains("VECJ880326XK4"));
|
||||
assert!(!crate::openhuman::memory_store::safety::has_likely_secret(
|
||||
&namespace
|
||||
));
|
||||
assert!(!crate::openhuman::memory_store::safety::pii::has_likely_pii(&namespace));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn vault_sync_status_returns_idle_for_unknown_vault() {
|
||||
let outcome = ops::vault_sync_status("__ops_status_unknown__")
|
||||
|
||||
+12
-2
@@ -99,7 +99,12 @@ async fn vault_sync_roundtrip_updates_memory_and_ledger() {
|
||||
.await
|
||||
.expect("vault_sync first");
|
||||
let first = wait_for_sync(&vault.id).await;
|
||||
assert_eq!(first.status, VaultSyncStatus::Completed);
|
||||
assert_eq!(
|
||||
first.status,
|
||||
VaultSyncStatus::Completed,
|
||||
"first sync failed with errors: {:?}",
|
||||
first.errors
|
||||
);
|
||||
assert_eq!(first.ingested, 2);
|
||||
assert_eq!(first.removed, 0);
|
||||
assert_eq!(first.failed, 0);
|
||||
@@ -168,7 +173,12 @@ async fn vault_sync_roundtrip_updates_memory_and_ledger() {
|
||||
.await
|
||||
.expect("vault_sync second");
|
||||
let second = wait_for_sync(&vault.id).await;
|
||||
assert_eq!(second.status, VaultSyncStatus::Completed);
|
||||
assert_eq!(
|
||||
second.status,
|
||||
VaultSyncStatus::Completed,
|
||||
"second sync failed with errors: {:?}",
|
||||
second.errors
|
||||
);
|
||||
assert_eq!(second.ingested, 2);
|
||||
assert_eq!(second.removed, 1);
|
||||
assert_eq!(second.failed, 0);
|
||||
|
||||
Reference in New Issue
Block a user