Skip to content

refactor: replaces direct dep on axios to injected via useServices one#1622

Merged
stalniy merged 2 commits intomainfrom
refactor/axios2
Jul 4, 2025
Merged

refactor: replaces direct dep on axios to injected via useServices one#1622
stalniy merged 2 commits intomainfrom
refactor/axios2

Conversation

@stalniy
Copy link
Contributor

@stalniy stalniy commented Jul 4, 2025

Why

It's time to fix the situation with services because it's not easy to add otel support for console related services only

Summary by CodeRabbit

  • New Features

    • Added distributed tracing headers to all outgoing HTTP requests for improved observability.
    • Introduced a managed wallet service with analytics tracking for trial starts.
    • Added a root dependency injection provider to centralize service access in the app.
  • Refactor

    • Centralized HTTP client and service access through a context provider, removing direct imports of axios and other services across the app.
    • Updated data fetching and mutation hooks to use injected services for consistency and easier testing.
    • Deprecated several legacy service exports in favor of the new service context approach.
    • Replaced direct utility calls with service proxy methods for deployment manifest handling.
    • Simplified API calls by removing standalone helper functions and inlining requests using injected services.
    • Updated mutation and query hooks to accept options objects for better extensibility.
    • Removed legacy hooks and consolidated service usage under a unified context provider.
    • Refactored provider proxy service for improved manifest sending with retry logic.
    • Modified template-related hooks to use service context and updated mutation signatures for better callback handling.
    • Updated tests to use explicit dependency injection for service mocking, improving test isolation and reliability.
  • Bug Fixes

    • Prevented network initialization from running in test environments.
  • Tests

    • Added or updated tests for new and refactored hooks and services.
    • Added new test suites covering settings saving and deposit parameters hooks.
    • Modernized tests to use strongly typed mocks and remove global mocks for better clarity.
    • Wrapped asynchronous event handler calls in tests with React Testing Library's act for proper state update handling.
  • Chores

    • Improved code style and consistency in type usage and imports.
    • Added deprecation notices to legacy service exports.

@stalniy stalniy requested a review from a team as a code owner July 4, 2025 05:55
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 4, 2025

Walkthrough

This change refactors the application's service architecture to centralize HTTP client and service access through a dependency injection container, exposed via new React context providers. All direct imports of HTTP clients, utility functions, or singleton services are replaced with context-based service retrieval using hooks like useServices() or useRootContainer(). OpenTelemetry tracing is integrated across HTTP requests, and new service factories and context providers are introduced to support this pattern.

Changes

