add optional ingestion quota to tenant metadata#1691
add optional ingestion quota to tenant metadata#1691nikhilsinhaparseable wants to merge 1 commit into
Conversation
WalkthroughAdds three new public types— ChangesIngestion Quota Modeling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/tenants/mod.rs (1)
69-85:⚠️ Potential issue | 🔴 CriticalRemove unused
update_tenant_metamethod or implement its callers.
update_tenant_metais defined as a public method but is never called anywhere in the codebase. Either this method should be removed if it's not needed, or the handlers/endpoints that should invoke it need to be implemented. If this is intentional dead code for a future feature, document the intent with a comment and consider making it private or adding#[allow(dead_code)]to clarify intent.The partial-update semantics concern about quota fields is valid in principle (both fields are optional in
StorageMetadata, and passingNonewill overwrite persisted values), but this is secondary to the fact that the method is unreachable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tenants/mod.rs` around lines 69 - 85, The `update_tenant_meta` method in the tenants module is defined as public but is never called anywhere in the codebase, making it dead code. Determine whether this method is needed: if it is intentional for a future feature, add a comment explaining the intent and consider making it private or adding the `#[allow(dead_code)]` attribute; if it is not needed, remove the entire `update_tenant_meta` method definition; alternatively, if this method should be invoked by handlers or endpoints, implement those callers instead.
🧹 Nitpick comments (1)
src/storage/store_metadata.rs (1)
70-75: Add explicit camelCase serde renaming toQuotaPeriodfor consistency withIngestionQuotaType.The
IngestionQuotaTypeenum uses#[serde(rename_all = "camelCase")]and serializes to"sizeBytes"and"eventCount", whileQuotaPeriodhas no serde attribute and serializes to"Monthly","Yearly","Lifetime"(PascalCase). This creates an inconsistent JSON contract. Adding#[serde(rename_all = "camelCase")]toQuotaPeriodwould normalize it to"monthly","yearly","lifetime".Proposed change
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub enum QuotaPeriod { Monthly, Yearly, Lifetime, }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/storage/store_metadata.rs` around lines 70 - 75, The QuotaPeriod enum currently serializes to PascalCase (Monthly, Yearly, Lifetime) because it lacks a serde renaming attribute, while IngestionQuotaType uses #[serde(rename_all = "camelCase")] to maintain consistency. Add the #[serde(rename_all = "camelCase")] attribute to the QuotaPeriod enum definition (located above the pub enum QuotaPeriod line) to normalize serialization to camelCase (monthly, yearly, lifetime) and match the JSON contract used by IngestionQuotaType.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/tenants/mod.rs`:
- Around line 69-85: The `update_tenant_meta` method in the tenants module is
defined as public but is never called anywhere in the codebase, making it dead
code. Determine whether this method is needed: if it is intentional for a future
feature, add a comment explaining the intent and consider making it private or
adding the `#[allow(dead_code)]` attribute; if it is not needed, remove the
entire `update_tenant_meta` method definition; alternatively, if this method
should be invoked by handlers or endpoints, implement those callers instead.
---
Nitpick comments:
In `@src/storage/store_metadata.rs`:
- Around line 70-75: The QuotaPeriod enum currently serializes to PascalCase
(Monthly, Yearly, Lifetime) because it lacks a serde renaming attribute, while
IngestionQuotaType uses #[serde(rename_all = "camelCase")] to maintain
consistency. Add the #[serde(rename_all = "camelCase")] attribute to the
QuotaPeriod enum definition (located above the pub enum QuotaPeriod line) to
normalize serialization to camelCase (monthly, yearly, lifetime) and match the
JSON contract used by IngestionQuotaType.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fe0548c4-398e-4118-8dc2-11682268ffb8
📒 Files selected for processing (3)
src/storage/mod.rssrc/storage/store_metadata.rssrc/tenants/mod.rs
Summary by CodeRabbit