Skip to main content

TreeError

Enum TreeError 

Source
#[non_exhaustive]
pub enum TreeError { ManifestNotFound(PathBuf), ManifestRead(String), ManifestParse { path: PathBuf, detail: String, }, Git(GitError), CycleDetected { chain: Vec<String>, }, PackNameMismatch { got: String, expected: String, path: PathBuf, }, ChildPathInvalid { child_name: String, path: String, reason: String, }, LegacyLockfileDetected { path: PathBuf, }, UntrackedGitRepos { paths: Vec<PathBuf>, }, DirtyTreeRefusal { path: PathBuf, kind: DirtyTreeRefusalKind, }, ManifestPathEscape { path: String, reason: String, }, }
Expand description

Errors raised during a pack-tree walk.

Marked #[non_exhaustive] so later slices (credentials, submodules, partial walks) can add variants without breaking consumers.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ManifestNotFound(PathBuf)

The walker expected a pack.yaml at the given location but could not find one (or its enclosing .grex/ directory was missing).

§

ManifestRead(String)

The manifest file existed but could not be read from disk.

§

ManifestParse

The manifest file was read but did not parse as a valid pack.yaml.

Fields

§path: PathBuf

On-disk location of the manifest that failed to parse.

§detail: String

Backend-provided failure detail.

§

Git(GitError)

A git operation (clone, fetch, checkout, …) failed while hydrating a child pack. The underlying GitError is preserved in full.

§

CycleDetected

A cycle was detected during the walk. chain lists the pack URLs (or paths for the root) from the outermost pack down to the recurrence.

Fields

§chain: Vec<String>

Ordered chain of pack identities that forms the cycle.

§

PackNameMismatch

A cloned child’s pack.yaml declared a name that does not match what the parent pack expected for that children: entry.

Fields

§got: String

Name declared in the child’s own manifest.

§expected: String

Name the parent expected (derived from the child entry’s effective path).

§path: PathBuf

On-disk location of the offending child.

§

ChildPathInvalid

A children[].path (or URL-derived tail) violated the bare-name rule. Surfaced by the walker BEFORE any clone of the offending child fires so a malicious path: ../escape in a parent pack cannot materialise a directory outside the pack root. This is a security boundary, not a soft validation concern — see crates/grex-core/src/pack/validate/child_path.rs for the shared rejection logic.

Fields

§child_name: String

Label of the offending child (the explicit path: value, or the URL-derived tail when path: is omitted).

§path: String

The rejected literal value.

§reason: String

One-line explanation of which sub-rule failed.

§

LegacyLockfileDetected

A v1.1.1-shape lockfile was encountered without the --migrate-lockfile opt-in. v1.2.0 changed the on-disk lockfile schema; the operator must explicitly run the migrator to convert pre-existing lockfiles. Emitted by Stage 1.h walker entry-point before any pack-tree work begins. Dormant until 1.h wires the detector.

Fields

§path: PathBuf

On-disk location of the legacy lockfile.

§

UntrackedGitRepos

One or more declared children own a .git/ directory but lack a .grex/pack.yaml, and the v1.2.0 nested-children semantics preclude the v1.1.1 “synthesize plain-git pack” fallback (e.g. because a sibling explicitly opted out, or the parent manifest disabled synthesis). Aggregated by Stage 1.e Phase 1; the walker reports every offender in one go so the operator can fix the manifest with a single pass.

Fields

§paths: Vec<PathBuf>

Paths (relative to the parent pack root) of every offender.

§

DirtyTreeRefusal

Stage 1.f Phase 2 prune refused to remove a destination because the recursive consent walk returned a non-Clean verdict. kind discriminates the specific safety violation so the CLI can suggest the correct override flag.

Fields

§path: PathBuf

Pack-tree-relative path of the destination the walker refused to prune.

§kind: DirtyTreeRefusalKind

Specific consent violation that triggered the refusal.

§

ManifestPathEscape

Stage 1.c validator rejected a child manifest segment that resolved outside the parent pack root. Distinct from TreeError::ChildPathInvalid — that variant rejects the literal path: syntax (slashes, dots, absolute paths); ManifestPathEscape is the post-resolution boundary check that catches symlink-driven and platform-specific escapes.

Fields

§path: String

The literal manifest path that resolved out of bounds.

§reason: String

One-line explanation of which rule the resolved path violated.

Trait Implementations§

Source§

impl Debug for TreeError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TreeError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for TreeError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<GitError> for TreeError

Source§

fn from(source: GitError) -> Self

Converts to this type from the input type.
Source§

impl From<TreeError> for SyncError

Source§

fn from(source: TreeError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more