Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move ApiKey type to backends, remove AccountTier sqlx::Type #1923

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonaro00
Copy link
Member

  • debloats common
  • prevents mistake of binding an AccountTier and db not finding the type

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR moves the ApiKey type from common to backends module and removes AccountTier's sqlx::Type derivation to reduce common module bloat and prevent database type binding issues.

  • Relocated ApiKey implementation to backends/src/key.rs with proper validation for 16-char alphanumeric keys and secure memory handling via zeroize
  • Removed #[cfg_attr(feature = "persist", derive(sqlx::Type))] from common/src/models/user.rs to prevent direct AccountTier database bindings
  • Updated import paths across codebase to use shuttle_backends::key::ApiKey instead of from common module

11 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

backends/Cargo.toml Show resolved Hide resolved
Comment on lines +22 to +25
let mut errors = vec![];
if !key.chars().all(char::is_alphanumeric) {
errors.push("The API key should consist of only alphanumeric characters.");
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: unnecessary semicolon after if block creates unreachable code

@@ -68,12 +67,8 @@ extract_propagation = [
"tracing-opentelemetry",
]
models = ["async-trait", "reqwest", "service"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: models feature still depends on service feature but service feature depends on display - consider flattening these dependencies to avoid circular references

Copy link
Contributor

@oddgrd oddgrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See auth CI failure

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.

2 participants