pub struct ClassificationResult {
pub category: String,
pub subcategory: Option<String>,
pub top_level: Option<TopLevelCategory>,
pub confidence: f64,
pub method: ClassificationMethod,
pub ticket_id: Option<String>,
pub complexity: Option<u8>,
}Expand description
Output of any tier: a category verdict plus provenance.
Why: every classifier tier needs to return the same shape so the cascade
orchestrator can compare tiers’ verdicts and decide which to accept.
What: bundles the verdict (category, subcategory, top_level),
confidence, source tier (method), extracted ticket id, and an
optional LLM-only complexity score.
Test: covered by unclassified_defaults_complexity_to_none and every
classifier test that asserts the verdict shape.
The hierarchy is:
top_level— one of the canonicalTopLevelCategoryvariants (resolved fromcategoryvia thecrate::classify::taxonomy::TaxonomyRegistry).category— the subcategory name (e.g."feature","security"). Kept as a free-form string for backward compatibility with the DB schema.subcategory— an even-more-specific leaf label (e.g."sql-injection").
Fields§
§category: StringSubcategory name (e.g. "feature", "bugfix", "security").
Despite the field name, this is the subcategory in the two-level
taxonomy — the registered TopLevelCategory parent is reported in
top_level. The field name is preserved for DB-schema compatibility.
subcategory: Option<String>Optional leaf label (e.g. "sql-injection", "cleanup").
top_level: Option<TopLevelCategory>Resolved top-level category (None if category is unregistered).
confidence: f64Confidence in this verdict (0.0–1.0).
method: ClassificationMethodWhich tier produced this verdict.
ticket_id: Option<String>Optional extracted ticket id (e.g. "PROJ-123").
complexity: Option<u8>Optional commit complexity score on a 1–5 scale.
None means the commit was not scored — only the LLM tier produces
a complexity score; rule/regex/fuzzy tiers always leave this None.
The scale is: 1 = trivial, 2 = simple, 3 = moderate, 4 = complex,
5 = highly complex.
Implementations§
Source§impl ClassificationResult
impl ClassificationResult
Sourcepub fn unclassified() -> Self
pub fn unclassified() -> Self
Construct an “unclassified” result used as a default when no tier matches.
Why: callers prefer a deterministic verdict over a panic / Option
when the cascade fails; this is the canonical safe default.
What: returns category = "uncategorized", top_level = Unknown,
confidence = 0.0, method = FuzzyMatch, and complexity = None.
Test: covered by unclassified_defaults_complexity_to_none.
complexity defaults to None — unclassified commits are never
complexity-scored.
Trait Implementations§
Source§impl Clone for ClassificationResult
impl Clone for ClassificationResult
Source§fn clone(&self) -> ClassificationResult
fn clone(&self) -> ClassificationResult
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 ClassificationResult
impl Debug for ClassificationResult
Source§impl<'de> Deserialize<'de> for ClassificationResult
impl<'de> Deserialize<'de> for ClassificationResult
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>,
Source§impl PartialEq for ClassificationResult
impl PartialEq for ClassificationResult
Source§fn eq(&self, other: &ClassificationResult) -> bool
fn eq(&self, other: &ClassificationResult) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ClassificationResult
impl Serialize for ClassificationResult
impl StructuralPartialEq for ClassificationResult
Auto Trait Implementations§
impl Freeze for ClassificationResult
impl RefUnwindSafe for ClassificationResult
impl Send for ClassificationResult
impl Sync for ClassificationResult
impl Unpin for ClassificationResult
impl UnsafeUnpin for ClassificationResult
impl UnwindSafe for ClassificationResult
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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