1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! GAP-SG-270: carries `EmbedError::retry_class` across the conversion to
//! `AppError`.
//!
//! [`crate::embedding_api::EmbedError`] states its retry verdict at the exact
//! HTTP status / structured provider code, but `From<EmbedError> for AppError`
//! unwraps down to `source` and DROPS that verdict. Every embedding failure then
//! arrived at the enrich queue as the untyped `AppError::Embedding` bucket,
//! whose conservative floor retries a PERMANENT failure until `--max-attempts`
//! runs out.
//!
//! The embedder is the single place where the fallback chain performs that
//! conversion, so the verdict is re-attached HERE — via
//! [`crate::errors::AppError::EmbeddingClassified`] — instead of being
//! reconstructed by the consumer.
use crateEmbedError;
use crateAppError;
use crateAttemptOutcome;
/// Converts an [`EmbedError`] into an [`AppError`] WITHOUT losing its
/// origin-computed retry verdict (GAP-SG-270).
///
/// Only the untyped `AppError::Embedding` bucket is re-wrapped as
/// [`AppError::EmbeddingClassified`]. Every other source variant already
/// classifies itself (`RateLimited`, `Timeout` and `DbBusy` are transient;
/// `ProviderError` and `NotFound` are permanent), so it is forwarded untouched
/// and the existing typed classification keeps winning.
pub
/// Reads back the retry verdict an [`AppError`] carries, if it carries one.
///
/// Returns `None` for every variant that never held a verdict, which keeps the
/// caller on its pre-existing untyped path instead of inventing a class.
pub
/// Rebuilds an embedding failure with a NEW message while keeping the retry
/// verdict `previous` carried.
///
/// The fallback chain restates the last backend error as an embedding detail
/// string; doing that with a bare `AppError::Embedding` threw the verdict away
/// one step after it had just been preserved.
pub