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[], andunused_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
impl ReachabilityCaveat
Sourcepub const fn message(self) -> &'static str
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.
Sourcepub const fn short_label(self) -> &'static str
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
impl Clone for ReachabilityCaveat
impl Copy for ReachabilityCaveat
Source§impl Debug for ReachabilityCaveat
impl Debug for ReachabilityCaveat
Source§impl<'de> Deserialize<'de> for ReachabilityCaveat
impl<'de> Deserialize<'de> for ReachabilityCaveat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ReachabilityCaveat
Source§impl Ord for ReachabilityCaveat
impl Ord for ReachabilityCaveat
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ReachabilityCaveat
impl PartialEq for ReachabilityCaveat
Source§impl PartialOrd for ReachabilityCaveat
impl PartialOrd for ReachabilityCaveat
Source§impl Serialize for ReachabilityCaveat
impl Serialize for ReachabilityCaveat
impl StructuralPartialEq for ReachabilityCaveat
Auto Trait Implementations§
impl Freeze for ReachabilityCaveat
impl RefUnwindSafe for ReachabilityCaveat
impl Send for ReachabilityCaveat
impl Sync for ReachabilityCaveat
impl Unpin for ReachabilityCaveat
impl UnsafeUnpin for ReachabilityCaveat
impl UnwindSafe for ReachabilityCaveat
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.