File(s) / Path(s) Change Summary
src/context/ServicesProvider/RootContainerProvider.tsx, ServicesContext.ts Added new context provider and context for root dependency injection container. Exports RootContainerProvider and useRootContainer for DI usage.
src/context/ServicesProvider/ServicesProvider.tsx Refactored to use external ServicesContext, updated service factories, and removed direct context creation. Now creates containers with new service factories and uses explicit typing.
src/pages/_app.tsx Wrapped the app in the new RootContainerProvider at the top level.
src/context/SettingsProvider/SettingsProviderContext.tsx, src/components/... Replaced all direct axios/service imports with retrieval from useServices() or useRootContainer(). Updated hooks and components to use injected services.
src/services/http-factory/http-factory.service.ts, http-browser.service.ts, http-server.service.ts Added OpenTelemetry tracing interceptor to all HTTP services. Introduced managedWalletService and new service config options. Deprecated direct exports of some singleton services.
src/services/managed-wallet-http/managed-wallet-http.service.ts Refactored to export the class, require injected analytics and config, and removed singleton export.
src/services/provider-proxy/provider-proxy.service.ts Refactored to accept an injected axios instance and logger. Added a new sendManifest method with retry logic and logging.
src/services/api-url/browser-api-url.service.ts, server-api-url.service.ts Added deprecation JSDoc comments, recommending use of useServices() instead.
src/utils/apiUtils.ts Changed loadWithPagination to require an AxiosInstance parameter instead of defaulting to global axios.
src/utils/deploymentUtils.ts Removed the exported sendManifestToProvider function.
src/utils/otel.ts Added a new utility function to generate W3C traceparent headers for distributed tracing.
src/queries/*, src/hooks/*, src/components/* Refactored all React Query hooks and components to obtain HTTP clients and services via useServices() context. Updated function signatures and removed direct axios/service imports.
src/queries/useSettings.spec.tsx, src/hooks/useAuthZService.tsx Deleted test and hook files that are now obsolete due to service centralization.
src/queries/useSaveSettings.spec.tsx Added new tests for useSaveSettings and useDepositParams using the new service injection pattern.
src/queries/useGrantsQuery.spec.tsx, useLeaseQuery.spec.tsx, useMarketData.spec.tsx, useManagedWalletQuery.spec.tsx, usePaymentQueries.spec.tsx, useStripePricesQuery.spec.tsx Refactored all tests to use dependency injection for services via test helpers, removing global mocks and improving test isolation.
tests/unit/query-client.tsx Refactored test helpers to support service injection and per-test QueryClient instantiation.
src/services/wallet-balances/wallet-balances.service.ts, .spec.ts Updated to use AxiosInstance type for injected HTTP client.
src/queries/useBidQuery.ts, useDeploymentQuery.ts, useLeaseQuery.ts, useGrantsQuery.ts, useProvidersQuery.ts, useGpuQuery.ts, useMarketData.ts, useSaveSettings.ts, useTemplateQuery.tsx Refactored all hooks to accept injected Axios clients/services from context, updated function signatures, and removed direct axios imports.
src/components/sdl/EditDescriptionForm.tsx, SimpleSdlBuilderForm.tsx, user/UserSettingsForm.tsx Updated to use injected axios from useServices() instead of direct import.
src/components/deployments/LeaseRow.tsx, ManifestUpdate.tsx, new-deployment/CreateLease.tsx Updated manifest sending logic to use providerProxy service from context.
src/components/turnstile/Turnstile.tsx Updated to use managed wallet service from context.
src/components/sdl/RentGpusForm.tsx, new-deployment/ManifestEdit.tsx, context/ChainParamProvider/ChainParamProvider.tsx Updated import path for useDepositParams hook.
packages/network-store/src/network.store.ts Prevented network initialization in test environments.
tests/seeders/provider.ts Added a blank line after import (no functional change).

Sequence Diagram(s)

sequenceDiagram
    participant App as AppRoot
    participant RootProvider as RootContainerProvider
    participant ServicesProvider
    participant Component as AnyComponentOrHook
    participant Service as ServiceInstance (e.g. axios, providerProxy)
    App->>RootProvider: Wrap entire app in RootContainerProvider
    RootProvider->>ServicesProvider: Provide DI container with services
    ServicesProvider->>Component: useServices() hook provides services
    Component->>Service: Use injected service (e.g. axios, providerProxy)
    Service->>External: Make HTTP request (with OTel tracing)
Loading
sequenceDiagram
    participant Component
    participant ProviderProxy
    participant Provider
    Component->>ProviderProxy: sendManifest(provider, manifest, options)
    ProviderProxy->>Provider: PUT /deployment/manifest with manifest (with retries and tracing)
    Provider-->>ProviderProxy: Response
    ProviderProxy-->>Component: Response
Loading

Possibly related PRs

Suggested reviewers

  • ygrishajev
  • baktun14

Poem

In the warren of code, where services hop,
A rabbit refactored, from bottom to top.
No more direct imports—just context delight,
With tracing and DI, requests take flight!
Now every component, with services near,
Can hop to new features—no bugs to fear!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-07-04T10_57_49_746Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

Attention: Patch coverage is 41.31455% with 125 lines in your changes missing coverage. Please review.

Project coverage is 43.12%. Comparing base (b03336b) to head (19aeece).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../services/provider-proxy/provider-proxy.service.ts 4.34% 19 Missing and 3 partials ⚠️
apps/deploy-web/src/queries/useProvidersQuery.ts 14.28% 12 Missing ⚠️
apps/deploy-web/src/queries/useDeploymentQuery.ts 0.00% 10 Missing ⚠️
.../src/services/http-factory/http-factory.service.ts 33.33% 10 Missing ⚠️
apps/deploy-web/src/queries/useBidQuery.ts 0.00% 9 Missing ⚠️
...eploy-web/src/components/sdl/SaveTemplateModal.tsx 0.00% 8 Missing ⚠️
apps/deploy-web/src/queries/useBlocksQuery.ts 0.00% 5 Missing ⚠️
...deploy-web/src/components/deployments/LeaseRow.tsx 0.00% 4 Missing ⚠️
apps/deploy-web/src/utils/otel.ts 0.00% 4 Missing ⚠️
...-web/src/components/deployments/ManifestUpdate.tsx 0.00% 3 Missing ⚠️
... and 19 more

❌ Your patch status has failed because the patch coverage (41.31%) 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    #1622      +/-   ##
==========================================
+ Coverage   42.84%   43.12%   +0.27%     
==========================================
  Files         880      882       +2     
  Lines       21667    21661       -6     
  Branches     3973     3981       +8     
==========================================
+ Hits         9284     9342      +58     
+ Misses      12087    11619     -468     
- Partials      296      700     +404     
Flag Coverage Δ *Carryforward flag
api 76.64% <ø> (ø) Carriedforward from b03336b
deploy-web 19.62% <41.31%> (+0.45%) ⬆️
notifications 87.90% <ø> (ø) Carriedforward from b03336b
provider-proxy 83.03% <ø> (ø) Carriedforward from b03336b

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

Files with missing lines Coverage Δ
.../deploy-web/src/components/turnstile/Turnstile.tsx 91.54% <100.00%> (-0.12%) ⬇️
.../context/ChainParamProvider/ChainParamProvider.tsx 45.00% <100.00%> (ø)
apps/deploy-web/src/queries/useGrantsQuery.ts 100.00% <100.00%> (ø)
apps/deploy-web/src/queries/useLeaseQuery.ts 97.72% <100.00%> (-0.10%) ⬇️
...ps/deploy-web/src/queries/useManagedWalletQuery.ts 94.44% <100.00%> (+0.69%) ⬆️
apps/deploy-web/src/queries/useMarketData.ts 100.00% <100.00%> (ø)
apps/deploy-web/src/queries/useSaveSettings.ts 100.00% <100.00%> (ø)
...pps/deploy-web/src/queries/useStripePricesQuery.ts 100.00% <100.00%> (ø)
apps/deploy-web/src/queries/useTemplateQuery.tsx 97.29% <100.00%> (+97.29%) ⬆️
...eb/src/services/api-url/browser-api-url.service.ts 100.00% <ø> (ø)
... and 34 more

... and 122 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 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: 7

♻️ Duplicate comments (1)
apps/deploy-web/src/queries/useManagedWalletQuery.ts (1)

4-4: Same import path inconsistency detected.

This file also imports from the longer path. Please ensure consistency with the import pattern used in other files.

🧹 Nitpick comments (7)
apps/deploy-web/src/components/sdl/RentGpusForm.tsx (1)

52-57: Rename setter to match the state value.
setIsQuertInit contains a typo (Quert). Keeping the misspelling increases cognitive load and will trip up future greps/renames.

-const [isQueryInit, setIsQuertInit] = useState(false);
+const [isQueryInit, setIsQueryInit] = useState(false);
apps/deploy-web/src/components/turnstile/Turnstile.tsx (1)

28-34: Prefer undefined over null for optional interceptor arg.
axios.interceptors.response.use expects undefined | ((res) => …) for the first parameter; passing null widens to any and defeats typings.

-const interceptorId = service.interceptors.response.use(null, error => intercept(service, error));
+const interceptorId = service.interceptors.response.use(undefined, error => intercept(service, error));
apps/deploy-web/tests/seeders/provider.ts (1)

4-6: Remove stray blank line
The extra newline after imports is not consistent with the repo’s style.

apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)

35-35: Consider making wait times configurable.

The hard-coded wait times (5-6 seconds) might not be optimal for all scenarios. Consider making these configurable through options or implementing a more intelligent polling mechanism.

+interface SendManifestConfig {
+  initialWaitMs?: number;
+  retryWaitMs?: number;
+  finalWaitMs?: number;
+  maxRetries?: number;
+}

-async sendManifest(providerInfo: ApiProviderList | undefined | null, manifest: unknown, options: SendManifestToProviderOptions) {
+async sendManifest(providerInfo: ApiProviderList | undefined | null, manifest: unknown, options: SendManifestToProviderOptions, config: SendManifestConfig = {}) {
+  const { initialWaitMs = 5000, retryWaitMs = 6000, finalWaitMs = 5000, maxRetries = 3 } = config;
   // ... 
-  await wait(5000);
+  await wait(initialWaitMs);
   // ...
-  for (let i = 1; i <= 3 && !response; i++) {
+  for (let i = 1; i <= maxRetries && !response; i++) {
     // ...
-    await wait(6000);
+    await wait(retryWaitMs);
   // ...
-  await wait(5000);
+  await wait(finalWaitMs);

Also applies to: 56-56, 64-64

apps/deploy-web/src/queries/useDeploymentQuery.ts (1)

31-31: Improve the baseURL validation check.

The check !chainApiHttpClient.defaults.baseURL will pass for empty strings, which might not be the intended behavior. Consider checking for a meaningful base URL.

-  if (!address || !chainApiHttpClient.defaults.baseURL) return null;
+  if (!address || !chainApiHttpClient.defaults.baseURL?.trim()) return null;
apps/deploy-web/src/services/http-factory/http-factory.service.ts (2)

73-92: Complex managed wallet service factory could be simplified.

The managedWalletService factory has nested interceptors and complex analytics logic. Consider extracting the response interceptor to a separate function for better readability.

+const createTrialAnalyticsInterceptor = (analyticsService: any) => (response: AxiosResponse) => {
+  if (response.config.url === "v1/start-trial" && response.config.method === "post" && response.status === 200) {
+    analyticsService.track("trial_started", { category: "billing", label: "Trial Started" });
+  }
+  return response;
+};

 managedWalletService: () =>
   withInterceptors(
     new ManagedWalletHttpService(
       {
         baseURL: container.apiUrlService.getBaseApiUrlFor(config.MANAGED_WALLET_NETWORK_ID)
       },
       container.analyticsService
     ),
     {
       request: [config.globalRequestMiddleware, authService.withAnonymousUserHeader, otelInterceptor],
-      response: [
-        response => {
-          if (response.config.url === "v1/start-trial" && response.config.method === "post" && response.status === 200) {
-            container.analyticsService.track("trial_started", { category: "billing", label: "Trial Started" });
-          }
-          return response;
-        }
-      ]
+      response: [createTrialAnalyticsInterceptor(container.analyticsService)]
     }
   )

85-85: Hardcoded URL string should be extracted to constant.

The URL string "v1/start-trial" is hardcoded in the analytics interceptor. Consider extracting it to a constant for better maintainability.

+const TRIAL_START_ENDPOINT = "v1/start-trial";

-            if (response.config.url === "v1/start-trial" && response.config.method === "post" && response.status === 200) {
+            if (response.config.url === TRIAL_START_ENDPOINT && response.config.method === "post" && response.status === 200) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 913c384 and 8222b29.

📒 Files selected for processing (54)
  • apps/deploy-web/src/components/deployments/LeaseRow.tsx (4 hunks)
  • apps/deploy-web/src/components/deployments/ManifestUpdate.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/sdl/EditDescriptionForm.tsx (2 hunks)
  • apps/deploy-web/src/components/sdl/RentGpusForm.tsx (1 hunks)
  • apps/deploy-web/src/components/sdl/SimpleSdlBuilderForm.tsx (2 hunks)
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx (1 hunks)
  • apps/deploy-web/src/components/user/UserSettingsForm.tsx (2 hunks)
  • apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/ServicesContext.ts (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (2 hunks)
  • apps/deploy-web/src/hooks/useAuthZService.tsx (0 hunks)
  • apps/deploy-web/src/pages/_app.tsx (2 hunks)
  • apps/deploy-web/src/queries/deploymentSettingsQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/featureFlags.ts (1 hunks)
  • apps/deploy-web/src/queries/useBidQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useBlocksQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useDeploymentQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useExactDeploymentGrantsQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useGpuQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.ts (3 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.ts (4 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useMarketData.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useMarketData.ts (1 hunks)
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx (3 hunks)
  • apps/deploy-web/src/queries/useProvidersQuery.ts (4 hunks)
  • apps/deploy-web/src/queries/useSaveSettings.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useSaveSettings.ts (2 hunks)
  • apps/deploy-web/src/queries/useSettings.spec.tsx (0 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useTemplateQuery.tsx (4 hunks)
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts (5 hunks)
  • apps/deploy-web/src/services/http/http-browser.service.ts (1 hunks)
  • apps/deploy-web/src/services/http/http-server.service.ts (1 hunks)
  • apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2 hunks)
  • apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2 hunks)
  • apps/deploy-web/src/utils/apiUtils.ts (2 hunks)
  • apps/deploy-web/src/utils/deploymentUtils.ts (0 hunks)
  • apps/deploy-web/src/utils/otel.ts (1 hunks)
  • apps/deploy-web/tests/seeders/provider.ts (1 hunks)
  • apps/deploy-web/tests/unit/query-client.tsx (1 hunks)
  • packages/network-store/src/network.store.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • apps/deploy-web/src/hooks/useAuthZService.tsx
  • apps/deploy-web/src/utils/deploymentUtils.ts
  • apps/deploy-web/src/queries/useSettings.spec.tsx
🧰 Additional context used
📓 Path-based instructions (2)
`apps/{deploy-web,provider-console}/**/*.spec.tsx`: Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files

apps/{deploy-web,provider-console}/**/*.spec.tsx: Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

📄 Source: CodeRabbit Inference Engine (.cursor/rules/query-by-in-tests.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx
  • apps/deploy-web/src/queries/useSaveSettings.spec.tsx
  • apps/deploy-web/src/queries/useMarketData.spec.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
`**/*.spec.{ts,tsx}`: Use `setup` function instead of `beforeEach` in test files...

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

📄 Source: CodeRabbit Inference Engine (.cursor/rules/setup-instead-of-before-each.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx
  • apps/deploy-web/src/queries/useSaveSettings.spec.tsx
  • apps/deploy-web/src/queries/useMarketData.spec.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
🧠 Learnings (45)
📓 Common learnings
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/tests/seeders/provider.ts (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/components/sdl/RentGpusForm.tsx (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
packages/network-store/src/network.store.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (2)
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/pages/_app.tsx (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/components/sdl/SimpleSdlBuilderForm.tsx (4)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: ygrishajev
PR: akash-network/console#1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/components/deployments/LeaseRow.tsx (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/queries/deploymentSettingsQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/services/api-url/server-api-url.service.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/utils/apiUtils.ts (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/queries/featureFlags.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useStripePricesQuery.ts (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (3)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
apps/deploy-web/src/components/new-deployment/CreateLease.tsx (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/components/sdl/EditDescriptionForm.tsx (4)
Learnt from: baktun14
PR: akash-network/console#1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: ygrishajev
PR: akash-network/console#1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
apps/deploy-web/src/components/user/UserSettingsForm.tsx (5)
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: ygrishajev
PR: akash-network/console#1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
apps/deploy-web/src/queries/useExactDeploymentGrantsQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/queries/useMarketData.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/components/deployments/ManifestUpdate.tsx (3)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/queries/useManagedWalletQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/usePaymentQueries.spec.tsx (6)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
apps/deploy-web/src/queries/useGpuQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx (4)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx (5)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: stalniy
PR: akash-network/console#1436
File: apps/api/src/provider/repositories/provider/provider.repository.ts:79-90
Timestamp: 2025-06-08T03:07:13.871Z
Learning: The getProvidersHostUriByAttributes method in apps/api/src/provider/repositories/provider/provider.repository.ts already has comprehensive test coverage in provider.repository.spec.ts, including tests for complex HAVING clause logic with COUNT(*) FILTER (WHERE ...) syntax, signature conditions (anyOf/allOf), and glob pattern matching.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
apps/deploy-web/src/queries/useSaveSettings.spec.tsx (7)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function must be at the bottom of the root `describe` block
apps/deploy-web/src/queries/useSaveSettings.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (1)
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useTemplateQuery.tsx (3)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: jzsfkzm
PR: akash-network/console#1498
File: apps/api/src/services/external/templates/template-fetcher.service.ts:0-0
Timestamp: 2025-07-03T14:40:49.886Z
Learning: In the TemplateFetcherService class in apps/api/src/services/external/templates/template-fetcher.service.ts, the error handling strategy should maintain process resilience by catching all errors and returning null rather than re-throwing critical errors, to avoid breaking the whole template fetching process.
apps/deploy-web/src/queries/useMarketData.spec.tsx (7)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (8)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: stalniy
PR: akash-network/console#1436
File: apps/api/src/provider/repositories/provider/provider.repository.ts:79-90
Timestamp: 2025-06-08T03:07:13.871Z
Learning: The getProvidersHostUriByAttributes method in apps/api/src/provider/repositories/provider/provider.repository.ts already has comprehensive test coverage in provider.repository.spec.ts, including tests for complex HAVING clause logic with COUNT(*) FILTER (WHERE ...) syntax, signature conditions (anyOf/allOf), and glob pattern matching.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
apps/deploy-web/tests/unit/query-client.tsx (6)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (6)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: stalniy
PR: akash-network/console#1436
File: apps/api/src/provider/repositories/provider/provider.repository.ts:79-90
Timestamp: 2025-06-08T03:07:13.871Z
Learning: The getProvidersHostUriByAttributes method in apps/api/src/provider/repositories/provider/provider.repository.ts already has comprehensive test coverage in provider.repository.spec.ts, including tests for complex HAVING clause logic with COUNT(*) FILTER (WHERE ...) syntax, signature conditions (anyOf/allOf), and glob pattern matching.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
apps/deploy-web/src/queries/useGrantsQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/queries/useBidQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useProvidersQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useBlocksQuery.ts (3)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
apps/deploy-web/src/queries/useDeploymentQuery.ts (3)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useLeaseQuery.ts (2)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: baktun14
PR: akash-network/console#1428
File: apps/api/src/deployment/controllers/deployment/deployment.controller.ts:0-0
Timestamp: 2025-06-03T15:06:34.211Z
Learning: The `getByOwnerAndDseq` method in `apps/api/src/deployment/controllers/deployment/deployment.controller.ts` is intentionally public without the `@Protected` decorator because it serves public blockchain data from an indexer, following the pattern of public blockchain APIs.
🧬 Code Graph Analysis (19)
apps/deploy-web/src/components/turnstile/Turnstile.tsx (1)
apps/deploy-web/src/services/http/http-browser.service.ts (1)
  • services (5-10)
apps/deploy-web/src/components/sdl/SimpleSdlBuilderForm.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/services/http/http-server.service.ts (3)
apps/deploy-web/src/services/http-factory/http-factory.service.ts (1)
  • createServices (17-96)
apps/deploy-web/src/services/client-ip-forwarding/client-ip-forwarding.interceptor.ts (1)
  • clientIpForwardingInterceptor (6-20)
apps/deploy-web/src/services/api-url/server-api-url.service.ts (1)
  • serverApiUrlService (5-5)
apps/deploy-web/src/queries/featureFlags.ts (2)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/queries/queryKeys.ts (1)
  • QueryKeys (1-84)
apps/deploy-web/src/queries/useStripePricesQuery.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)
apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (1)
  • useRootContainer (17-19)
apps/deploy-web/src/components/new-deployment/CreateLease.tsx (2)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/indexer/drizzle/schema.ts (1)
  • provider (205-237)
apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts (2)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/queries/queryKeys.ts (1)
  • QueryKeys (1-84)
apps/deploy-web/src/components/sdl/EditDescriptionForm.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/components/user/UserSettingsForm.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/queries/useMarketData.ts (2)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/utils/apiUtils.ts (1)
  • ApiUrlService (7-126)
apps/deploy-web/src/components/deployments/ManifestUpdate.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (3)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • Props (16-19)
apps/deploy-web/src/context/ServicesProvider/ServicesContext.ts (2)
  • RootContainer (5-5)
  • ServicesContext (8-17)
apps/deploy-web/src/services/container/createContainer.ts (1)
  • DIContainer (36-38)
apps/deploy-web/src/services/http/http-browser.service.ts (2)
apps/deploy-web/src/services/http-factory/http-factory.service.ts (1)
  • createServices (17-96)
apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1)
  • browserApiUrlService (5-5)
apps/deploy-web/src/queries/useSaveSettings.ts (2)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/utils/apiUtils.ts (2)
  • ApiUrlService (7-126)
  • depositParams (8-10)
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2)
packages/http-sdk/src/managed-wallet-http/managed-wallet-http.service.ts (1)
  • ManagedWalletHttpService (11-29)
apps/deploy-web/src/services/analytics/analytics.service.ts (2)
  • analyticsService (257-274)
  • AnalyticsService (124-249)
apps/deploy-web/src/queries/useBidQuery.ts (3)
apps/deploy-web/src/utils/apiUtils.ts (1)
  • ApiUrlService (7-126)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/queries/queryKeys.ts (1)
  • QueryKeys (1-84)
apps/deploy-web/src/queries/useBlocksQuery.ts (2)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/utils/apiUtils.ts (1)
  • ApiUrlService (7-126)
apps/deploy-web/src/queries/useDeploymentQuery.ts (4)
apps/deploy-web/src/utils/apiUtils.ts (2)
  • loadWithPagination (130-158)
  • ApiUrlService (7-126)
apps/deploy-web/src/utils/deploymentDetailUtils.ts (1)
  • deploymentToDto (19-44)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (31-33)
apps/deploy-web/src/queries/queryKeys.ts (1)
  • QueryKeys (1-84)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (76)
packages/network-store/src/network.store.ts (1)

112-112: LGTM! Good addition for test environment isolation.

The added check for process.env.NODE_ENV === "test" correctly prevents network initialization during tests, which is essential for avoiding unwanted HTTP requests and side effects in test environments. The defensive typeof process !== "undefined" check is also good practice for cross-environment compatibility.

This change aligns well with the PR objectives of improving testability and service refactoring.

apps/deploy-web/src/components/sdl/RentGpusForm.tsx (1)

19-20: Import looks correct – nothing else to do here.
Path change complies with the new query-hook location.

apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx (1)

7-9: Import update LGTM
The hook was migrated; import path is now correct.

apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1)

24-26: Import update LGTM
Matches the new module location; no additional changes required.

apps/deploy-web/src/components/turnstile/Turnstile.tsx (1)

16-24: Verify all listed services exist on the services object.
services.deploymentSetting (and the others) must be present in the factory returned by createServices. If the key is misspelled the interceptor setup will throw at runtime.

Run a quick compile or search to confirm the property names.

apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (1)

7-7: LGTM! Clean import optimization.

The change from importing the entire axios module to just the isAxiosError utility function is well-executed. This reduces the import footprint since this file only needs the type guard function for error handling, not the full HTTP client.

Also applies to: 253-253

apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (1)

12-12: RootContainerProvider is correctly set up

The RootContainerProvider wraps the application in
apps/deploy-web/src/pages/_app.tsx, so the injected HTTP client (and any other services) will be available to SettingsProvider. There are no remaining direct axios imports in the SettingsProvider file.

LGTM!

apps/deploy-web/src/queries/deploymentSettingsQuery.ts (1)

4-4: LGTM! Improved error handling pattern.

The change from instanceof AxiosError to isAxiosError(error) is the recommended approach for axios error detection. This is more reliable and consistent with the broader refactor pattern.

Also applies to: 29-29

apps/deploy-web/src/components/sdl/EditDescriptionForm.tsx (1)

10-10: LGTM! Consistent service injection pattern.

The component correctly adopts the dependency injection pattern by using useServices() to obtain the axios instance. This aligns with the architectural refactor and enables centralized HTTP client configuration.

Also applies to: 30-30

apps/deploy-web/src/queries/featureFlags.ts (2)

13-13: LGTM: Service injection refactor implemented correctly.

The change from destructuring browserApiUrlService to apiUrlService from useServices() aligns with the broader refactor to centralize service management via dependency injection.


18-18: Consistent parameter update for service injection.

The function call correctly uses the new apiUrlService parameter, maintaining consistency with the service retrieval change above.

apps/deploy-web/src/services/api-url/server-api-url.service.ts (1)

4-4: Well-structured deprecation notice.

The JSDoc deprecation comment clearly indicates the migration path and follows best practices for deprecating exported services.

apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1)

4-4: Consistent deprecation notice.

The deprecation comment matches the pattern used in server-api-url.service.ts and provides clear guidance for migrating to the new service injection approach.

apps/deploy-web/src/pages/_app.tsx (2)

36-36: Essential import for service injection architecture.

The RootContainerProvider import is required to support the new dependency injection pattern used throughout the application.


103-133: Correctly positioned root container provider.

The RootContainerProvider is properly positioned as the outermost wrapper, ensuring all components in the provider tree have access to the service dependency injection context. This enables the useServices() hook to function throughout the application.

apps/deploy-web/src/queries/useStripePricesQuery.ts (2)

3-3: Appropriate import for service injection pattern.

The addition of useServices import enables the hook to access services via the dependency injection context.


6-6: Consistent service retrieval pattern.

The change from direct stripeService import to destructuring from useServices() follows the same pattern used in other query files like featureFlags.ts, maintaining consistency across the codebase refactor.

apps/deploy-web/src/utils/otel.ts (1)

1-6: LGTM! Correct W3C Trace Context implementation.

The function properly generates a compliant W3C Trace Context traceparent string with cryptographically secure random IDs and correct formatting.

apps/deploy-web/src/components/user/UserSettingsForm.tsx (2)

13-14: LGTM! Proper adoption of service injection pattern.

The imports correctly transition from direct axios usage to the centralized services context, aligning with the OpenTelemetry integration goals.


33-33: LGTM! Correct service destructuring.

The axios instance is properly obtained from the services context, maintaining the same functionality while enabling centralized HTTP client management.

apps/deploy-web/src/utils/apiUtils.ts (2)

1-1: LGTM! Improved type specificity.

The change from Axios to AxiosInstance type import provides better type safety and aligns with the dependency injection pattern.


130-130: LGTM! Function signature updated for dependency injection.

The parameter type change to AxiosInstance correctly supports the new pattern where HTTP clients are injected rather than imported directly.

apps/deploy-web/src/components/deployments/LeaseRow.tsx (3)

21-21: LGTM! Adopting centralized service access.

The import correctly transitions to the service injection pattern for accessing HTTP utilities.


55-55: LGTM! Proper service destructuring.

The providerProxy service is correctly obtained from the services context.


123-123: LGTM! Service method replaces utility function.

The transition from sendManifestToProvider utility to providerProxy.sendManifest service method maintains the same functionality while enabling centralized service management and OpenTelemetry integration.

apps/deploy-web/src/services/http/http-server.service.ts (2)

3-3: LGTM! Adding API URL service import.

The serverApiUrlService import enables centralized API URL management within the dependency injection container.


9-12: LGTM! Service configuration enhancements.

The additions of MANAGED_WALLET_NETWORK_ID and apiUrlService correctly extend the service configuration to support managed wallet functionality and centralized API URL management, aligning with the OpenTelemetry integration goals.

apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts (1)

3-3: LGTM! Clean migration to centralized service injection.

The refactor successfully replaces direct service imports with the useServices context pattern. This improves dependency injection, testability, and follows SOLID principles while maintaining the same external API and functionality.

Also applies to: 7-7, 10-10

apps/deploy-web/src/components/new-deployment/CreateLease.tsx (1)

29-29: LGTM! Successful migration to service-based manifest sending.

The component now properly uses the injected providerProxy service instead of the standalone utility function. The method call maintains the same parameters and the useCallback dependency array is correctly updated.

Also applies to: 70-70, 163-163

apps/deploy-web/src/components/deployments/ManifestUpdate.tsx (1)

13-13: LGTM! Consistent service injection pattern applied.

The component follows the same refactoring pattern as other components, replacing direct utility imports with service injection via useServices. The error handling and method signature remain unchanged.

Also applies to: 46-46, 129-129

apps/deploy-web/src/queries/useExactDeploymentGrantsQuery.ts (1)

7-7: LGTM! Query refactored to use service injection.

The service extraction and method call follow the established pattern. The query functionality remains equivalent to the previous implementation.

Also applies to: 11-11

apps/deploy-web/src/queries/useManagedWalletQuery.ts (1)

9-9: LGTM! Both query and mutation properly refactored.

The hook correctly extracts managedWalletService from the services context and both the query and mutation functions maintain their original functionality while using the new service injection pattern.

Also applies to: 14-14, 24-24, 27-27

apps/deploy-web/src/context/ServicesProvider/ServicesContext.ts (1)

1-17: Well-designed dependency injection context with helpful error handling.

The Proxy-based default value cleverly catches missing provider wrapping at development time with a clear, actionable error message. The implementation follows React context best practices and maintains type safety.

apps/deploy-web/src/queries/useMarketData.ts (2)

4-4: Properly implements dependency injection pattern.

The import of useServices hook aligns with the refactoring to centralize service access via React context.


10-13: Clean refactoring from direct axios import to dependency injection.

The inline arrow function approach is more concise than the previous standalone function, while maintaining the same behavior and type safety.

apps/deploy-web/src/services/http/http-browser.service.ts (1)

7-9: Properly extends service configuration for new capabilities.

The addition of BASE_PROVIDER_PROXY_URL, MANAGED_WALLET_NETWORK_ID, and apiUrlService aligns with the dependency injection refactoring and supports the new managed wallet and provider proxy services.

apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx (3)

1-3: Improved test setup with explicit service mocking.

The migration from global mocks to explicit service injection using jest-mock-extended improves test isolation and type safety.


15-20: Proper service injection pattern for tests.

The setupQuery helper with services injection follows the established pattern and maintains test isolation by creating fresh mocks for each test.


30-34: Consistent mocking pattern across test cases.

Each test case creates its own mock instance, ensuring test isolation and preventing side effects between tests.

apps/deploy-web/src/queries/useGpuQuery.ts (2)

3-3: Consistent dependency injection implementation.

The import of useServices follows the same pattern established across other query hooks in this refactoring.


9-12: Clean refactoring maintains existing behavior.

The inline arrow function approach is consistent with the refactoring pattern while preserving the same query functionality and type safety.

apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (1)

17-19: LGTM!

The useRootContainer hook implementation is correct and follows React patterns properly.

apps/deploy-web/src/queries/usePaymentQueries.spec.tsx (1)

1-183: LGTM! Excellent refactoring to typed mocks.

The refactoring successfully:

  • Replaces global mocks with scoped, typed mocks using jest-mock-extended
  • Uses dependency injection through setupQuery services option
  • Improves test isolation by avoiding shared state
  • Maintains all existing test logic and assertions

This change aligns perfectly with the PR objectives of centralizing service access and improving testability.

apps/deploy-web/src/queries/useSaveSettings.ts (3)

12-28: LGTM! Good refactoring to use services context.

The refactoring successfully replaces direct axios import with the axios instance from the services context, maintaining the same functionality while improving dependency injection.


36-43: LGTM! Proper service injection implementation.

The refactoring correctly replaces direct service usage with the chainApiHttpClient from the services context.


30-34: Action Required: Confirm proper API endpoint usage in getDepositParams

It looks like calling

ApiUrlService.depositParams("")

will produce a path starting with /cosmos/…—which only works if the passed AxiosInstance already has its baseURL set to the chain’s API root. Please verify:

  • That chainApiHttpClient is instantiated with a baseURL pointing to the chain endpoint (e.g. https://…), so calling .get("/cosmos/…") is correct.
  • If not, replace "" with the actual API URL, for example networkStore.apiEndpoint, to avoid sending requests to the wrong host.

Locations to check/fix:
• apps/deploy-web/src/queries/useSaveSettings.ts → getDepositParams(chainApiHttpClient)
• Apps’ HTTP client creation (where chainApiHttpClient is configured) to ensure baseURL is set.

apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (1)

1-186: LGTM! Consistent refactoring to dependency injection pattern.

The refactoring successfully:

  • Replaces global mocks with scoped, typed mocks using jest-mock-extended
  • Uses explicit service injection through setupQuery
  • Maintains all test logic while improving isolation
  • Follows the same patterns established in other test files

This change enhances test reliability and aligns with the PR's service centralization objectives.

apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx (1)

1-77: LGTM! Well-structured refactoring to typed mocks.

The refactoring successfully:

  • Migrates from direct service imports to dependency injection
  • Uses jest-mock-extended for type-safe mocking
  • Maintains comprehensive test coverage for both query and mutation scenarios
  • Follows the established patterns from other test files in this PR

This change improves test isolation and aligns with the service centralization objectives.

apps/deploy-web/src/queries/useTemplateQuery.tsx (2)

17-23: LGTM! Consistent refactoring to centralized services.

The refactoring of these query hooks to use the centralized axios instance from useServices() is implemented correctly. The API endpoints and response handling remain unchanged.

Also applies to: 27-33, 36-43


48-72: LGTM! Template mutation hooks properly refactored.

All mutation hooks correctly use the centralized axios instance from useServices(). The API endpoints and mutation logic remain unchanged.

Also applies to: 77-89, 93-101, 105-113

apps/deploy-web/src/queries/useGrantsQuery.ts (2)

20-20: Good improvement on enable conditions.

Checking service.defaults.baseURL is more direct and reliable than checking settings, as it verifies the HTTP client is properly configured.

Also applies to: 32-32, 50-50, 66-66


59-61: LoadWithPagination usage is correct

ApiUrlService.allowancesGranted("", address) returns the relative path
/cosmos/feegrant/v1beta1/allowances/{address}, and passing that into
loadWithPagination(..., chainApiHttpClient) works as intended when the
provided Axios instance has its baseURL configured. This mirrors the
existing usage in useDeploymentQuery and useLeaseQuery, so no changes are needed.

apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)

7-12: Good refactoring to dependency injection pattern.

The change from inheritance to composition with injected dependencies improves testability and follows SOLID principles.

apps/deploy-web/src/queries/useBlocksQuery.ts (1)

10-20: LGTM! Clean refactoring to centralized services.

The hooks correctly use the centralized HTTP clients from useServices(). The empty string passed to ApiUrlService.block() is appropriate since the base URL is configured on the axios instance.

Also applies to: 23-29

apps/deploy-web/tests/unit/query-client.tsx (1)

10-41: Excellent test setup refactoring!

The refactored setupQuery function properly supports service injection through the ServicesProvider, aligning with the new architecture. The wrapper composition pattern is clean and flexible.

apps/deploy-web/src/queries/useBidQuery.ts (4)

10-13: LGTM! Dependency injection pattern correctly implemented.

The refactor properly replaces the API endpoint string with an injected Axios instance, aligning with the centralized service access pattern.


29-34: Hook correctly uses centralized service context.

The update properly obtains the chainApiHttpClient from the useServices hook and passes it to the getBidList function.


39-42: Consistent refactoring pattern applied.


47-51: Consistent hook refactoring.

apps/deploy-web/src/queries/useSaveSettings.spec.tsx (2)

14-72: Well-structured tests following coding guidelines.

The test suite correctly:

  • Uses setup function at the bottom of the describe block
  • Accepts a single parameter with inline type definition
  • Doesn't specify return type
  • Tests both success and error scenarios with appropriate assertions

74-117: Comprehensive test coverage for deposit params hook.

Tests properly cover both success and error scenarios with appropriate mocking of the chain API HTTP client.

apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2)

7-14: Proper dependency injection implementation.

The service correctly accepts AnalyticsService as a constructor parameter, removing reliance on global instances and enabling better testability and modularity.


27-27: Consistent use of injected analytics service.

Also applies to: 32-32

apps/deploy-web/src/queries/useMarketData.spec.tsx (1)

11-75: Test refactoring follows best practices.

The test suite correctly:

  • Uses explicit service injection with typed mocks
  • Implements setup function according to guidelines
  • Provides comprehensive test coverage including error scenarios
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (2)

110-186: Well-structured tests with proper service injection.

The test suite correctly implements service injection patterns and properly wraps side effects in act().


261-300: Comprehensive lease status tests with proper mocking.

The tests correctly mock the providerProxy service and verify the expected method calls with appropriate parameters.

apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2)

43-43: Good defensive programming with optional chaining.

The use of optional chaining (settings?.apiEndpoint) properly handles cases where settings might be undefined.


32-32: No action needed: ServicesContext default value enforces Provider wrapping
The ServicesContext is initialized with a Proxy that throws a clear error if accessed outside of a ServicesProvider, so the as AppDIContainer cast won’t lead to silent undefined values—unwrapped usage immediately surfaces an explicit runtime error.

apps/deploy-web/src/queries/useProvidersQuery.ts (2)

16-25: Consistent axios dependency injection pattern implemented correctly.

The refactoring properly replaces direct axios imports with dependency injection through useServices. The query logic and error handling remain intact.


52-57: No baseURL override needed for networkCapacity calls

ApiUrlService.networkCapacity() already returns the full endpoint URL (including the correct baseApiUrl from browserApiUrlService), so the default axios instance from useServices() will correctly fetch /v1/network-capacity without any additional baseURL configuration. No changes required.

apps/deploy-web/src/queries/useDeploymentQuery.ts (1)

15-15: No changes needed for API endpoint handling or baseURL check
Passing an empty string to ApiUrlService.deploymentList("", address) produces a request URL beginning with “/…”, which Axios correctly resolves against chainApiHttpClient.defaults.baseURL. Likewise, the truthiness check (!chainApiHttpClient.defaults.baseURL) in getDeploymentDetail safely guards against both missing and empty base URLs—narrowing it to an empty‐string check would weaken that guard.

Likely an incorrect or invalid review comment.

apps/deploy-web/src/queries/useLeaseQuery.ts (3)

32-32: Good addition of query client for cache management.

The introduction of useQueryClient and the remove method enhances query cache management capabilities.


20-20: Consistent API endpoint parameter handling.

The pattern of passing empty string to ApiUrlService.leaseList("", address, deployment?.dseq) is consistent with other query files and relies on the HTTP client's base URL configuration.


46-46: Remove method scope verified

The remove function correctly invokes queryClient.removeQueries({ queryKey }), where queryKey is built by QueryKeys.getLeasesKey(address, deployment.dseq). This precisely targets only the leases query for that deployment and won’t affect other cached queries. No changes needed.

apps/deploy-web/src/services/http-factory/http-factory.service.ts (2)

58-63: Good separation of traced and untraced axios instances.

The createTracedAxios factory method provides a clean way to create axios instances with OpenTelemetry tracing when needed.


118-121: OpenTelemetry import verified

generateTraceparent is exported in apps/deploy-web/src/utils/otel.ts and correctly imported at line 11 of apps/deploy-web/src/services/http-factory/http-factory.service.ts. No further action needed.


import { SimpleServiceFormControl } from "@src/components/sdl/SimpleServiceFormControl";
import { USER_TEMPLATE_CODE } from "@src/config/deploy.config";
import { useServices } from "@src/context/ServicesProvider";
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

LGTM! Completes the service injection refactor.

The component successfully adopts the dependency injection pattern using useServices(). This final change completes the systematic refactor from direct axios imports to centralized service context usage.

Verify the refactor is complete and no direct axios imports remain:

Also applies to: 37-37


🏁 Script executed:

#!/bin/bash
# Description: Verify the axios refactor is complete across the deploy-web app
# Expected: No remaining direct axios imports that should be refactored

# Search for any remaining direct axios imports in components and contexts
rg "import.*axios.*from ['\"]axios['\"]" apps/deploy-web/src/ --type ts --type tsx

# Search for axios usage without proper service injection
rg "axios\." apps/deploy-web/src/ --type ts --type tsx -A 2 -B 2

# Verify service providers are imported where needed
rg "useServices|useRootContainer" apps/deploy-web/src/ --type ts --type tsx

Length of output: 317


Let’s retry without restricting by file type—this should surface any remaining direct imports or usages:


🏁 Script executed:

#!/bin/bash
# Revised verification: search all files for axios imports/usages and service hook usage

# 1. Look for direct axios imports
rg "import\s+axios\s+from\s+['\"]axios['\"]" apps/deploy-web/src/

# 2. Find any raw axios.<method> calls
rg "axios\." apps/deploy-web/src/ -C2

# 3. Ensure useServices() is present in components
rg "useServices\(\)" apps/deploy-web/src/

Length of output: 33513


Service injection refactor is incomplete – direct axios imports and calls remain

While SimpleSdlBuilderForm.tsx now uses useServices(), our verification uncovered raw import axios from 'axios' and un-injected axios calls in several parts of the deploy-web app. These bypass the centralized service context and should be refactored to use the injected instance.

Files requiring attention:

  • apps/deploy-web/src/utils/deploymentData/helpers.ts
  • apps/deploy-web/src/services/auth/bitbucket.service.ts, github.service.ts, gitlab.service.ts
  • apps/deploy-web/src/services/remote-deploy/bitbucket-http.service.ts, github-http.service.ts, gitlab-http.service.ts
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/components/user/UserSettingsForm.tsx

Please replace direct imports and calls with the axios instance obtained via useServices() (or the appropriate HTTP factory) to complete the dependency-injection refactor.

🤖 Prompt for AI Agents
In apps/deploy-web/src/components/sdl/SimpleSdlBuilderForm.tsx at line 15 and
across the listed files, direct imports of axios and raw axios calls bypass the
centralized service context. To fix this, remove all direct axios imports and
replace axios calls with the axios instance obtained from useServices() or the
appropriate injected HTTP client. This ensures all HTTP requests use the
centralized, injectable axios instance, completing the dependency-injection
refactor.

@stalniy stalniy changed the title Refactor/axios2 refactor: replaces direct dep on axios to injected via useServices one Jul 4, 2025
ygrishajev
ygrishajev previously approved these changes Jul 4, 2025
@stalniy stalniy force-pushed the refactor/axios2 branch 3 times, most recently from fede2d9 to 7de6867 Compare July 4, 2025 08:31
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8222b29 and 7de6867.

📒 Files selected for processing (56)
  • apps/deploy-web/src/components/deployments/LeaseRow.tsx (4 hunks)
  • apps/deploy-web/src/components/deployments/ManifestUpdate.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/CreateLease.tsx (3 hunks)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx (1 hunks)
  • apps/deploy-web/src/components/sdl/EditDescriptionForm.tsx (2 hunks)
  • apps/deploy-web/src/components/sdl/RentGpusForm.tsx (1 hunks)
  • apps/deploy-web/src/components/sdl/SimpleSdlBuilderForm.tsx (2 hunks)
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx (1 hunks)
  • apps/deploy-web/src/components/user/UserSettingsForm.tsx (2 hunks)
  • apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/ServicesContext.ts (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2 hunks)
  • apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx (2 hunks)
  • apps/deploy-web/src/hooks/useAuthZService.tsx (0 hunks)
  • apps/deploy-web/src/pages/_app.tsx (2 hunks)
  • apps/deploy-web/src/queries/deploymentSettingsQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/featureFlags.ts (1 hunks)
  • apps/deploy-web/src/queries/useBidQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useBlocksQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useDeploymentQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useExactDeploymentGrantsQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useGpuQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.ts (3 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.ts (4 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useMarketData.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useMarketData.ts (1 hunks)
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx (3 hunks)
  • apps/deploy-web/src/queries/useProvidersQuery.ts (4 hunks)
  • apps/deploy-web/src/queries/useSaveSettings.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useSaveSettings.ts (2 hunks)
  • apps/deploy-web/src/queries/useSettings.spec.tsx (0 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useTemplateQuery.tsx (4 hunks)
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts (5 hunks)
  • apps/deploy-web/src/services/http/http-browser.service.ts (1 hunks)
  • apps/deploy-web/src/services/http/http-server.service.ts (1 hunks)
  • apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2 hunks)
  • apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2 hunks)
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts (3 hunks)
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.ts (2 hunks)
  • apps/deploy-web/src/utils/apiUtils.ts (2 hunks)
  • apps/deploy-web/src/utils/deploymentUtils.ts (0 hunks)
  • apps/deploy-web/src/utils/otel.ts (1 hunks)
  • apps/deploy-web/tests/seeders/provider.ts (1 hunks)
  • apps/deploy-web/tests/unit/query-client.tsx (1 hunks)
  • packages/network-store/src/network.store.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • apps/deploy-web/src/hooks/useAuthZService.tsx
  • apps/deploy-web/src/utils/deploymentUtils.ts
  • apps/deploy-web/src/queries/useSettings.spec.tsx
✅ Files skipped from review due to trivial changes (4)
  • apps/deploy-web/tests/seeders/provider.ts
  • apps/deploy-web/src/components/sdl/RentGpusForm.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.ts
🚧 Files skipped from review as they are similar to previous changes (48)
  • apps/deploy-web/src/components/new-deployment/ManifestEdit.tsx
  • apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx
  • apps/deploy-web/src/components/user/UserSettingsForm.tsx
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts
  • apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/utils/apiUtils.ts
  • packages/network-store/src/network.store.ts
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx
  • apps/deploy-web/src/components/sdl/EditDescriptionForm.tsx
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts
  • apps/deploy-web/src/queries/useSaveSettings.ts
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx
  • apps/deploy-web/src/queries/useMarketData.ts
  • apps/deploy-web/src/queries/useTemplateQuery.tsx
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts
  • apps/deploy-web/src/queries/useGpuQuery.ts
  • apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
  • apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts
  • apps/deploy-web/src/queries/deploymentSettingsQuery.ts
  • apps/deploy-web/src/queries/useGrantsQuery.ts
  • apps/deploy-web/src/components/sdl/SimpleSdlBuilderForm.tsx
  • apps/deploy-web/tests/unit/query-client.tsx
  • apps/deploy-web/src/queries/useSaveSettings.spec.tsx
  • apps/deploy-web/src/queries/useMarketData.spec.tsx
  • apps/deploy-web/src/queries/useStripePricesQuery.ts
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
  • apps/deploy-web/src/queries/featureFlags.ts
  • apps/deploy-web/src/pages/_app.tsx
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/components/deployments/ManifestUpdate.tsx
  • apps/deploy-web/src/utils/otel.ts
  • apps/deploy-web/src/components/new-deployment/CreateLease.tsx
  • apps/deploy-web/src/context/ServicesProvider/ServicesContext.ts
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts
  • apps/deploy-web/src/queries/useDeploymentQuery.ts
  • apps/deploy-web/src/queries/useExactDeploymentGrantsQuery.ts
  • apps/deploy-web/src/components/deployments/LeaseRow.tsx
  • apps/deploy-web/src/queries/useBlocksQuery.ts
  • apps/deploy-web/src/services/http/http-server.service.ts
  • apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx
  • apps/deploy-web/src/queries/useBidQuery.ts
  • apps/deploy-web/src/services/http/http-browser.service.ts
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx
  • apps/deploy-web/src/queries/useProvidersQuery.ts
  • apps/deploy-web/src/queries/useLeaseQuery.ts
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.spec.{ts,tsx}`: Use `setup` function instead of `beforeEach` in test files...

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

📄 Source: CodeRabbit Inference Engine (.cursor/rules/setup-instead-of-before-each.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts (3)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test-build
🔇 Additional comments (2)
apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts (2)

2-3: Import changes align with the refactor objectives.

The updates from Axios to AxiosInstance and the change to named type import for AxiosResponse are consistent with the PR's goal to centralize HTTP client usage through dependency injection.


109-109: Mock cast update is consistent with import changes.

The update from Axios to AxiosInstance in the mock cast aligns with the import changes and maintains type consistency.

@stalniy stalniy force-pushed the refactor/axios2 branch from 7de6867 to 50f8ebe Compare July 4, 2025 10:00
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: 0

🧹 Nitpick comments (1)
apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (1)

124-129: Consider consolidating setup functions per coding guidelines.

The coding guidelines specify that the setup function should be at the bottom of the root describe block. Currently, each nested describe block has its own setup function. While this pattern works and provides good organization, it may not align with the established guidelines.

Consider either:

  1. Having a single setup function at the bottom of the root describe block that accepts parameters to configure different scenarios
  2. Confirming if the current pattern is acceptable for cases where different hooks need different setup configurations

Also applies to: 165-169, 223-227, 264-269, 307-312, 350-355, 420-424

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7de6867 and 50f8ebe.

📒 Files selected for processing (26)
  • apps/deploy-web/src/components/sdl/SaveTemplateModal.tsx (4 hunks)
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2 hunks)
  • apps/deploy-web/src/queries/featureFlags.ts (1 hunks)
  • apps/deploy-web/src/queries/useBidQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useDeploymentQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.ts (4 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx (3 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useTemplateQuery.tsx (6 hunks)
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts (5 hunks)
  • apps/deploy-web/src/services/http/http-browser.service.ts (1 hunks)
  • apps/deploy-web/src/services/http/http-server.service.ts (1 hunks)
  • apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2 hunks)
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts (3 hunks)
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.ts (2 hunks)
  • apps/deploy-web/tests/seeders/provider.ts (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • apps/deploy-web/tests/seeders/provider.ts
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.ts
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx
🚧 Files skipped from review as they are similar to previous changes (19)
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts
  • apps/deploy-web/src/queries/useStripePricesQuery.ts
  • apps/deploy-web/src/queries/featureFlags.ts
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/queries/useDeploymentQuery.ts
  • apps/deploy-web/src/services/http/http-server.service.ts
  • apps/deploy-web/src/services/http/http-browser.service.ts
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx
  • apps/deploy-web/src/queries/useBidQuery.ts
  • apps/deploy-web/src/queries/useLeaseQuery.ts
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
  • apps/deploy-web/src/queries/useTemplateQuery.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts
🧰 Additional context used
📓 Path-based instructions (2)
`apps/{deploy-web,provider-console}/**/*.spec.tsx`: Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files

apps/{deploy-web,provider-console}/**/*.spec.tsx: Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

📄 Source: CodeRabbit Inference Engine (.cursor/rules/query-by-in-tests.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/queries/useTemplateQuery.spec.tsx
`**/*.spec.{ts,tsx}`: Use `setup` function instead of `beforeEach` in test files...

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

📄 Source: CodeRabbit Inference Engine (.cursor/rules/setup-instead-of-before-each.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/queries/useTemplateQuery.spec.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (7)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: stalniy
PR: akash-network/console#1436
File: apps/api/src/provider/repositories/provider/provider.repository.ts:79-90
Timestamp: 2025-06-08T03:07:13.871Z
Learning: The getProvidersHostUriByAttributes method in apps/api/src/provider/repositories/provider/provider.repository.ts already has comprehensive test coverage in provider.repository.spec.ts, including tests for complex HAVING clause logic with COUNT(*) FILTER (WHERE ...) syntax, signature conditions (anyOf/allOf), and glob pattern matching.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
apps/deploy-web/src/components/sdl/SaveTemplateModal.tsx (2)
Learnt from: ygrishajev
PR: akash-network/console#1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
Learnt from: baktun14
PR: akash-network/console#1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (1)
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
🧬 Code Graph Analysis (3)
apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (4)
apps/deploy-web/src/types/templates.ts (1)
  • ITemplate (46-58)
apps/deploy-web/src/queries/useTemplateQuery.tsx (8)
  • useUserTemplates (13-20)
  • useUserFavoriteTemplates (22-30)
  • useTemplate (32-40)
  • useSaveUserTemplate (42-69)
  • useDeleteTemplate (71-86)
  • useAddFavoriteTemplate (88-98)
  • useRemoveFavoriteTemplate (100-110)
  • useTemplates (150-170)
apps/deploy-web/tests/unit/query-client.tsx (1)
  • setupQuery (10-28)
packages/http-sdk/src/template/template-http.service.ts (1)
  • TemplateHttpService (35-47)
apps/deploy-web/src/components/sdl/SaveTemplateModal.tsx (2)
apps/deploy-web/src/queries/useTemplateQuery.tsx (1)
  • useSaveUserTemplate (42-69)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-78)
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2)
packages/http-sdk/src/managed-wallet-http/managed-wallet-http.service.ts (1)
  • ManagedWalletHttpService (11-29)
apps/deploy-web/src/services/analytics/analytics.service.ts (2)
  • analyticsService (257-274)
  • AnalyticsService (124-249)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: validate (apps/deploy-web) / validate-unsafe
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (14)
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (4)

5-5: LGTM: Proper type-only import.

The type import for AnalyticsService is correctly implemented and necessary for the constructor parameter type annotation.


7-7: LGTM: Export enables dependency injection pattern.

Exporting the class allows it to be instantiated by service factories, which is essential for the dependency injection refactor.


10-13: LGTM: Constructor follows dependency injection best practices.

The updated constructor properly injects the AnalyticsService dependency, making the class more testable and modular. The parameter is correctly typed and stored as a private readonly field.


27-27: LGTM: Correct usage of injected analytics service.

The analytics service calls properly use the injected this.analyticsService instead of the global singleton, maintaining the same API calls while following the dependency injection pattern.

Also applies to: 32-32

apps/deploy-web/src/components/sdl/SaveTemplateModal.tsx (4)

7-7: LGTM: Router import added for navigation.

The useRouter import is correctly added to support programmatic navigation after template saving.


17-17: LGTM: UrlService import added for URL generation.

The UrlService import is correctly added to generate the SDL builder URL with the template ID.


41-48: LGTM: Enhanced navigation logic with dependency injection pattern.

The refactoring correctly:

  • Moves navigation logic from the hook to the component level
  • Uses the new options-based API for useSaveUserTemplate
  • Implements conditional navigation based on template ownership
  • Aligns with the PR's goal of improving service architecture

The navigation logic ensures users are redirected to the SDL builder with the new template ID when saving a template that doesn't belong to them.


73-73: LGTM: Updated to use mutation pattern correctly.

The saveTemplate call is no longer awaited, which is correct for the new mutation hook pattern where the onSuccess callback handles post-mutation logic.

apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (6)

24-36: LGTM: Well-structured mock data.

The mock template data is comprehensive and includes all required fields from the ITemplate interface.


59-88: LGTM: Comprehensive test coverage for useUserTemplates.

The tests properly verify:

  • Successful API calls with correct parameters
  • Proper data transformation and state management
  • Error handling scenarios
  • Correct mocking of axios instance

91-130: LGTM: Thorough testing of useUserFavoriteTemplates.

The tests correctly:

  • Mock the axios instance and API responses
  • Verify API endpoint calls
  • Test both success and error scenarios
  • Include proper user context setup

173-228: LGTM: Complete testing of useSaveUserTemplate mutation.

The tests properly validate:

  • Correct API payload structure with all template fields
  • Successful mutation execution
  • Error handling scenarios
  • Integration with the new options-based API

272-313: LGTM: Excellent coverage of favorite template operations.

The tests for useAddFavoriteTemplate correctly:

  • Mock axios and API responses
  • Verify correct API endpoint calls
  • Test snackbar notifications using proper async queries
  • Include proper snackbar provider setup
  • Handle error scenarios appropriately

358-425: LGTM: Comprehensive testing of useTemplates hook.

The tests properly cover:

  • Successful template fetching with category grouping
  • Empty response handling
  • Error scenarios with proper fallbacks
  • Mocking of TemplateHttpService
  • Verification of data transformation

@stalniy stalniy force-pushed the refactor/axios2 branch from 50f8ebe to d9b8900 Compare July 4, 2025 10:08
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: 4

🧹 Nitpick comments (2)
apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (2)

22-22: Move Testing Library import to maintain import grouping consistency.

The Testing Library import should be grouped with other third-party imports at the top, not placed after the local imports.

+import { act, screen, waitFor } from "@testing-library/react";
 import type { TemplateHttpService } from "@akashnetwork/http-sdk";
 import type { UserProfile } from "@auth0/nextjs-auth0/client";
 import { UserProvider } from "@auth0/nextjs-auth0/client";
 import type { AxiosInstance } from "axios";
 import { mock } from "jest-mock-extended";

 import type { Props as ServicesProviderProps } from "@src/context/ServicesProvider";
 import type { ITemplate } from "@src/types";
 import { CustomSnackbarProvider } from "../../../../packages/ui/context/CustomSnackbarProvider";
 import { setupQuery } from "../../tests/unit/query-client";
 import {
   useAddFavoriteTemplate,
   useDeleteTemplate,
   useRemoveFavoriteTemplate,
   useSaveUserTemplate,
   useTemplate,
   useTemplates,
   useUserFavoriteTemplates,
   useUserTemplates
 } from "./useTemplateQuery";

-import { act, screen, waitFor } from "@testing-library/react";

124-129: Consider consolidating setup functions per coding guidelines.

The coding guidelines suggest having a single setup function at the bottom of the root describe block. Consider consolidating these individual setup functions into a single parameterized setup function to improve maintainability and follow the established pattern.

Each describe block currently has its own setup function, which creates duplication. A single setup function that can handle different hook configurations would be more aligned with the guidelines.

Also applies to: 165-169, 223-227, 264-269, 307-312, 350-355, 420-424

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50f8ebe and d9b8900.

📒 Files selected for processing (26)
  • apps/deploy-web/src/components/sdl/SaveTemplateModal.tsx (4 hunks)
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx (1 hunks)
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2 hunks)
  • apps/deploy-web/src/queries/featureFlags.ts (1 hunks)
  • apps/deploy-web/src/queries/useBidQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/useDeploymentQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (2 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.ts (4 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts (2 hunks)
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx (3 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useStripePricesQuery.ts (1 hunks)
  • apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (1 hunks)
  • apps/deploy-web/src/queries/useTemplateQuery.tsx (6 hunks)
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts (1 hunks)
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts (5 hunks)
  • apps/deploy-web/src/services/http/http-browser.service.ts (1 hunks)
  • apps/deploy-web/src/services/http/http-server.service.ts (1 hunks)
  • apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (2 hunks)
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts (3 hunks)
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.ts (2 hunks)
  • apps/deploy-web/tests/seeders/provider.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • apps/deploy-web/tests/seeders/provider.ts
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.ts
🚧 Files skipped from review as they are similar to previous changes (22)
  • apps/deploy-web/src/components/turnstile/Turnstile.tsx
  • apps/deploy-web/src/queries/featureFlags.ts
  • apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts
  • apps/deploy-web/src/queries/useStripePricesQuery.ts
  • apps/deploy-web/src/queries/useManagedWalletQuery.ts
  • apps/deploy-web/src/services/api-url/server-api-url.service.ts
  • apps/deploy-web/src/components/sdl/SaveTemplateModal.tsx
  • apps/deploy-web/src/services/http/http-browser.service.ts
  • apps/deploy-web/src/queries/usePaymentQueries.spec.tsx
  • apps/deploy-web/src/services/api-url/browser-api-url.service.ts
  • apps/deploy-web/src/services/http/http-server.service.ts
  • apps/deploy-web/src/context/ServicesProvider/RootContainerProvider.tsx
  • apps/deploy-web/src/queries/useStripePricesQuery.spec.tsx
  • apps/deploy-web/src/queries/useManagedWalletQuery.spec.tsx
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/queries/useGrantsQuery.spec.tsx
  • apps/deploy-web/src/queries/useTemplateQuery.tsx
  • apps/deploy-web/src/queries/useBidQuery.ts
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
  • apps/deploy-web/src/queries/useDeploymentQuery.ts
  • apps/deploy-web/src/services/http-factory/http-factory.service.ts
  • apps/deploy-web/src/queries/useLeaseQuery.ts
🧰 Additional context used
📓 Path-based instructions (2)
`apps/{deploy-web,provider-console}/**/*.spec.tsx`: Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files

apps/{deploy-web,provider-console}/**/*.spec.tsx: Use queryBy methods instead of getBy methods in test expectations in .spec.tsx files

📄 Source: CodeRabbit Inference Engine (.cursor/rules/query-by-in-tests.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/queries/useTemplateQuery.spec.tsx
`**/*.spec.{ts,tsx}`: Use `setup` function instead of `beforeEach` in test files...

**/*.spec.{ts,tsx}: Use setup function instead of beforeEach in test files
setup function must be at the bottom of the root describe block
setup function creates an object under test and returns it
setup function should accept a single parameter with inline type definition
Don't use shared state in setup function
Don't specify return type of setup function

