Skip to content

feat: enhance deployment reader service#2731

Merged
baktun14 merged 6 commits intomainfrom
fix/deployment-list-status
Feb 19, 2026
Merged

feat: enhance deployment reader service#2731
baktun14 merged 6 commits intomainfrom
fix/deployment-list-status

Conversation

@baktun14
Copy link
Contributor

@baktun14 baktun14 commented Feb 13, 2026

akash-network/support#415

Summary by CodeRabbit

  • Documentation

    • Clarified test guidance: projects use Vitest or are migrating from Jest; preserved concrete test-run commands under the Unit Tests subsection.
  • Bug Fixes / API Changes

    • Deployment list responses simplified: top-level deployment IDs reduced and lease entries no longer include a default null status.
    • Deployment list item shape updated to a dedicated, cleaner list schema.

@baktun14 baktun14 marked this pull request as ready for review February 13, 2026 19:25
@baktun14 baktun14 requested a review from a team as a code owner February 13, 2026 19:25
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updated test docs to state applications/packages use Vitest or are migrating from Jest and restored a Unit Tests subsection. API deployment schemas added a shared lease schema and a new list item type. DeploymentReaderService now derives wallet owner via wallet fetch and returns deployments as ListDeploymentsItem[], removing embedded null lease statuses.

Changes

Cohort / File(s) Summary
Documentation
.claude/instructions/general-projects-description.manual.md
Replaced a Jest-specific line with: "All applications and packages use Vitest for unit testing or are migrating from Jest." Reinserted the ### Unit Tests header and preserved existing test command blocks.
Deployment reader service
apps/api/src/deployment/services/deployment-reader/deployment-reader.service.ts
Changed wallet handling to fetch wallet by userId and use wallet.owner; adjusted deployments return type to ListDeploymentsItem[]; removed creation of status: null on leases and rely on lease objects (status now handled elsewhere).
Deployment HTTP schemas
apps/api/src/deployment/http-schemas/deployment.schema.ts
Added DeploymentLeaseSchema and DeploymentListItemSchema; tightened deployment.id to include only owner and dseq; leases now use the new lease schema and list responses use DeploymentListItemSchema; exported new type ListDeploymentsItem.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DeploymentReaderService as DR
    participant WalletService as Wallet
    participant AuthProvider as Auth
    participant ProviderAPI as Provider

    Client->>DR: request deployments list
    DR->>Wallet: getWalletByUserId(userId)
    Wallet-->>DR: wallet (owner, credentials)
    DR->>DR: map deployments → ListDeploymentsItem[]
    DR->>Auth: toProviderAuth(wallet, provider) 
    Auth-->>DR: providerAuth
    loop per lease (controlled concurrency)
        DR->>Provider: getLeaseStatus(leaseKey, providerAuth)
        Provider-->>DR: leaseStatus or error
    end
    DR-->>Client: return deployments with lease objects (status populated when available)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
I hopped through schemas, fetched a friend’s key,
Pulled owner from a wallet, tidy as can be,
I skipped the nulls and left clean leases bright,
Vitest banners flutter — what a merry sight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains a GitHub issue reference without explaining the 'Why' or 'What' of the changes according to the template structure. Complete the PR description by filling in the 'Why' section (explain the motivation for the changes) and the 'What' section (describe the specific changes made, especially any breaking changes or migrations).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: enhance deployment reader service' is directly related to the main changes in the PR, which involve refactoring the deployment reader service to use new schemas and update the list endpoint response structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/deployment-list-status

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

Copy link
Contributor

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.claude/instructions/general-projects-description.manual.md:
- Around line 90-110: The Tech Stack "Testing" bullet currently states only
"Jest" which conflicts with the migration note showing both Jest and Vitest;
update the Tech Stack "Testing" line (the existing "Testing: Jest ..." phrase)
to mention both Jest and Vitest (e.g., "Testing: Jest (legacy) and Vitest
(migrating)") so it matches the section that lists Vitest projects and Jest
projects and removes the contradiction.
🧹 Nitpick comments (1)
apps/api/src/deployment/services/deployment-reader/deployment-reader.service.ts (1)

145-175: Guard against missing provider auth to avoid noisy failures.

auth! assumes providerAuthMap has an entry. If toProviderAuth fails, each lease will throw and log a generic failure, masking the root cause. Consider short‑circuiting when auth is missing.

🛠️ Suggested guard
-        const auth = providerAuthMap.get(lease.id.provider);
-        const status = await this.providerService.getLeaseStatus(lease.id.provider, lease.id.dseq, lease.id.gseq, lease.id.oseq, auth!);
+        const auth = providerAuthMap.get(lease.id.provider);
+        if (!auth) {
+          this.logger.warn({
+            event: "LEASE_STATUS_AUTH_MISSING",
+            provider: lease.id.provider,
+            dseq: lease.id.dseq,
+            gseq: lease.id.gseq,
+            oseq: lease.id.oseq
+          });
+          statusMap.set(key, null);
+          return;
+        }
+        const status = await this.providerService.getLeaseStatus(lease.id.provider, lease.id.dseq, lease.id.gseq, lease.id.oseq, auth);
         statusMap.set(key, status);

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.09%. Comparing base (292820f) to head (b83b436).
⚠️ Report is 26 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2731      +/-   ##
==========================================
+ Coverage   51.77%   52.09%   +0.31%     
==========================================
  Files        1045     1043       -2     
  Lines       27447    27456       +9     
  Branches     6340     6340              
==========================================
+ Hits        14211    14302      +91     
+ Misses      12809    12681     -128     
- Partials      427      473      +46     
Flag Coverage Δ
api 76.91% <100.00%> (+0.24%) ⬆️
deploy-web 37.39% <ø> (+0.20%) ⬆️
log-collector 75.35% <ø> (ø)
notifications 85.56% <ø> (ø)
provider-console 81.48% <ø> (ø)
provider-proxy 82.41% <ø> (ø)
tx-signer 79.29% <ø> (ø)
Files with missing lines Coverage Δ
...i/src/deployment/http-schemas/deployment.schema.ts 100.00% <100.00%> (ø)
...ces/deployment-reader/deployment-reader.service.ts 80.00% <100.00%> (ø)

... and 55 files 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.

Copy link
Contributor

@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.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.claude/instructions/general-projects-description.manual.md:
- Line 90: Update the sentence "All applications and packages use **vitest** for
unit testing or are moving from jest." to use proper capitalization and tighter
wording: change to something like "All applications and packages use Vitest for
unit testing or are migrating from Jest." Locate the original sentence (the
phrase starting "All applications and packages...") and replace it with the
corrected capitalization and phrasing.

In
`@apps/api/src/deployment/services/deployment-reader/deployment-reader.service.ts`:
- Around line 149-165: The provider prefetch currently lets a single
toProviderAuth failure abort the entire PromisePool; wrap each call to
this.providerService.toProviderAuth inside its own try/catch in the
PromisePool.for(uniqueProviders) loop and store either the auth object or a
sentinel (null/undefined) in providerAuthMap so failures are isolated; then, in
the activeLeases PromisePool.for(activeLeases) loop, check
providerAuthMap.get(lease.id.provider) before calling
this.providerService.getLeaseStatus and if auth is missing, set
statusMap.set(key, null) (or otherwise handle as a degraded result) instead of
calling getLeaseStatus, preserving the original per-lease null-on-failure
behavior and preventing a single provider-auth error from aborting the whole
listing flow.

@baktun14 baktun14 requested a review from ygrishajev February 17, 2026 18:10
baktun14 and others added 4 commits February 17, 2026 22:50
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com>
@baktun14 baktun14 force-pushed the fix/deployment-list-status branch from 64e5b9c to c7fd772 Compare February 18, 2026 03:50
Copy link
Contributor

@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.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@apps/api/src/deployment/services/deployment-reader/deployment-reader.service.ts`:
- Around line 149-165: The prefetch of provider auth in
PromisePool.for(uniqueProviders) must guard against failures: wrap each
this.providerService.toProviderAuth({ walletId: wallet.id, provider },
["status"]) call in try-catch and on error set providerAuthMap.set(provider,
null) instead of letting the pool reject; update providerAuthMap's value type to
allow null. Then, before calling this.providerService.getLeaseStatus in the
activeLeases pool, retrieve auth from providerAuthMap and skip (or set
statusMap.set(key, null)) when auth is null/undefined instead of using the
unsafe non-null assertion auth!; ensure statusMap stores null for skipped
entries so downstream code can handle missing auth.

@github-actions github-actions bot added size: S and removed size: XS labels Feb 18, 2026
Rename DeploymentListItemSchema to DeploymentLeaseListItemSchema per
reviewer suggestion and revert auto-generated doc changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@baktun14 baktun14 added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit 8052313 Feb 19, 2026
53 of 54 checks passed
@baktun14 baktun14 deleted the fix/deployment-list-status branch February 19, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments