pub fn validate_namespace(ns: &str) -> Result<()>Expand description
Validate a namespace (flat or hierarchical, Task 1.4).
Flat namespaces ("global", "ai-memory") remain fully valid — hierarchy
is opt-in. Hierarchical paths use / as the segment delimiter:
alphaone/engineering/platformRules:
- Not empty, no leading/trailing whitespace
- Length ≤ [
MAX_NAMESPACE_LEN] (512 chars) - Depth (segment count) ≤
MAX_NAMESPACE_DEPTH(8) - Backslashes, null bytes, control chars, and spaces are forbidden
- Leading and trailing
/are forbidden (normalize input vianormalize_namespacebefore validating) - Empty segments (consecutive
//) are forbidden - Each segment is non-empty; no further character restriction beyond
the whole-string checks above (preserving historical flexibility
for existing flat namespaces like
ai-memory-mcp-dev)