📄 Source: CodeRabbit Inference Engine (.cursor/rules/setup-instead-of-before-each.mdc)

List of files the instruction was applied to:

  • apps/deploy-web/src/queries/useTemplateQuery.spec.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (1)
Learnt from: jzsfkzm
PR: akash-network/console#1372
File: apps/api/src/dashboard/services/stats/stats.service.ts:0-0
Timestamp: 2025-05-28T20:42:58.200Z
Learning: The user successfully implemented CosmosHttpService with retry logic using axiosRetry, exponential backoff, and proper error handling for Cosmos API calls, replacing direct axios usage in StatsService.
apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (7)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Learnt from: stalniy
PR: akash-network/console#1436
File: apps/api/src/provider/repositories/provider/provider.repository.ts:79-90
Timestamp: 2025-06-08T03:07:13.871Z
Learning: The getProvidersHostUriByAttributes method in apps/api/src/provider/repositories/provider/provider.repository.ts already has comprehensive test coverage in provider.repository.spec.ts, including tests for complex HAVING clause logic with COUNT(*) FILTER (WHERE ...) syntax, signature conditions (anyOf/allOf), and glob pattern matching.
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-06-30T12:11:58.081Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
🧬 Code Graph Analysis (1)
apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (4)
apps/deploy-web/src/types/templates.ts (1)
  • ITemplate (46-58)
