refactor: replaces direct dep on axios to injected via useServices one#1622
refactor: replaces direct dep on axios to injected via useServices one#1622
Conversation
WalkthroughThis 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 Changes
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)
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
Possibly related PRs
Suggested reviewers
Poem
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
npm error Exit handler never called! ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
❌ 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
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
setIsQuertInitcontains 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: Preferundefinedovernullfor optional interceptor arg.
axios.interceptors.response.useexpectsundefined | ((res) => …)for the first parameter; passingnullwidens toanyand 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.baseURLwill 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
managedWalletServicefactory 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
📒 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: UsequeryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
📄 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.tsxapps/deploy-web/src/queries/useStripePricesQuery.spec.tsxapps/deploy-web/src/queries/useManagedWalletQuery.spec.tsxapps/deploy-web/src/queries/useSaveSettings.spec.tsxapps/deploy-web/src/queries/useMarketData.spec.tsxapps/deploy-web/src/queries/useGrantsQuery.spec.tsxapps/deploy-web/src/queries/useLeaseQuery.spec.tsx
`**/*.spec.{ts,tsx}`: Use `setup` function instead of `beforeEach` in test files...
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
📄 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.tsxapps/deploy-web/src/queries/useStripePricesQuery.spec.tsxapps/deploy-web/src/queries/useManagedWalletQuery.spec.tsxapps/deploy-web/src/queries/useSaveSettings.spec.tsxapps/deploy-web/src/queries/useMarketData.spec.tsxapps/deploy-web/src/queries/useGrantsQuery.spec.tsxapps/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 defensivetypeof 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 theservicesobject.
services.deploymentSetting(and the others) must be present in the factory returned bycreateServices. 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
axiosmodule to just theisAxiosErrorutility 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 upThe
RootContainerProviderwraps the application in
apps/deploy-web/src/pages/_app.tsx, so the injected HTTP client (and any other services) will be available toSettingsProvider. There are no remaining directaxiosimports in the SettingsProvider file.LGTM!
apps/deploy-web/src/queries/deploymentSettingsQuery.ts (1)
4-4: LGTM! Improved error handling pattern.The change from
instanceof AxiosErrortoisAxiosError(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 theaxiosinstance. 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
browserApiUrlServicetoapiUrlServicefromuseServices()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
apiUrlServiceparameter, 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.tsand 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
RootContainerProviderimport is required to support the new dependency injection pattern used throughout the application.
103-133: Correctly positioned root container provider.The
RootContainerProvideris properly positioned as the outermost wrapper, ensuring all components in the provider tree have access to the service dependency injection context. This enables theuseServices()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
useServicesimport enables the hook to access services via the dependency injection context.
6-6: Consistent service retrieval pattern.The change from direct
stripeServiceimport to destructuring fromuseServices()follows the same pattern used in other query files likefeatureFlags.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
AxiostoAxiosInstancetype 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
AxiosInstancecorrectly 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
sendManifestToProviderutility toproviderProxy.sendManifestservice 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_IDandapiUrlServicecorrectly 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
useServicescontext 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
providerProxyservice 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
managedWalletServicefrom 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
useServiceshook 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, andapiUrlServicealigns 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-extendedimproves test isolation and type safety.
15-20: Proper service injection pattern for tests.The
setupQueryhelper 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
useServicesfollows 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
useRootContainerhook 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
setupQueryservices 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 getDepositParamsIt looks like calling
ApiUrlService.depositParams("")will produce a path starting with
/cosmos/…—which only works if the passedAxiosInstancealready has itsbaseURLset to the chain’s API root. Please verify:
- That
chainApiHttpClientis instantiated with abaseURLpointing to the chain endpoint (e.g.https://…), so calling.get("/cosmos/…")is correct.- If not, replace
""with the actual API URL, for examplenetworkStore.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 (wherechainApiHttpClientis configured) to ensurebaseURLis 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-extendedfor 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.baseURLis 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 itsbaseURLconfigured. This mirrors the
existing usage inuseDeploymentQueryanduseLeaseQuery, 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 toApiUrlService.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
setupQueryfunction properly supports service injection through theServicesProvider, 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
chainApiHttpClientfrom theuseServiceshook and passes it to thegetBidListfunction.
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
setupfunction 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
AnalyticsServiceas 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
setupfunction 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
providerProxyservice 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
TheServicesContextis initialized with a Proxy that throws a clear error if accessed outside of aServicesProvider, so theas AppDIContainercast 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 correctbaseApiUrlfrombrowserApiUrlService), so the defaultaxiosinstance fromuseServices()will correctly fetch/v1/network-capacitywithout any additionalbaseURLconfiguration. 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 toApiUrlService.deploymentList("", address)produces a request URL beginning with “/…”, which Axios correctly resolves againstchainApiHttpClient.defaults.baseURL. Likewise, the truthiness check (!chainApiHttpClient.defaults.baseURL) ingetDeploymentDetailsafely 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
useQueryClientand theremovemethod 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 verifiedThe
removefunction correctly invokesqueryClient.removeQueries({ queryKey }), wherequeryKeyis built byQueryKeys.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
createTracedAxiosfactory method provides a clean way to create axios instances with OpenTelemetry tracing when needed.
118-121: OpenTelemetry import verified
generateTraceparentis exported inapps/deploy-web/src/utils/otel.tsand correctly imported at line 11 ofapps/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"; |
There was a problem hiding this comment.
💡 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 tsxLength 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.
fede2d9 to
7de6867
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
📄 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
AxiostoAxiosInstanceand the change to named type import forAxiosResponseare 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
AxiostoAxiosInstancein the mock cast aligns with the import changes and maintains type consistency.
apps/deploy-web/src/services/wallet-balances/wallet-balances.service.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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
setupfunction should be at the bottom of the rootdescribeblock. Currently, each nesteddescribeblock has its ownsetupfunction. While this pattern works and provides good organization, it may not align with the established guidelines.Consider either:
- Having a single
setupfunction at the bottom of the rootdescribeblock that accepts parameters to configure different scenarios- 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
📒 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: UsequeryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
📄 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}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
📄 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
AnalyticsServiceis 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
AnalyticsServicedependency, 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.analyticsServiceinstead 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
useRouterimport is correctly added to support programmatic navigation after template saving.
17-17: LGTM: UrlService import added for URL generation.The
UrlServiceimport 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
saveTemplatecall is no longer awaited, which is correct for the new mutation hook pattern where theonSuccesscallback 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
ITemplateinterface.
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
useAddFavoriteTemplatecorrectly:
- 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
There was a problem hiding this comment.
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
setupfunction 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
📒 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: UsequeryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
📄 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}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
📄 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
AnalyticsServicetype 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
analyticsServicewith the injectedthis.analyticsServicemaintains 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
findByTextfor async assertions rather thangetByText, which aligns with the coding guidelines for.spec.tsxfiles.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-extendedis appropriate, and the tests properly inject services through thesetupQueryhelper function, which aligns well with the dependency injection refactor.
| constructor( | ||
| config: AxiosRequestConfig, | ||
| private readonly analyticsService: AnalyticsService | ||
| ) { |
There was a problem hiding this comment.
💡 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 tsxLength 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.
#1622) * refactor: replaces direct dep on axios to injected via useServices one * refactor: gather services into one place
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
Refactor
Bug Fixes
Tests
actfor proper state update handling.Chores