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: PathBufPath to the directory or file that triggered the diagnostic.
kind: WorkspaceDiagnosticKindKind discriminator with the typed payload.
message: StringHuman-readable rendering derived from kind + path. Always ends
with a next-step hint.
degrades_analysis: boolTrue 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
impl WorkspaceDiagnostic
Sourcepub fn new(
root: &Path,
path: PathBuf,
kind: WorkspaceDiagnosticKind,
) -> WorkspaceDiagnostic
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.
Sourcepub fn into_root_relative(self, root: &Path) -> WorkspaceDiagnostic
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
impl Clone for WorkspaceDiagnostic
Source§fn clone(&self) -> WorkspaceDiagnostic
fn clone(&self) -> WorkspaceDiagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkspaceDiagnostic
impl Debug for WorkspaceDiagnostic
Source§impl<'de> Deserialize<'de> for WorkspaceDiagnostic
impl<'de> Deserialize<'de> for WorkspaceDiagnostic
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<WorkspaceDiagnostic, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<WorkspaceDiagnostic, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for WorkspaceDiagnostic
impl JsonSchema for WorkspaceDiagnostic
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more