apps/deploy-web/src/queries/useTemplateQuery.tsx (8)
  • useUserTemplates (13-20)
  • useUserFavoriteTemplates (22-30)
  • useTemplate (32-40)
  • useSaveUserTemplate (42-69)
  • useDeleteTemplate (71-86)
  • useAddFavoriteTemplate (88-98)
  • useRemoveFavoriteTemplate (100-110)
  • useTemplates (150-170)
apps/deploy-web/tests/unit/query-client.tsx (1)
  • setupQuery (10-28)
packages/http-sdk/src/template/template-http.service.ts (1)
  • TemplateHttpService (35-47)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
🔇 Additional comments (5)
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts (3)

5-5: LGTM: Clean type-only import for dependency injection.

The addition of the AnalyticsService type import aligns with the dependency injection pattern and follows TypeScript best practices.


7-7: LGTM: Class export enables dependency injection.

Exporting the class is essential for the dependency injection container to create instances, replacing the previous singleton pattern.


27-27: LGTM: Analytics service usage properly migrated to dependency injection.

The replacement of global analyticsService with the injected this.analyticsService maintains functionality while improving testability and following dependency injection principles.

Also applies to: 32-32

apps/deploy-web/src/queries/useTemplateQuery.spec.tsx (2)

287-287: LGTM! Correct usage of findByText instead of getByText.

The tests correctly use findByText for async assertions rather than getByText, which aligns with the coding guidelines for .spec.tsx files.

Also applies to: 330-330


1-426: Excellent comprehensive test coverage.

The test suite provides thorough coverage of all template query hooks including success and error scenarios. The mocking strategy using jest-mock-extended is appropriate, and the tests properly inject services through the setupQuery helper function, which aligns well with the dependency injection refactor.

Comment on lines +10 to +13
constructor(
config: AxiosRequestConfig,
private readonly analyticsService: AnalyticsService
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

LGTM: Constructor properly implements dependency injection.

The constructor signature correctly requires both configuration and analytics service dependencies, following good dependency injection principles with proper encapsulation.

Verify that all consumers of this service have been updated to match the new constructor signature:


🏁 Script executed:

#!/bin/bash
# Description: Verify all consumers of ManagedWalletHttpService have been updated for the new constructor signature

# Search for direct instantiation of ManagedWalletHttpService
rg -A 3 "new ManagedWalletHttpService"

# Search for imports of ManagedWalletHttpService to understand usage patterns
rg -A 2 "import.*ManagedWalletHttpService"

# Search for any remaining references to the old singleton pattern
rg "managedWalletHttpService" --type ts --type tsx

Length of output: 1747


Fix: Include AnalyticsService in ManagedWalletHttpService instantiation

The refactored constructor now requires both an AxiosRequestConfig and an AnalyticsService instance. Update all new ManagedWalletHttpService(...) calls accordingly:

• File: apps/deploy-web/src/services/http-factory/http-factory.service.ts
Replace the lone config argument with both parameters:

-   new ManagedWalletHttpService(
-     { 
-       baseURL: container.apiUrlService.getBaseApiUrlFor(config.MANAGED_WALLET_NETWORK_ID)
-     }
-   );
+   new ManagedWalletHttpService(
+     {
+       baseURL: container.apiUrlService.getBaseApiUrlFor(config.MANAGED_WALLET_NETWORK_ID)
+     },
+     this.analyticsService
+   );

Please audit any other instantiations or factory methods to ensure they pass the required analyticsService dependency.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
apps/deploy-web/src/services/managed-wallet-http/managed-wallet-http.service.ts
around lines 10 to 13, the constructor now requires both an AxiosRequestConfig
and an AnalyticsService instance. Update all instantiations of
ManagedWalletHttpService, especially in
apps/deploy-web/src/services/http-factory/http-factory.service.ts, to pass both
the config and the analyticsService arguments. Audit other places where
ManagedWalletHttpService is instantiated or created via factory methods to
ensure the analyticsService dependency is correctly provided.

@stalniy stalniy force-pushed the refactor/axios2 branch from d9b8900 to 19aeece Compare July 4, 2025 10:56
@stalniy stalniy merged commit dfb52ae into main Jul 4, 2025
57 of 58 checks passed
@stalniy stalniy deleted the refactor/axios2 branch July 4, 2025 11:07
stalniy added a commit that referenced this pull request Nov 20, 2025
#1622)

* refactor: replaces direct dep on axios to injected via useServices one

* refactor: gather services into one place
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