Skip to content

feat(billing-platform): Add bare-minimum Grant proto for Engagement Service#238

Merged
dashed merged 11 commits into
mainfrom
aleal/engagement-service-core-protos
May 22, 2026
Merged

feat(billing-platform): Add bare-minimum Grant proto for Engagement Service#238
dashed merged 11 commits into
mainfrom
aleal/engagement-service-core-protos

Conversation

@dashed
Copy link
Copy Markdown
Member

@dashed dashed commented May 4, 2026

Summary

Establishes the services/engagement/v1/ proto namespace with a bare-minimum Grant message — the single entity UsagePricer needs to consume grants.

What's in this PR

grant.proto — one message, two enums, 38 lines:

GrantType  { UNSPECIFIED, UNITS, CENTS }
GrantStatus { UNSPECIFIED, ACTIVE, INACTIVE, EXPIRED }
Grant { id, organization_id, type, line_item_uids, amount,
        start_date, end_date, status }
  • Uses repeated string line_item_uids to match the platform's string UID convention (LineItemDetails.uid, LineItemUsageSummary.line_item_uid)
  • GRANT_TYPE_CENTS included as a real enum value (no breaking-change concern since the enum is new)

Other changes:

  • CODEOWNERS/proto/sentry_protos/billing@getsentry/revenue
  • Auto-generated Rust bindings

Review feedback addressed

Feedback Resolution
Grant.sku → string UIDs repeated string line_item_uids = 4
Trial.planpackage_uid Trial deferred to follow-up PR
Trial.skuline_item_uid Trial deferred to follow-up PR
TRIAL_SOURCE_DEFAULTSELF_SERVE Trial deferred to follow-up PR
Reserved fields "is this necessary?" Removed
Explain PARTNER/COMMITTED_SPEND GrantSource deferred to follow-up PR

What's next

Each follow-up PR adds the minimum needed for the next implementation step:

PR Adds Unblocks
This PR Grant message + CODEOWNERS Everything below, Grant table
Grant source grant_source.proto + source field on Grant Active grants endpoint
Active grants endpoint endpoint_get_active_grants UsagePricer read-path
Trial proto trial.proto (Trial + enums) Active trial endpoint, write endpoints
Active trial endpoint endpoint_get_active_trial Feature-entitlement
Audit/linkage fields Fields on Grant for gift, cancel, counter-grant Write endpoints
Write endpoints start/cancel/extend trial + gift grant Write-path integration
List trials + revocation list_trials + revocation audit fields Admin UI
Deprecation housekeeping Deprecate legacy credit.proto + endpoint_get_trials.proto

Test plan

  • buf lint passes
  • buf format passes
  • buf breaking --against main passes (all changes additive)
  • make build-py generates Python stubs
  • make build-rust generates Rust bindings

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 21, 2026, 6:42 PM

@dashed dashed self-assigned this May 4, 2026
@dashed dashed marked this pull request as ready for review May 4, 2026 16:36
@dashed dashed requested a review from a team May 4, 2026 16:36
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/grant.proto
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/grant.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/grant_source.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/trial.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/trial.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/trial.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/trial.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/grant_source.proto Outdated
Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/grant.proto Outdated
@dashed dashed force-pushed the aleal/engagement-service-core-protos branch from 495ae9c to 153c151 Compare May 8, 2026 16:54
dashed added a commit that referenced this pull request May 8, 2026
Address PR #238 review feedback ("start small, build over time"):

- Replace `optional SKU sku` with `repeated string line_item_uids`
  to match the billing platform's string UID convention
- Remove grant_source.proto (deferred to P2)
- Remove trial.proto (deferred to P4)
- Remove reserved field blocks, audit fields, revocation fields
- Remove GRANT_STATUS_PENDING (deferred)
- Simplify comments; remove internal references
- Regenerate Rust bindings
@dashed dashed force-pushed the aleal/engagement-service-core-protos branch from 8f2af0a to 2e39922 Compare May 8, 2026 22:46
@dashed dashed changed the title feat(billing-platform): Add Engagement Service core messages feat(billing-platform): Add bare-minimum Grant proto for Engagement Service May 8, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e39922. Configure here.

Comment thread proto/sentry_protos/billing/v1/services/engagement/v1/grant.proto
// Consumable now; within [start_date, end_date].
GRANT_STATUS_ACTIVE = 1;
// Manually deactivated (admin revoke, customer opt-out, etc.).
GRANT_STATUS_INACTIVE = 2;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we differentiate between inactive and expired?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@krithikravi grants can be naturally expired via time or manually revoked by a human/user. based on this, it'll be better to have two explicit statuses for why a grant is not active.

dashed and others added 10 commits May 21, 2026 14:35
Add the `services/engagement/v1/` proto namespace with the three core
message files for the new Engagement Service:

- `grant_source.proto` — GrantSource enum (10 values covering trial,
  promo, recurring, gift, partner, and committed-spend sources)
- `grant.proto` — Grant message, GrantType enum (UNITS, with CENTS
  reserved for Phase 3), GrantStatus enum (ACTIVE, INACTIVE, PENDING,
  EXPIRED), and server-side invariants (N1–N4, N6, N7)
- `trial.proto` — Trial message, TrialType enum (PLAN, PRODUCT,
  SUBSCRIPTION, ENTERPRISE), TrialStatus, TrialSource with N5
  concurrency invariant

Grant replaces the legacy `billing.v1.Credit` message (renamed to
resolve the 11-site naming collision with dollar-credit paths). Phase 3
reserved fields (14–20, 24–25) accommodate CENTS absorption and
multi-period caps without wire-format changes.

Also adds a CODEOWNERS entry for the engagement package.
Replace "Phase 2" / "Phase 3" references with self-contained language
("currently", "future", "not yet active") so proto comments are
understandable without access to internal planning docs.
The INVARIANTS block (N1-N8) describes service-layer behavioral
contracts that reference endpoint protos and RPCs not yet defined.
These belong with the endpoint protos or service implementation,
not the bare message definitions.
Address PR #238 review feedback ("start small, build over time"):

- Replace `optional SKU sku` with `repeated string line_item_uids`
  to match the billing platform's string UID convention
- Remove grant_source.proto (deferred to P2)
- Remove trial.proto (deferred to P4)
- Remove reserved field blocks, audit fields, revocation fields
- Remove GRANT_STATUS_PENDING (deferred)
- Simplify comments; remove internal references
- Regenerate Rust bindings
@dashed dashed force-pushed the aleal/engagement-service-core-protos branch from 2e39922 to d6396d4 Compare May 21, 2026 18:41
@dashed dashed merged commit fbac533 into main May 22, 2026
15 checks passed
@dashed dashed deleted the aleal/engagement-service-core-protos branch May 22, 2026 20:52
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.

3 participants