pub struct ProjectScope { /* private fields */ }Expand description
Host-resolved project identity: the canonical workspace root, digested into a stable scope key. The HOST constructs this from trusted execution context — it is never accepted solely from model-authored arguments.
Implementations§
Source§impl ProjectScope
impl ProjectScope
Sourcepub fn discover_repository(
start: &Path,
) -> Result<RepositoryIdentity, MemoryError>
pub fn discover_repository( start: &Path, ) -> Result<RepositoryIdentity, MemoryError>
Opt-in repository discovery. The explicit SYNAPS_PROJECT_ROOT override
wins and disables Git sharing; malformed Git/private state is an error,
never a fallback to an unrelated or newly generated scope.
Sourcepub fn discover_repository_with_override(
start: &Path,
override_root: Option<&Path>,
) -> Result<RepositoryIdentity, MemoryError>
pub fn discover_repository_with_override( start: &Path, override_root: Option<&Path>, ) -> Result<RepositoryIdentity, MemoryError>
Environment-free counterpart; Some(root) preserves the legacy override
semantics even if root is a subdirectory/worktree of a Git repository.
Source§impl ProjectScope
impl ProjectScope
Sourcepub fn for_root(root: &Path) -> Result<Self, MemoryError>
pub fn for_root(root: &Path) -> Result<Self, MemoryError>
Resolve a scope from a workspace root. The path is canonicalized so every spelling of the same directory yields one project identity.
Sourcepub fn user_scope(root: &Path) -> Result<Self, MemoryError>
pub fn user_scope(root: &Path) -> Result<Self, MemoryError>
Construct an explicit user-wide scope at a canonical host base path. This is the ONLY constructor accepting the reserved all-zero key. Never derive this scope from model-authored project arguments.
Sourcepub fn from_key(root: &Path, key: &str) -> Result<Self, MemoryError>
pub fn from_key(root: &Path, key: &str) -> Result<Self, MemoryError>
Restore a host-verified key (e.g. an operator migration manifest).
Syntax validation is NOT authorization: callers must establish the key’s
trusted provenance, never accept a model-supplied key as a scope grant.
Accepts exactly p[0-9a-f]{16}, excluding the user-wide reserved key.
Sourcepub fn discover(start: &Path) -> Result<Self, MemoryError>
pub fn discover(start: &Path) -> Result<Self, MemoryError>
Discover the stable project root for a starting directory (CP-13
fix1 I2): the SYNAPS_PROJECT_ROOT env override wins; otherwise a
bounded upward walk finds the nearest directory containing a .git
entry (DIRECTORY or FILE — worktree-safe, no process spawning, no
gitdir parsing) or a .synaps-project marker; with no marker the
start directory itself is the root.
Sourcepub fn discover_with_override(
start: &Path,
override_root: Option<&Path>,
) -> Result<Self, MemoryError>
pub fn discover_with_override( start: &Path, override_root: Option<&Path>, ) -> Result<Self, MemoryError>
Self::discover with an explicit override (env-free seam).
Trait Implementations§
Source§impl Clone for ProjectScope
impl Clone for ProjectScope
Source§impl Debug for ProjectScope
impl Debug for ProjectScope
impl Eq for ProjectScope
Source§impl PartialEq for ProjectScope
impl PartialEq for ProjectScope
impl StructuralPartialEq for ProjectScope
Auto Trait Implementations§
impl Freeze for ProjectScope
impl RefUnwindSafe for ProjectScope
impl Send for ProjectScope
impl Sync for ProjectScope
impl Unpin for ProjectScope
impl UnsafeUnpin for ProjectScope
impl UnwindSafe for ProjectScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.