Skip to content

add optional ingestion quota to tenant metadata#1691

Open
nikhilsinhaparseable wants to merge 2 commits into
parseablehq:mainfrom
nikhilsinhaparseable:license-change
Open

add optional ingestion quota to tenant metadata#1691
nikhilsinhaparseable wants to merge 2 commits into
parseablehq:mainfrom
nikhilsinhaparseable:license-change

Conversation

@nikhilsinhaparseable

@nikhilsinhaparseable nikhilsinhaparseable commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added ingestion quota management across metadata, including optional limits based on size-bytes or event-count with monthly, yearly, or lifetime periods.
    • Extended tenant metadata updates to accept and persist ingestion quota and quota period information.
  • Chores
    • Updated public re-export formatting for storage metadata (no functional changes).

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8b39322f-4c17-48f8-882e-93cc9fbceca2

📥 Commits

Reviewing files that changed from the base of the PR and between aefb53c and e9a8020.

📒 Files selected for processing (1)
  • src/tenants/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tenants/mod.rs

Walkthrough

Adds three new public types—IngestionQuota, IngestionQuotaType, and QuotaPeriod—to store_metadata.rs with serde serialization. StorageMetadata gains two optional fields for these types. TenantMetadata::update_tenant_meta is extended with matching optional parameters that write into tenant metadata. Re-exports in storage/mod.rs are updated to include the new types.

Changes

Ingestion Quota Modeling

Layer / File(s) Summary
Quota types and StorageMetadata schema
src/storage/store_metadata.rs, src/storage/mod.rs
Introduces IngestionQuota, IngestionQuotaType, and QuotaPeriod with camelCase serde and a renamed type field. Adds ingestion_quota: Option<IngestionQuota> and quota_period: Option<QuotaPeriod> to StorageMetadata, both defaulting to None and skipped during serialization when absent. Re-exports the three new types from the storage module.
Tenant metadata update wiring
src/tenants/mod.rs
Imports the new quota types and adds ingestion_quota and quota_period as optional parameters to update_tenant_meta, assigning them directly to tenant.meta.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • parseablehq/parseable#1568: Overlaps with tenant metadata updates at TenantMetadata::update_tenant_meta by adding additional field writes (customer_name, date, plan) and a new get_tenant_meta function to the same function signature.

Poem

🐰 A quota was needed, so limits were set,
In bytes or in events—no overflow yet!
Monthly or yearly, lifetime if you dare,
The metadata struct now has fields to spare.
Hopped through the tenants, wired it with care~ ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided; the required template sections are entirely missing. Add a comprehensive description including the goal, rationale for the changes, key modifications, and confirm the testing checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding optional ingestion quota fields to tenant metadata.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 | 🔴 Critical

Remove unused update_tenant_meta method or implement its callers.

update_tenant_meta is 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 passing None will 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 to QuotaPeriod for consistency with IngestionQuotaType.

The IngestionQuotaType enum uses #[serde(rename_all = "camelCase")] and serializes to "sizeBytes" and "eventCount", while QuotaPeriod has no serde attribute and serializes to "Monthly", "Yearly", "Lifetime" (PascalCase). This creates an inconsistent JSON contract. Adding #[serde(rename_all = "camelCase")] to QuotaPeriod would 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

📥 Commits

Reviewing files that changed from the base of the PR and between b253396 and aefb53c.

📒 Files selected for processing (3)
  • src/storage/mod.rs
  • src/storage/store_metadata.rs
  • src/tenants/mod.rs

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 19, 2026
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