chore: trim verbose docstrings on Portal timeout constants and enum

Cleanup pass after Portal resilience commits (6ccb225, 68a6eec).

Trimmed docstrings that restated information already obvious from the
type/variant names or duplicated elsewhere:

- PORTAL_SERVICE_TIMEOUT: 6 lines -> 3 lines (keep 'why 5s' rationale)
- PORTAL_USER_DIALOG_TIMEOUT: 6 lines -> 2 lines (keep 'why 30s' rationale)
- PortalPhaseTimeout enum: 5 lines -> 1 line (variants are self-documenting)
- Service variant: 2 lines -> 1 line
- TokenDependent variant: 2 lines -> 1 line

Net: -15 lines of comment overhead. No behavior change.

Tests:
- cargo build --release: 0 new warnings (19 baseline preserved)
- cargo test: 97 lib + 3 integration, 0 failed
This commit is contained in:
dailz
2026-06-21 11:00:29 +08:00
parent 68a6eecfbe
commit e7accecfec
+7 -22
View File
@@ -23,36 +23,21 @@ use tokio::runtime::Runtime;
use crate::args::Args; use crate::args::Args;
/// Timeout for Portal phases that do not require user interaction. /// Portal phase timeout when no user interaction is expected (proxy/session
/// Applies to: Screencast proxy creation, session creation, source selection /// creation, token-path select/start, PipeWire fd). 5s is generous for
/// (when a restore token is used), session start (token path), and PipeWire /// healthy xdg-desktop-portal (<500ms typical) but bounded for fast failure.
/// remote fd acquisition.
///
/// 5 seconds is generous for healthy xdg-desktop-portal (typically <500ms)
/// but bounded enough that a stuck service fails fast.
const PORTAL_SERVICE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5); const PORTAL_SERVICE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
/// Timeout for Portal phases that may require a user to click "Allow" in a /// Portal phase timeout when user must click "Allow" in desktop dialog
/// desktop dialog. Applies to: source selection and session start when NO /// (select/start without restore token). 30s gives time to find the dialog.
/// restore token is available (fresh authorization).
///
/// 30 seconds gives the user time to find and click the dialog without
/// causing a spurious timeout failure.
const PORTAL_USER_DIALOG_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(30); const PORTAL_USER_DIALOG_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(30);
/// Classification of Portal phase timeouts to drive retry behavior. /// Classification of Portal phase timeouts to drive retry behavior.
///
/// `TokenDependent` failures are eligible for a single automatic retry that
/// clears the cached restore token and re-runs the entire Portal setup with
/// fresh authorization. `Service` failures are not retried automatically
/// (the user should restart the Portal service instead).
#[derive(Debug)] #[derive(Debug)]
enum PortalPhaseTimeout { enum PortalPhaseTimeout {
/// Portal service unresponsive in a phase not related to restore token. /// Portal service unresponsive; not retried (user should restart service).
/// No automatic retry; user should restart Portal service.
Service, Service,
/// Portal timed out in a token-dependent phase. Retry eligible: clear /// Timed out in token-dependent phase; retried once after clearing token.
/// cached token and try once more with fresh authorization.
TokenDependent, TokenDependent,
} }