Skip to main content

WorkspaceDiagnostic

Struct WorkspaceDiagnostic 

Source
pub struct WorkspaceDiagnostic {
    pub path: PathBuf,
    pub kind: WorkspaceDiagnosticKind,
    pub message: String,
    pub degrades_analysis: bool,
}
Expand description

A diagnostic about a workspace-discovery candidate.

The message field is a human-readable rendering derived from kind. It always ends with a concrete next step (“fix the JSON syntax”, “remove from workspaces”, “add to ignorePatterns”) so first-time users have a path forward.

Fields§

§path: PathBuf

Path to the directory or file that triggered the diagnostic.

§kind: WorkspaceDiagnosticKind

Kind discriminator with the typed payload.

§message: String

Human-readable rendering derived from kind + path. Always ends with a next-step hint.

§degrades_analysis: bool

True when this diagnostic reports a run whose RESULTS are degraded: something the user installed, wrote, or expected did not reach the analysis. Projected from WorkspaceDiagnosticKind::warns_on_stderr, which is the same classification that decides whether the CLI prints a stderr line, so a CI log built from this field and a local non-quiet run say the same thing.

Omitted when false, which is what keeps every clean run byte-identical. The two unconfigured-check kinds answer false on purpose: they fire in the product’s default state on every project that never opted into boundaries or rule packs, so warning on them would warn forever. So does excluded-by-default-ignore, which is designed behavior on generated output; the alarm for that case is no-source-files-analyzed.

Read this instead of hardcoding a kind allowlist: a degrading kind added in a later release then reaches an unchanged consumer.

Implementations§

Source§

impl WorkspaceDiagnostic

Source

pub fn new( root: &Path, path: PathBuf, kind: WorkspaceDiagnosticKind, ) -> WorkspaceDiagnostic

Construct a diagnostic with the message rendered from kind + path.

root is used to produce project-relative paths in the message text AND inside the variant payload (e.g. the error field of MalformedPackageJson / MalformedTsconfig which embed the absolute file path from PackageJson::load()’s error text). Without the payload-side normalisation the embedded path would survive environment-specific differences (CI vs Docker vs local) because the post-serialisation strip_root_prefix only catches whole-string matches, not paths embedded mid-sentence.

If path is not under root (e.g. canonicalisation crossed a symlink), the absolute path is emitted instead.

path also loses any no-op . component, for the same reason the payload loses a glob’s ./ prefix: one directory reached through two spellings of one glob must be one diagnostic.

Source

pub fn into_root_relative(self, root: &Path) -> WorkspaceDiagnostic

Return this diagnostic with path rewritten relative to root.

path is stored absolute so callers can act on it. Every JSON envelope emits it project-relative instead: the analysis envelopes get there through the post-serialisation strip_root_prefix pass, which the fallow workspaces / fallow list --workspaces envelope and the MCP project_info tool never run, so those emitted the absolute path while the sibling workspaces[].path next to it was relative. They normalise at the typed layer with this method instead.

Paths outside root (canonicalisation crossed a symlink) are left absolute, matching how Self::new renders the message.

A diagnostic anchored at the root itself becomes ., not the empty path: an empty string is not a location, and the analysis envelopes’ post-serialisation strip only removes a root + separator prefix, so a root-anchored path that stays absolute here leaks a host path.

Trait Implementations§

Source§

impl Clone for WorkspaceDiagnostic

Source§

fn clone(&self) -> WorkspaceDiagnostic

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkspaceDiagnostic

Source§

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

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

impl<'de> Deserialize<'de> for WorkspaceDiagnostic

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<WorkspaceDiagnostic, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for WorkspaceDiagnostic

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for WorkspaceDiagnostic

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
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<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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