Skip to content

refactor(store): store errors keep their sources instead of going through anyhow - #648

Open
PiquelChips wants to merge 1 commit into
mainfrom
refactor/store-typed-errors
Open

PiquelChips wants to merge 1 commit into
mainfrom
refactor/store-typed-errors

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

piqueld-store returned anyhow::Error from loading the master key and from encrypting and generating secrets, so StoreError::SecretSource held an opaque error that callers could only downcast. Library crates return typed errors; anyhow stays in the binaries.

A new SecretError (secrets::error) names each failure: the master-key failures (KeyFailure, now SecretError::Key), filesystem and rustix failures with the action that failed and their source, the random source, OpenSSL key generation, the generation task, and which secret was being generated. StoreError::SecretSource holds it as its #[source]. Callers that downcast for a KeyFailure ask SecretError::key_failure, and the doctor check prints SecretError::chain where it used {error:#}. anyhow leaves piqueld-store's dependencies.

Part of PQD-169

Note

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

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f167bd36-05ca-4495-82d9-79d59f3cd4b5
Commits

Reviewing files that changed from the base of the PR and between 8dde799 and 4b8add0.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 9

  • apps/piqueld/src/operations.rs
  • crates/piqueld-store/Cargo.toml
  • crates/piqueld-store/src/lib.rs
  • crates/piqueld-store/src/secret/key.rs
  • crates/piqueld-store/src/secret/mod.rs
  • crates/piqueld-store/src/secret/tests.rs
  • crates/piqueld-store/src/secrets/error.rs
  • crates/piqueld-store/src/secrets/generate.rs
  • crates/piqueld-store/src/secrets/mod.rs
  • 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

@PiquelChips
PiquelChips marked this pull request as ready for review November 22, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant