Skip to content

feat: api key + auto top up enabled#2682

Merged
baktun14 merged 4 commits intomainfrom
features/paid-features-enable
Feb 5, 2026
Merged

feat: api key + auto top up enabled#2682
baktun14 merged 4 commits intomainfrom
features/paid-features-enable

Conversation

@baktun14
Copy link
Contributor

@baktun14 baktun14 commented Feb 5, 2026

Summary by CodeRabbit

  • New Features

    • API keys can now be created and managed by trial and regular users.
    • Added a "Go to Console" button in the welcome flow to proceed to deployment.
  • Improvements

    • API key creation flow simplified by removing the previous payment gating.
    • Deployment settings now auto-enable top-up when a managed wallet exists.
  • Tests

    • Added unit and functional tests covering deployment settings and API key behaviors.

@baktun14 baktun14 requested a review from a team as a code owner February 5, 2026 19:53
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Removes trial-user gating for API key creation and fetching, grants ApiKey access to REGULAR_USER, and makes deployment settings autoTopUp initialization wallet-aware by checking for a managed user wallet when creating settings.

Changes

Cohort / File(s) Summary
Auth / Ability
apps/api/src/auth/services/ability/ability.service.ts
Adds an ApiKey access rule for REGULAR_USER in AbilityService rules (mirrors existing REGULAR_PAYING_USER rule).
Deployment Settings
apps/api/src/deployment/services/deployment-setting/deployment-setting.service.ts, apps/api/src/deployment/services/deployment-setting/deployment-setting.service.spec.ts
Adds UserWalletRepository dependency; findOrCreateByUserIdAndDseq sets autoTopUpEnabled based on presence of a managed wallet. Adds comprehensive unit tests for create/find scenarios.
API functional tests
apps/api/test/functional/api-key.spec.ts
Updates POST /v1/api-keys test: trial users now receive 201 with full apiKey instead of 403 Forbidden.
Frontend: API keys UI & query
apps/deploy-web/src/components/api-keys/ApiKeyList.tsx, apps/deploy-web/src/queries/useApiKeysQuery.ts, apps/deploy-web/src/queries/useApiKeysQuery.spec.tsx
Removes isTrialing checks; query enabling now depends only on userId and isManaged. Exposes Create Key button directly (removes VerifiedPayingCustomer gating). Removes a test asserting no fetch for trialing users.
Onboarding UI
apps/deploy-web/src/components/onboarding/steps/WelcomeStep/WelcomeStep.tsx
Adds a "Go to Console" link-style Button that triggers goToDeployment (shows spinner when deploying).

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Frontend
  participant API
  participant UserWalletRepo
  participant DB

  Client->>Frontend: Click "Create API Key"
  Frontend->>API: POST /v1/api-keys (userId)
  API->>API: Ability check (REGULAR_USER -> ApiKey) 
  API->>UserWalletRepo: findOneByUserId(userId)
  UserWalletRepo->>DB: query managed wallet
  DB-->>UserWalletRepo: wallet found / not found
  UserWalletRepo-->>API: wallet exists? (true/false)
  API->>DB: create ApiKey record
  DB-->>API: created key
  API-->>Frontend: 201 Created + full apiKey
  Frontend-->>Client: show created API key
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • stalniy
  • ygrishajev

Poem

🐰 I hopped from gate to console light,
Trial shackles gone — I dance with delight.
Keys now bloom with a managed-wallet cheer,
Auto-topup whispers when wallets are near.
Hop on, create, the API path is clear! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: api key + auto top up enabled' accurately captures the two main features being enabled in this PR: API key permissions for regular users and auto top-up functionality tied to managed wallets.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch features/paid-features-enable

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

@@ -360,6 +360,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.0.0.tgz",
Copy link
Contributor

@github-actions github-actions bot Feb 5, 2026

Choose a reason for hiding this comment

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

🔄 Carefully review the package-lock.json diff

Resolve the comment if everything is ok

- node_modules/git-semver-tags/node_modules/conventional-commits-filter                    5.0.0   
- node_modules/git-semver-tags/node_modules/conventional-commits-parser                    6.2.1   

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.75%. Comparing base (3501687) to head (93a7a64).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../deploy-web/src/components/api-keys/ApiKeyList.tsx 0.00% 3 Missing ⚠️
...nents/onboarding/steps/WelcomeStep/WelcomeStep.tsx 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (33.33%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2682   +/-   ##
=======================================
  Coverage   53.75%   53.75%           
=======================================
  Files        1055     1055           
  Lines       29313    29311    -2     
  Branches     6321     6321           
=======================================
- Hits        15756    15755    -1     
+ Misses      13172    13171    -1     
  Partials      385      385           
Flag Coverage Δ *Carryforward flag
api 78.53% <ø> (-0.01%) ⬇️ Carriedforward from 0caea14
deploy-web 36.40% <33.33%> (+<0.01%) ⬆️
log-collector 75.35% <ø> (ø)
notifications 87.94% <ø> (ø) Carriedforward from 0caea14
provider-console 81.48% <ø> (ø)
provider-proxy 84.35% <ø> (ø)
tx-signer 79.25% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...s/api/src/auth/services/ability/ability.service.ts 96.00% <ø> (ø)
...s/deployment-setting/deployment-setting.service.ts 91.66% <ø> (-0.34%) ⬇️
apps/deploy-web/src/queries/useApiKeysQuery.ts 91.89% <100.00%> (ø)
...nents/onboarding/steps/WelcomeStep/WelcomeStep.tsx 0.00% <0.00%> (ø)
.../deploy-web/src/components/api-keys/ApiKeyList.tsx 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@baktun14 baktun14 merged commit c8d7137 into main Feb 5, 2026
48 of 54 checks passed
@baktun14 baktun14 deleted the features/paid-features-enable branch February 5, 2026 21:17
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

Comments