commit 2af9d96239d60393448b7d828e2ab9030dffb933
parent f9124ae7f25db38c6e2794f167b77f6bde6e89e7
Author: triesap <tyson@radroots.org>
Date: Thu, 6 Aug 2026 06:57:07 +0000
mobile: replace debugderived wire labels
- define exhaustive protocol class labels independent of Rust variant names
- define exhaustive recovery action labels from the protocol authority
- remove generic Debug case conversion from mobile error records
- preserve the versioned secret-safe error wire contract with tests
Diffstat:
1 file changed, 3 insertions(+), 27 deletions(-)
diff --git a/core/crates/tera_core/src/error.rs b/core/crates/tera_core/src/error.rs
@@ -34,12 +34,12 @@ impl RadrootsAppError {
report: SdkErrorRecord {
schema_version: report.schema_version(),
code: report.code().as_str().to_owned(),
- class: debug_label(report.class()),
+ class: report.class().as_str().to_owned(),
retryable: report.retryable(),
recovery_actions: report
.recovery_actions()
.iter()
- .map(|action| debug_label(*action))
+ .map(|action| action.as_str().to_owned())
.collect(),
operation_id: report.operation_id().map(|id| id.as_str().to_owned()),
capability_id: report.capability_id().map(|id| id.as_str().to_owned()),
@@ -65,21 +65,10 @@ impl RadrootsAppError {
}
}
-fn debug_label(value: impl std::fmt::Debug) -> String {
- let mut label = String::new();
- for (index, character) in format!("{value:?}").chars().enumerate() {
- if character.is_ascii_uppercase() && index != 0 {
- label.push('_');
- }
- label.push(character.to_ascii_lowercase());
- }
- label
-}
-
#[cfg(test)]
#[cfg_attr(coverage_nightly, coverage(off))]
mod tests {
- use super::{RadrootsAppError, SdkErrorRecord, debug_label};
+ use super::{RadrootsAppError, SdkErrorRecord};
#[test]
fn sdk_error_records_are_versioned_stable_and_secret_safe() {
@@ -106,14 +95,6 @@ mod tests {
}
#[test]
- fn debug_labels_use_stable_mobile_case() {
- assert_eq!(
- debug_label(SampleLabel::RetryAfterClose),
- "retry_after_close"
- );
- }
-
- #[test]
fn public_error_constructors_preserve_typed_variants() {
assert!(matches!(
RadrootsAppError::initialization("init"),
@@ -132,9 +113,4 @@ mod tests {
RadrootsAppError::Internal(message) if message == "internal"
));
}
-
- #[derive(Debug)]
- enum SampleLabel {
- RetryAfterClose,
- }
}