Skip to content

feat(frontier): add source field to SearchOrganizationTokensResponse#484

Merged
AmanGIT07 merged 1 commit intomainfrom
feat/add-source-to-org-tokens
Apr 24, 2026
Merged

feat(frontier): add source field to SearchOrganizationTokensResponse#484
AmanGIT07 merged 1 commit intomainfrom
feat/add-source-to-org-tokens

Conversation

@paanSinghCoder
Copy link
Copy Markdown
Contributor

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

…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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

📝 Walkthrough

Walkthrough

A source string field (field number 9) is added to the SearchOrganizationTokensResponse.OrganizationToken message in the frontier protobuf schema. This field will allow the API response to include information about the source of each organization token. No service RPCs, request structures, or other message fields were modified in this change.

Suggested reviewers

  • whoAbhishekSah
  • AmanGIT07
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a source field to SearchOrganizationTokensResponse, which matches the changeset exactly.
Description check ✅ Passed The description provides relevant context about the source field addition, its current storage, intended use cases, and follow-up work, all directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.


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.

❤️ Share

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

@github-actions
Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Validate / validate (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedApr 23, 2026, 3:46 PM

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
raystack/frontier/v1beta1/frontier.proto (1)

587-587: Consider documenting the expected source values.

Since source carries 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 an enum (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

📥 Commits

Reviewing files that changed from the base of the PR and between 3b6b44c and 4112d35.

📒 Files selected for processing (1)
  • raystack/frontier/v1beta1/frontier.proto

paanSinghCoder added a commit to raystack/frontier that referenced this pull request Apr 23, 2026
…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>
@AmanGIT07 AmanGIT07 merged commit 7523cfd into main Apr 24, 2026
3 checks passed
@AmanGIT07 AmanGIT07 deleted the feat/add-source-to-org-tokens branch April 24, 2026 12:06
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.

2 participants