fix(workspace): add derives/docs per code review, remove unused thiserror from solitaire_sync

This commit is contained in:
Solitaire Quest
2026-04-23 11:04:15 -07:00
parent 684f07746d
commit f84d7c5849
6 changed files with 2183 additions and 6 deletions
+6
View File
@@ -7,6 +7,8 @@ use thiserror::Error;
pub enum SyncError {
#[error("unsupported platform for this sync backend")]
UnsupportedPlatform,
// TODO: Replace String with concrete source error types (e.g. reqwest::Error,
// serde_json::Error) when real implementations are added in Phase 8.
#[error("network error: {0}")]
Network(String),
#[error("authentication error: {0}")]
@@ -19,9 +21,13 @@ pub enum SyncError {
/// methods — it never matches on a backend enum variant.
#[async_trait]
pub trait SyncProvider: Send + Sync {
/// Fetch the remote sync payload. Returns the latest server state for merging.
async fn pull(&self) -> Result<SyncPayload, SyncError>;
/// Push the local payload to the backend. Returns the merged server response.
async fn push(&self, payload: &SyncPayload) -> Result<SyncResponse, SyncError>;
/// Human-readable name of this backend, used in settings UI and logs.
fn backend_name(&self) -> &'static str;
/// Returns true if the user is currently authenticated with this backend.
fn is_authenticated(&self) -> bool;
/// Mirror an achievement unlock to this backend (no-op for most backends).
async fn mirror_achievement(&self, _id: &str) -> Result<(), SyncError> {