Skip to content

feat(billing): add effective retention endpoint#371

Draft
dashed wants to merge 1 commit into
aleal/feat/contract-retention-configfrom
aleal/feat/effective-retention-endpoint
Draft

feat(billing): add effective retention endpoint#371
dashed wants to merge 1 commit into
aleal/feat/contract-retention-configfrom
aleal/feat/effective-retention-endpoint

Conversation

@dashed

@dashed dashed commented Jul 18, 2026

Copy link
Copy Markdown
Member

Stacks on #370. Adds the endpoint proto for the platform effective-retention resolver (Alternative D, stage B4) — the read side that will resolve package defaults + contract overrides into concrete effective retention.

New services/quotas/v1/endpoint_get_retentions.proto (no service declaration, mirroring endpoint_get_quotas.proto):

message GetRetentionsRequest { uint64 organization_id = 1; }

message EffectiveRetentionSettings {
  uint32 standard_days = 1;              // always positive
  optional uint32 downsampled_days = 2;  // present iff the category has a distinct downsampled repr
}
message EffectiveDataCategoryRetention {
  DataCategory category = 1;             // billing proto category
  EffectiveRetentionSettings settings = 2;
}
message GetRetentionsResponse {
  repeated EffectiveDataCategoryRetention retentions = 1;
  bool contract_present = 2;             // false => no platform contract, fall back to legacy
  string retention_policy_revision = 3;  // opaque; empty when no override
  uint32 event_retention_days = 4;               // category-less standard (legacy compat)
  uint32 downsampled_event_retention_days = 5;   // category-less downsampled (legacy compat)
}

Key distinction from the raw retention messages (#368/#370): EffectiveRetentionSettings carries concrete days with no inheritance sentinel — the resolver normalizes inherit_standard to concrete standard days, so the effective endpoint never exposes the raw sentinel. downsampled_days is absent (not zero) for standard-only categories.

The resolver that populates this is the follow-up GetSentry PR. Python and Rust round-trip coverage.

Add the GetRetentions endpoint proto for the platform effective-retention
resolver: GetRetentionsRequest{organization_id} and GetRetentionsResponse
carrying per-category resolved retention (EffectiveDataCategoryRetention with
concrete standard_days and optional downsampled_days), a contract_present flag,
the source retention policy revision, and the category-less standard/downsampled
scalars. Effective settings carry no inheritance sentinel -- inherit-standard is
resolved to concrete days by the resolver. No service declaration, mirroring
endpoint_get_quotas.proto. Python and Rust round-trip coverage.
@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 18, 2026, 12:27 PM

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