feat(frontier): add source field to SearchOrganizationTokensResponse#484
feat(frontier): add source field to SearchOrganizationTokensResponse#484
Conversation
…OrganizationToken Expose the source field (e.g. system.starter, system.buy, system.awarded, system.revert, system.overdraft) already stored on billing_transactions. Lets the frontend render friendly event labels and filter by event type. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughA Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest Buf updates on your PR. Results from workflow Validate / validate (pull_request).
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
raystack/frontier/v1beta1/frontier.proto (1)
587-587: Consider documenting the expectedsourcevalues.Since
sourcecarries a constrained enumerated-like set of values (system.starter,system.buy,system.awarded,system.revert,system.overdraft) that the SDK will switch on to render friendly labels and power a filter, a brief comment listing the known values would help consumers avoid drift as new sources are added server-side. A stronger alternative would be to model it as anenum(e.g.,TxnEventSource) to make the contract explicit and catch typos at generation time, though that may be overkill if the set is expected to grow frequently.📝 Suggested doc comment
string org_id = 8; - string source = 9; + // source indicates the origin of the token transaction. + // Known values: "system.starter", "system.buy", "system.awarded", + // "system.revert", "system.overdraft". + string source = 9; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@raystack/frontier/v1beta1/frontier.proto` at line 587, Add documentation or an explicit enum for the proto field `source` on the message containing `string source = 9;`: either add a brief comment above `source` enumerating the known values (`system.starter`, `system.buy`, `system.awarded`, `system.revert`, `system.overdraft`) so SDKs and consumers know the expected tokens, or replace the `string` with a `enum TxnEventSource { ... }` (or similar name) and update any uses to `TxnEventSource source = 9;` to make the contract explicit and prevent typos at generation time.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@raystack/frontier/v1beta1/frontier.proto`:
- Line 587: Add documentation or an explicit enum for the proto field `source`
on the message containing `string source = 9;`: either add a brief comment above
`source` enumerating the known values (`system.starter`, `system.buy`,
`system.awarded`, `system.revert`, `system.overdraft`) so SDKs and consumers
know the expected tokens, or replace the `string` with a `enum TxnEventSource {
... }` (or similar name) and update any uses to `TxnEventSource source = 9;` to
make the contract explicit and prevent typos at generation time.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8c41b250-f71d-4487-b94f-5b34fa38c18a
📒 Files selected for processing (1)
raystack/frontier/v1beta1/frontier.proto
…lumn mapping The token response now exposes the source of each transaction so the SDK Tokens page can render friendly Event labels (e.g. "Recharge", "Starter tokens") and offer a multiselect filter by event type — restoring parity with the pre-RQL client-mode page. Backend: - AggregatedToken: add Source field (rql string). - OrgToken repository: select billing_transactions.source, add source to filterable fields, populate in transform. - Handler: map Source to the response's source field. - CSV export: add Source column. Frontend (views-new): - Restore TxnEventSourceMap including the new system.overdraft entry from backend constants. - Event column now accessor="source" with multiselect filter; cell shows TxnEventSourceMap[source] || description || '-'. Depends on raystack/proton#484 being merged + published so the @raystack/proton pin can be bumped in sdk/ and apps/admin/ package.json. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Adds `string source = 9` to `SearchOrganizationTokensResponse.OrganizationToken`. The source field is already stored on `billing_transactions.source` server-side and carries values like `system.starter`, `system.buy`, `system.awarded`, `system.revert`, `system.overdraft`.
Exposing it on the RPC response lets the SDK restore the old Tokens page behavior — friendly Event column labels (e.g. `system.buy` → "Recharge") and a multiselect filter by event type.
Follow-up
Frontier backend change will populate this field from the repository. SDK views-new Tokens page will re-introduce `TxnEventSourceMap` with the new `system.overdraft` value included.
🤖 Generated with Claude Code