Skip to main content

ReachabilityCaveat

Enum ReachabilityCaveat 

Source
pub enum ReachabilityCaveat {
    IncompleteFileAnalysis,
    IncompleteImportGraph,
}
Expand description

A per-finding caveat on a dead-code verdict that a file this run never fully analyzed can distort.

Advisory provenance, in the same spirit as the fix path’s low_confidence_off_graph / low_confidence_unresolved_imports skip reasons: a caveat NEVER withholds, reorders, downgrades, or re-severities the finding, and never changes an exit code. It records that the verdict was computed over an import graph fallow already knows is incomplete, so a reader who sees the finding also sees the caveat instead of having to notice a diagnostic at the other end of the envelope.

Deliberately NOT named confidence: health --targets already emits a confidence key holding an enum string, and a shared consumer helper that met both would see the same key change type. Emitted on every finding type that registers it: the reachability arrays (unused_files[], unused_exports[], unused_types[]), the member arrays (unused_enum_members[], unused_class_members[], unused_store_members[]), and the three dependency arrays. Sorted and deduplicated, absent from the wire when empty. The set is open in the same sense workspace_diagnostics[].kind is: treat an unrecognised value as “some caveat” rather than as an error.

Variants§

§

IncompleteFileAnalysis

This finding’s own file is one the run did not fully analyze, so the export and import lists extracted from it may stop short of the real ones. That reaches an unused-file verdict directly, because the “is any export of this file referenced from a reachable module” test reads exactly that truncated export list.

Two workspace diagnostics put a file in this state: it was read but did not parse cleanly (source-parse-degraded), or it could not be read at all (source-read-failure). The token names the consequence rather than either cause, so a future kind that leaves a discovered file partially extracted carries the same value.

Dependency findings never carry this value: the file they name is a package.json, not a parsed source module.

§

IncompleteImportGraph

A module whose import list feeds this verdict was not analyzed, so the import that would have credited this finding may never have been seen.

The cause is any workspace diagnostic that leaves a source file’s imports unseen: a degraded parse (source-parse-degraded), a file that could not be read (source-read-failure), or a file discovery skipped before reading it (skipped-large-file, skipped-minified-file, skipped-source-dotdir). The token names the class rather than any one cause.

Which modules feed the verdict differs by array, and the caveat is emitted only when a degraded module is actually one of them:

  • unused_files[], unused_exports[], and unused_types[] rest on reachability, so only a degraded module that is itself observed reachable can change the verdict. When every degraded module is unreachable the caveat is absent, and soundly: the FIRST missing edge on any entry-point path leaves from a module whose every predecessor edge was observed, so that module is observed reachable. A file the run never read has no module and no graph node, so its reachability is not observable at all and that narrowing cannot be applied: any skipped or unreadable source caveats every reachability verdict in the run.
  • the member arrays (unused_enum_members[], unused_class_members[], unused_store_members[]) do not rest on reachability at all: member usage is collected by walking every module the run resolved, reachable or not, so this narrowing does not apply to them either. Same unnarrowed condition as the dependency arrays below, plus the per-finding value above when the member’s own file is the one that was incompletely analyzed.
  • the dependency arrays rest on whether ANY module in the project imports the package specifier, reachable or not, so any degraded parse anywhere can hide the import that would have credited the package. Reachability does not narrow that one.

The limit, stated because an approximation presented as exact is worse than nothing: this is a RUN-level condition, not proof that a degraded module imports this path or package. An import the parser never saw cannot be attributed to a target, so the link cannot be narrowed further without re-reading the source. Read workspace_diagnostics[] for which files degraded.

Implementations§

Source§

impl ReachabilityCaveat

Source

pub const fn token(self) -> &'static str

The wire token.

Source

pub const fn message(self) -> &'static str

A one-line explanation for human and agent-facing renderers.

Neither sentence names a single cause. A degraded parse is only one of the ways a file goes unread: it may also have been unreadable, or skipped before it was ever opened (oversized, minified, in a dotdir). Naming the parse case alone sent a reader whose run was degraded by the size guard hunting for parse errors that do not exist, so both messages point at workspace_diagnostics[], which names the actual files.

Source

pub const fn short_label(self) -> &'static str

A compact label for a one-line human renderer, where the full Self::message would not fit next to the finding.

Trait Implementations§

Source§

impl Clone for ReachabilityCaveat

Source§

fn clone(&self) -> Self

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 Copy for ReachabilityCaveat

Source§

impl Debug for ReachabilityCaveat

Source§

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

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

impl<'de> Deserialize<'de> for ReachabilityCaveat

Source§

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

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

impl Eq for ReachabilityCaveat

Source§

impl Ord for ReachabilityCaveat

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for ReachabilityCaveat

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for ReachabilityCaveat

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for ReachabilityCaveat

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ReachabilityCaveat

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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, 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.