Skip to content

chore(lint): errors keep their source instead of discarding it in map_err - #717

Draft
PiquelChips wants to merge 1 commit into
mainfrom
chore/map-err-ignore
Draft

PiquelChips wants to merge 1 commit into
mainfrom
chore/map-err-ignore

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What and why

Turns on clippy::map_err_ignore, so map_err(|_| …) no longer drops the error it converts. All 41 sites are fixed: 19 keep their source, 22 carry an #[expect].

Sources kept (19). The error types gain the source: ChallengeError (InvalidErrorDescription, InvalidMaxAge, InvalidResourceMetadata, NotUtf8), CryptoError (MalformedToken, KeyId, NoteVerifierKeyEncoding, NoteSignatureEncoding), Malformed, TokenError (Malformed, MalformedHeader, InvalidSubject), DiscoveryError::InvalidIssuer, TelemetryError::TimedOut and AdminError::InvalidHandoffReturn (new). TraceId's hex parsing no longer has a fallible step. These are breaking changes to public error types of the SDK and the common crate, which is fine this early.

#[expect(clippy::map_err_ignore)] (22), each on the smallest statement or function:

  • Secret or personal data in the source error (9): SecretReference::resolve (OsString is the secret itself), Secret::parse of the admin handoff state and code, the email-verification and recovery tokens, the passkey assertion (serde_json quotes its input), the account export's send (returns the unsent chunk), the announcement form's query, and ApiError's picture ID.
  • The source carries nothing, by design (7): the provider's Unspecified in Rs256VerifyingKey::verify and SealingKey::open, and TryFromSliceError in Secret::parse and four spots of note.rs whose lengths were just checked or are fixed by the algorithm (including a hex seed already validated).
  • The error is deliberately answered, not reported (6): SignedIn::require's StepUp and SessionError::StepUpRequired (say what to ask for, not why), InvalidSetting for a scope (its message lists the allowed scopes), delivery failures (Failure is a stored Copy kind, for the address and the destination), and the notification path ID answered as missing. Together with the 9 above that is 22.

ApiError has no source field (its causes "only reach the logs"), which is why its three sites are expectations rather than a new design. If you would rather give it one, that is a separate change.

Testing

cargo clippy -- -D warnings passes over the workspace and over each crate alone. cargo test passes for common, crypto, auth-sdk and telemetry, and cargo nextest run -p auth-service passes (the database tests are skipped without a scratch cluster).

Note

Written by Claude Sonnet 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant