Skip to content

feat(ri-exchange): symmetric session-auth approve path (closes #300)#590

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
feat/wave6-purchase-features
Open

feat(ri-exchange): symmetric session-auth approve path (closes #300)#590
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
feat/wave6-purchase-features

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Mirrors the in-dashboard approve pattern from #286 onto the RI Exchange flow.

Closes #300.

Changes

  • Three-mode dispatch in approveRIExchange handler: session with approve-any/approve-own → RBAC approve; legacy email token → unchanged path; neither → 401.
  • Migration 000053: nullable approved_by + created_by_user_id columns on ri_exchange_history. approved_by stamped best-effort after every session-authed approval.
  • Frontend Approve button in RI Exchange history panel, visible only when canApproveRIExchangeRow returns true.
  • 8 new backend unit tests + frontend coverage; tsc clean, 61 jest suites pass.

Mirror the three-mode dispatch introduced for purchases (#286):
1. Session with approve-any/approve-own on ResourcePurchases -> RBAC
   approve, stamping approved_by for audit trail.
2. Legacy email token -> unchanged behaviour.
3. No session and no token -> 401 via requireSession.

Migration 000053 adds nullable approved_by and created_by_user_id to
ri_exchange_history. The Approve button appears in the RI Exchange
history panel for rows the current user is authorised to approve.
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-quarter Within the quarter impact/many Affects most users effort/m Days type/feat New capability labels May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@cristim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 26 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff76b96d-99b2-4763-8ab1-01984fd7c295

📥 Commits

Reviewing files that changed from the base of the PR and between bc8831b and bd20098.

📒 Files selected for processing (20)
  • frontend/src/api/index.ts
  • frontend/src/api/riexchange.ts
  • frontend/src/api/types.ts
  • frontend/src/riexchange.ts
  • internal/analytics/collector_test.go
  • internal/api/coverage_extras_test.go
  • internal/api/handler_ri_exchange.go
  • internal/api/handler_ri_exchange_test.go
  • internal/api/mocks_test.go
  • internal/api/router.go
  • internal/config/interfaces.go
  • internal/config/store_postgres.go
  • internal/config/store_postgres_nil_db_test.go
  • internal/config/store_postgres_pgxmock_test.go
  • internal/config/types.go
  • internal/database/postgres/migrations/000053_ri_exchange_approver_creator.down.sql
  • internal/database/postgres/migrations/000053_ri_exchange_approver_creator.up.sql
  • internal/purchase/mocks_test.go
  • internal/scheduler/scheduler_test.go
  • internal/server/test_helpers_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wave6-purchase-features

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

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/feat New capability urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant