refactor: extracts logs/events/shell logic to service layer#2177
refactor: extracts logs/events/shell logic to service layer#2177
Conversation
WalkthroughReplaces the old websocket hook and react-use-websocket dependency with new websocket core utilities and a provider-proxy streaming model (request/getLogsStream/connectToShell), migrating logs/shell UI, hooks, utils, and tests to abort-controlled streaming, WebsocketSession, and createWebsocket implementations. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI Component
participant Proxy as ProviderProxy
participant Session as WebsocketSession
participant WS as WebSocket
rect rgb(230,245,255)
Note over UI,Proxy: Streaming flow via provider-proxy (request / getLogsStream / connectToShell)
end
UI->>+Proxy: getLogsStream(...) / connectToShell(...)
Proxy->>+Session: create WebsocketSession(url, transforms)
UI->>+Session: receive() (async iterator)
Session->>+WS: lazy create WebSocket()
WS-->>Session: onopen / onmessage events
Session-->>-UI: yield transformed messages
UI->>UI: onNext -> render logs / write terminal
Note over UI,Session: AbortController cancels -> Session.disconnect()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
I will use similar interface to get provider logs/events/shell access in chain-sdk. IMO, It's very convenient for development |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
77-77: Fix the "Select All" toggle logic to match the displayed state.The code checks
selected.length === options.length, but the UI displays based onselectedItems(lines 91, 116). This creates a critical bug:Scenario: If
defaultValuecontains all options:
- Initial state:
selected = [],selectedItems = defaultValue(all options)- UI shows all checkboxes as checked
- User clicks "Select All" (expecting to deselect all)
- Line 77 evaluates:
selected.length (0) === options.length→ false- Result:
newValue = options(re-selects all instead of clearing)Fix: Check
selectedItems.lengthinstead:- newValue = selected.length === options.length ? [] : options; + newValue = selectedItems.length === options.length ? [] : options;Note: If you apply the suggested fix from lines 69-71 (reverting to initialize
selectedwithdefaultValue), this line should continue checkingselected.lengthand will work correctly.apps/deploy-web/src/services/websocket/WebsocketSession.ts (1)
116-121: Fix Biome’s constant-condition lint.The do/while(true) loop is already failing lint (
Unexpected constant condition). Use afor awaitloop to consume the generator without suppressions.Apply this diff:
-export async function forEachGeneratedItem<T>(generator: AsyncGenerator<T>, onNext: (value: T) => void) { - do { - const value = await generator.next(); - if (value.done) break; - onNext(value.value); - } while (true); // eslint-disable-line no-constant-condition -} +export async function forEachGeneratedItem<T>(generator: AsyncGenerator<T>, onNext: (value: T) => void) { + for await (const value of generator) { + onNext(value); + } +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (13)
apps/deploy-web/package.json(0 hunks)apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx(9 hunks)apps/deploy-web/src/components/deployments/DeploymentLogs.tsx(7 hunks)apps/deploy-web/src/components/shared/SelectCheckbox.tsx(4 hunks)apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts(1 hunks)apps/deploy-web/src/hooks/useProviderWebsocket.ts(0 hunks)apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts(1 hunks)apps/deploy-web/src/lib/XTerm/XTerm.tsx(3 hunks)apps/deploy-web/src/queries/useLeaseQuery.spec.tsx(2 hunks)apps/deploy-web/src/services/provider-proxy/logFormatters.ts(1 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts(6 hunks)apps/deploy-web/src/services/websocket/WebsocketSession.ts(1 hunks)apps/deploy-web/src/services/websocket/createWebsocket.ts(1 hunks)
💤 Files with no reviewable changes (2)
- apps/deploy-web/package.json
- apps/deploy-web/src/hooks/useProviderWebsocket.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/services/websocket/WebsocketSession.tsapps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/XTerm/XTerm.tsxapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/services/websocket/createWebsocket.tsapps/deploy-web/src/services/provider-proxy/logFormatters.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/src/hooks/useScopedFetchProviderUrl.tsapps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/services/websocket/WebsocketSession.tsapps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/XTerm/XTerm.tsxapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/services/websocket/createWebsocket.tsapps/deploy-web/src/services/provider-proxy/logFormatters.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/src/hooks/useScopedFetchProviderUrl.tsapps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
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
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
🧠 Learnings (7)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
📚 Learning: 2025-07-21T08:24:24.269Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-07-21T08:24:24.269Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` to mock dependencies in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
📚 Learning: 2025-06-08T03:07:13.871Z
Learnt from: stalniy
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsx
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsx
🧬 Code graph analysis (5)
apps/deploy-web/src/services/websocket/WebsocketSession.ts (1)
apps/deploy-web/src/services/websocket/createWebsocket.ts (4)
WsEvents(80-83)createWebsocket(3-78)waitForEvent(91-114)CreateWebsocketInput(85-89)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (5)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-59)apps/deploy-web/src/services/websocket/createWebsocket.ts (1)
forEachGeneratedItem(116-122)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
ProviderProxyMessage(412-415)LogEntryMessage(417-421)K8sEventMessage(423-436)apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (1)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
LogEntryMessage(417-421)K8sEventMessage(423-436)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/services/websocket/WebsocketSession.ts (1)
WebsocketSession(4-60)
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (3)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/websocket/createWebsocket.ts (1)
forEachGeneratedItem(116-122)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
ReceivedShellMessage(324-330)
🪛 Biome (2.1.2)
apps/deploy-web/src/services/websocket/createWebsocket.ts
[error] 121-121: Unexpected constant condition.
(lint/correctness/noConstantCondition)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: validate (apps/indexer) / validate-unsafe
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
🔇 Additional comments (4)
apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts (1)
56-62: LGTM! Good performance optimization.Memoizing the return object prevents unnecessary re-renders in components that include this hook's result in their dependency arrays. Since both
credentialsandgenerateare already memoized, this ensures referential stability of the returned object.apps/deploy-web/src/lib/XTerm/XTerm.tsx (2)
9-9: LGTM: IDisposable import added correctly.The IDisposable type import is necessary for the new disposable helper function and properly imported from xterm.
238-242: LGTM: Clean disposable helper implementation.The helper function correctly wraps IDisposable objects in React cleanup functions. The closure properly captures the value for disposal, and the type signature accurately reflects the expected inputs.
apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
69-71: Verify relevance to PR objectives.These changes to
SelectCheckboxappear unrelated to the stated PR objectives of refactoring logs/events/shell logic to the service layer. The component is a generic multi-select UI element with no apparent connection to WebSocket infrastructure or provider-proxy streaming.Could you confirm whether:
- This change was intentionally included in this PR
- If yes, how it relates to the PR's objectives
- If no, whether it should be moved to a separate PR
32a9826 to
2ec4b1f
Compare
414b497 to
e756970
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (2)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (1)
117-149: Restart log stream when network changesThe effect captures
networkStore.selectedNetworkIdbut it isn’t in the dependency list, so switching networks keeps streaming the previous provider’s logs. Please add it so the stream rebuilds with the new chain context.- }, [providerCredentials.details, selectedLogsMode, selectedLease, selectedServices, services?.length, providerInfo?.owner, providerInfo?.hostUri]); + }, [ + providerCredentials.details, + selectedLogsMode, + selectedLease, + selectedServices, + services?.length, + providerInfo?.owner, + providerInfo?.hostUri, + networkStore.selectedNetworkId + ]);apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (1)
77-99: Include network ID in shell session memo
shellSessiondepends onnetworkStore.selectedNetworkId, but the memo omits it, so a network switch reuses the stale connection. Add the network ID to the dependency list to force a new session on network changes.- }, [providerInfo, providerCredentials.details, selectedLease, selectedService]); + }, [providerInfo, providerCredentials.details, selectedLease, selectedService, networkStore.selectedNetworkId]);
🧹 Nitpick comments (3)
apps/deploy-web/jest.config.ts (1)
15-15: Consider extracting the transformer config to avoid inline type assertion.While the type assertion to
Config.TransformerConfigis valid, extracting the transformer configuration into a separate variable with a type annotation would be more idiomatic and maintainable.Apply this refactor to extract the transformer config:
+const tsJestTransformer: Config.TransformerConfig = ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }]; + const common = { moduleNameMapper: { "^@src(.*)$": "<rootDir>/src/$1", "^@tests(.*)$": "<rootDir>/tests/$1" }, transform: { - "\\.tsx?$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }] as Config.TransformerConfig + "\\.tsx?$": tsJestTransformer } } satisfies Config.InitialProjectOptions;apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1)
140-162: Consider verifyingwindowHistory.replaceStatewas called.The test correctly passes mocked
windowLocationandwindowHistory, and verifies the analytics tracking and step change. However, it doesn't verify thatwindowHistory.replaceStatewas called to clean up the URL parameter.Add an assertion after line 161:
// The component should be on the EMAIL_VERIFICATION step after handling fromSignup expect(child.mock.calls[child.mock.calls.length - 1][0].currentStep).toBe(OnboardingStepIndex.EMAIL_VERIFICATION); + + const mockHistory = (setup({ ... }).mockUseServices().windowHistory as any); + // Or access from the mock passed in setup + expect(input.windowHistory?.replaceState).toHaveBeenCalledWith({}, "", expect.stringContaining("/onboarding")); });Note: You'll need to adjust this to properly access the mock from the setup.
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (1)
335-337: Drop stray console logging in testsPlease remove this debug
console.log; it creates noisy output without adding assertions.- Object.assign(ws!, { used: true }); - console.log((ws! as any).used); + Object.assign(ws!, { used: true });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (26)
apps/deploy-web/jest.config.ts(1 hunks)apps/deploy-web/package.json(1 hunks)apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx(9 hunks)apps/deploy-web/src/components/deployments/DeploymentLogs.tsx(8 hunks)apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx(1 hunks)apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx(3 hunks)apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx(4 hunks)apps/deploy-web/src/components/shared/SelectCheckbox.tsx(3 hunks)apps/deploy-web/src/hooks/useProviderApiActions.tsx(1 hunks)apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts(1 hunks)apps/deploy-web/src/hooks/useProviderWebsocket.ts(0 hunks)apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts(1 hunks)apps/deploy-web/src/lib/XTerm/XTerm.tsx(3 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.ts(1 hunks)apps/deploy-web/src/queries/useLeaseQuery.spec.tsx(2 hunks)apps/deploy-web/src/services/app-di-container/browser-di-container.ts(1 hunks)apps/deploy-web/src/services/provider-proxy/logFormatters.ts(1 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts(14 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts(6 hunks)apps/deploy-web/src/utils/array.ts(1 hunks)apps/deploy-web/src/utils/timer.ts(1 hunks)apps/deploy-web/tests/unit/setup.ts(1 hunks)apps/deploy-web/tests/unit/websocketMock.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/deploy-web/src/hooks/useProviderWebsocket.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/deploy-web/src/services/provider-proxy/logFormatters.ts
- apps/deploy-web/package.json
- apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts
- apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/tests/unit/setup.tsapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/tests/unit/websocketMock.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsxapps/deploy-web/src/lib/XTerm/XTerm.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/utils/timer.tsapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/utils/array.tsapps/deploy-web/src/services/app-di-container/browser-di-container.tsapps/deploy-web/src/lib/websocket/WebsocketSession.tsapps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsxapps/deploy-web/src/components/deployments/ShellDownloadModal.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/jest.config.tsapps/deploy-web/src/lib/websocket/createWebsocket.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/src/hooks/useProviderApiActions.tsxapps/deploy-web/src/components/shared/SelectCheckbox.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/tests/unit/setup.tsapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/tests/unit/websocketMock.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsxapps/deploy-web/src/lib/XTerm/XTerm.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/utils/timer.tsapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/utils/array.tsapps/deploy-web/src/services/app-di-container/browser-di-container.tsapps/deploy-web/src/lib/websocket/WebsocketSession.tsapps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsxapps/deploy-web/src/components/deployments/ShellDownloadModal.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/jest.config.tsapps/deploy-web/src/lib/websocket/createWebsocket.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/src/hooks/useProviderApiActions.tsxapps/deploy-web/src/components/shared/SelectCheckbox.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
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
Files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
🧠 Learnings (16)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Applied to files:
apps/deploy-web/tests/unit/setup.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
📚 Learning: 2025-07-21T08:24:24.269Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-07-21T08:24:24.269Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` to mock dependencies in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test.
Applied to files:
apps/deploy-web/tests/unit/websocketMock.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/jest.config.ts
📚 Learning: 2025-07-27T12:16:08.566Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-07-27T12:16:08.566Z
Learning: Applies to **/*.{js,ts,tsx} : Never use deprecated methods from libraries.
Applied to files:
apps/deploy-web/src/lib/XTerm/XTerm.tsxapps/deploy-web/jest.config.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/jest.config.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Applied to files:
apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Applied to files:
apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsxapps/deploy-web/jest.config.ts
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx
📚 Learning: 2025-08-20T11:41:36.039Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1740
File: apps/log-collector/src/services/pod-logs-collector/pod-logs-collector.service.ts:127-145
Timestamp: 2025-08-20T11:41:36.039Z
Learning: In log collection services like PodLogsCollectorService, write promises for continuous log streaming are intentionally long-running and expected to remain pending during normal operation. Using Promise.all to wait for both write and streaming promises ensures proper error propagation from either stream, which is the correct pattern for long-running log collection processes.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/src/components/shared/SelectCheckbox.tsx
📚 Learning: 2025-07-27T12:16:08.566Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-07-27T12:16:08.566Z
Learning: Applies to **/*.{js,ts,tsx} : Don't add unnecessary comments to the code
Applied to files:
apps/deploy-web/jest.config.ts
📚 Learning: 2025-07-24T17:00:52.361Z
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
📚 Learning: 2025-10-17T10:04:00.940Z
Learnt from: jzsfkzm
Repo: akash-network/console PR: 1994
File: apps/deploy-web/src/hooks/useListSelection/useListSelection.spec.ts:58-64
Timestamp: 2025-10-17T10:04:00.940Z
Learning: In the Akash Console deployment list multi-select feature (PR #1994, apps/deploy-web/src/hooks/useListSelection), the requirement is for additive Shift+click behavior: subsequent Shift+clicks should expand/add to the existing selection rather than replacing the previous Shift range. This differs from canonical Gmail/Finder-style replacement behavior.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsx
🧬 Code graph analysis (11)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (6)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-61)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
ProviderProxyMessage(412-415)LogEntryMessage(417-421)K8sEventMessage(423-436)apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
SelectCheckbox(67-124)
apps/deploy-web/tests/unit/websocketMock.ts (1)
apps/deploy-web/src/utils/timer.ts (1)
wait(26-30)
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (2)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-72)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts (3)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (2)
createWebsocket(3-97)waitForEvent(110-133)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)apps/deploy-web/src/utils/timer.ts (1)
wait(26-30)
apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
apps/deploy-web/src/services/deployment-storage/deployment-storage.service.ts (1)
DeploymentStorageService(5-51)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (4)
WsEvents(99-102)createWebsocket(3-97)waitForEvent(110-133)CreateWebsocketInput(104-108)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts (2)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
ProviderProxyService(17-317)LogEntryMessage(417-421)K8sEventMessage(423-436)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (4)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-61)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
ReceivedShellMessage(324-330)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (1)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
cleanup(45-49)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-72)
apps/deploy-web/src/hooks/useProviderApiActions.tsx (1)
apps/deploy-web/src/types/provider.ts (1)
ApiProviderList(185-273)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
🔇 Additional comments (17)
apps/deploy-web/src/utils/timer.ts (1)
26-29: LGTM! Improved type safety.The explicit return type annotation and typed Promise constructor enhance type clarity and align with TypeScript best practices. The implementation is correct and straightforward.
apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts (1)
56-62: LGTM! Good optimization for referential stability.Memoizing the return object ensures stable references across re-renders, which is particularly valuable in the context of this refactor involving streaming and WebSocket connections where reference changes can trigger unnecessary reconnections or re-subscriptions.
apps/deploy-web/tests/unit/setup.ts (2)
7-11: LGTM! Standard test environment setup.The global assignment of TextDecoder, TextEncoder, and Blob is a standard pattern for exposing Node.js APIs that match browser globals in test environments.
4-4: LGTM! Migration to native Blob is fully compatible and safe.The project requires Node.js 22.14.0, which is well above the v15.7.0+ minimum needed for native Blob support. The switch from BlobPolyfill to Node.js's native implementation is a good improvement that simplifies dependencies and leverages native functionality.
apps/deploy-web/jest.config.ts (1)
9-9: Good refactoring to use thesatisfiesoperator.The change from a type annotation to the
satisfiesoperator is a modern TypeScript pattern that provides compile-time type checking while preserving the narrower inferred type. This improves type inference and autocomplete for downstream usage. The type correction fromConfig.InitialOptionstoConfig.InitialProjectOptionsalso better reflects the actual usage context.Also applies to: 17-17
apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
58-60: LGTM! Clean dependency injection pattern.The addition of
windowLocationandwindowHistoryas injectable dependencies improves testability while maintaining type safety. This follows the existing container patterns and enables proper mocking in tests.apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (3)
70-70: LGTM! Dependency injection improves testability.The component now receives
windowLocationandwindowHistoryas injected dependencies, making it easier to test without relying on global state.
92-107: Proper usage of injected dependencies.The URL parsing and history manipulation now correctly use the injected
windowLocationandwindowHistoryinstead of accessing globals directly.
166-166: Consistent with the dependency injection pattern.Using
windowLocation.originmaintains consistency with other changes in this refactoring.apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1)
182-200: Mocking approach works but could be simplified.The spread operator on
window.locationandwindow.historyobjects may not copy all properties (they have getters and non-enumerable properties), but for the purposes of this test mock, it's sufficient since the component only accesses specific properties.Alternatively, you could simplify by creating plain mock objects directly:
const windowLocation = input.windowLocation || { href: "http://localhost/onboarding", origin: "http://localhost", search: "" }; const windowHistory = input.windowHistory || { replaceState: jest.fn() };This avoids depending on the global window object structure.
apps/deploy-web/src/components/shared/SelectCheckbox.tsx (4)
58-65: Well-structured conversion to controlled component pattern.The Props interface correctly implements the controlled component pattern by replacing
defaultValuewithselectedand requiringonSelectedChange. This gives parent components full control over the selection state and is more testable.
68-78: Good simplification and correct controlled pattern implementation.Removing
useMemoforisAllSelectedis appropriate—the length comparison is inexpensive and doesn't warrant memoization overhead. ThehandleChangelogic correctly delegates state updates to the parent viaonSelectedChange, and the "Select All" toggle logic works correctly with the controlledselectedprop.
82-97: Placeholder implementation is complete and correct.The placeholder feature is properly integrated across all Material-UI components:
shrink={!!placeholder}on InputLabel ensures the label moves when a placeholder is presentrenderValuecorrectly shows the placeholder for empty selectionsdisplayEmpty={true}enables rendering when the value is an empty arraynotched={!!placeholder}applies proper styling for the outlined variantAll changes work together cohesively.
116-116: Excellent bug fix:indexOftoincludes.This change fixes a critical bug.
indexOfreturns0(falsy) when the option is at index 0, causing the checkbox to appear unchecked even when the first option is selected. Usingincludesreturns the correct boolean value.apps/deploy-web/src/lib/XTerm/XTerm.tsx (3)
9-9: LGTM: Type import added correctly.The
IDisposableimport is necessary for the new disposable helper function and follows TypeScript best practices.
214-223: LGTM: Event listener management implemented correctly.The refactoring to manage terminal event listeners via
useEffecthooks is well-executed:
- Dependency arrays correctly include only the callback props, excluding
terminalRef.current(past review concern has been resolved)- Optional chaining safely handles cases where the terminal isn't initialized
- Proper cleanup via disposables prevents memory leaks
- Reactive pattern allows callbacks to update when props change
The repetition across 10 event types is acceptable given that each listener type requires distinct handling.
236-239: LGTM: Clean disposable helper implementation.The helper function correctly converts xterm's
IDisposableto React's cleanup function pattern, properly handling the undefined case.
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
Outdated
Show resolved
Hide resolved
411b928 to
b3e8aa1
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (1)
118-149: Restart the log stream when the network changesThis effect reads
networkStore.selectedNetworkIdbut it isn’t listed in the dependency array, so switching chains never re-runs the stream setup and we stay attached to the previous provider. Please include the network ID (and any other captured networkStore fields) so the abort/reconnect logic fires on network changes.- }, [providerCredentials.details, selectedLogsMode, selectedLease, selectedServices, services?.length, providerInfo?.owner, providerInfo?.hostUri]); + }, [ + providerCredentials.details, + selectedLogsMode, + selectedLease, + selectedServices, + services?.length, + providerInfo?.owner, + providerInfo?.hostUri, + networkStore.selectedNetworkId + ]);apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (1)
77-99: Recreate the shell session on chain switches
shellSessioncapturesnetworkStore.selectedNetworkId, but the memo’s dependency list omits it. After a user flips mainnet/testnet, we keep using the old connection and commands hit the wrong provider. Add the network ID (and any other captured networkStore fields) to the dependency array so the session is rebuilt on network changes.- }, [providerInfo, providerCredentials.details, selectedLease, selectedService]); + }, [providerInfo, providerCredentials.details, selectedLease, selectedService, networkStore.selectedNetworkId]);
🧹 Nitpick comments (1)
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (1)
336-336: Drop the leftover console logging.This debug
console.logleaks noise into test output without affecting assertions—please remove it to keep the suite quiet.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (22)
apps/deploy-web/package.json(0 hunks)apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx(9 hunks)apps/deploy-web/src/components/deployments/DeploymentLogs.tsx(8 hunks)apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx(1 hunks)apps/deploy-web/src/components/shared/SelectCheckbox.tsx(3 hunks)apps/deploy-web/src/hooks/useProviderApiActions.tsx(1 hunks)apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts(1 hunks)apps/deploy-web/src/hooks/useProviderWebsocket.ts(0 hunks)apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts(1 hunks)apps/deploy-web/src/lib/XTerm/XTerm.tsx(3 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.ts(1 hunks)apps/deploy-web/src/queries/useLeaseQuery.spec.tsx(2 hunks)apps/deploy-web/src/services/provider-proxy/logFormatters.ts(1 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts(14 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts(6 hunks)apps/deploy-web/src/utils/array.ts(1 hunks)apps/deploy-web/src/utils/timer.ts(1 hunks)apps/deploy-web/tests/unit/setup.ts(1 hunks)apps/deploy-web/tests/unit/websocketMock.ts(1 hunks)
💤 Files with no reviewable changes (2)
- apps/deploy-web/src/hooks/useProviderWebsocket.ts
- apps/deploy-web/package.json
🚧 Files skipped from review as they are similar to previous changes (9)
- apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
- apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts
- apps/deploy-web/src/lib/websocket/createWebsocket.ts
- apps/deploy-web/src/utils/timer.ts
- apps/deploy-web/src/lib/websocket/WebsocketSession.ts
- apps/deploy-web/tests/unit/setup.ts
- apps/deploy-web/src/services/provider-proxy/logFormatters.ts
- apps/deploy-web/src/lib/XTerm/XTerm.tsx
- apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/hooks/useProviderApiActions.tsxapps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/utils/array.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/tests/unit/websocketMock.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/hooks/useProviderApiActions.tsxapps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/utils/array.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/tests/unit/websocketMock.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
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
Files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx
📚 Learning: 2025-10-17T10:04:00.940Z
Learnt from: jzsfkzm
Repo: akash-network/console PR: 1994
File: apps/deploy-web/src/hooks/useListSelection/useListSelection.spec.ts:58-64
Timestamp: 2025-10-17T10:04:00.940Z
Learning: In the Akash Console deployment list multi-select feature (PR #1994, apps/deploy-web/src/hooks/useListSelection), the requirement is for additive Shift+click behavior: subsequent Shift+clicks should expand/add to the existing selection rather than replacing the previous Shift range. This differs from canonical Gmail/Finder-style replacement behavior.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsx
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function must be at the bottom of the root `describe` block in test files
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:24:24.269Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-07-21T08:24:24.269Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` to mock dependencies in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test.
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/tests/unit/websocketMock.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-08-20T11:41:36.039Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1740
File: apps/log-collector/src/services/pod-logs-collector/pod-logs-collector.service.ts:127-145
Timestamp: 2025-08-20T11:41:36.039Z
Learning: In log collection services like PodLogsCollectorService, write promises for continuous log streaming are intentionally long-running and expected to remain pending during normal operation. Using Promise.all to wait for both write and streaming promises ensures proper error propagation from either stream, which is the correct pattern for long-running log collection processes.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-24T17:00:52.361Z
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
🧬 Code graph analysis (8)
apps/deploy-web/src/hooks/useProviderApiActions.tsx (1)
apps/deploy-web/src/types/provider.ts (1)
ApiProviderList(185-273)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (6)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-61)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
ProviderProxyMessage(412-415)LogEntryMessage(417-421)K8sEventMessage(423-436)apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
SelectCheckbox(67-124)
apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts (3)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (2)
createWebsocket(3-97)waitForEvent(110-133)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)apps/deploy-web/src/utils/timer.ts (1)
wait(26-30)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts (2)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
LogEntryMessage(417-421)K8sEventMessage(423-436)WS_ERRORS(13-15)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (4)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-61)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
ReceivedShellMessage(324-330)
apps/deploy-web/tests/unit/websocketMock.ts (1)
apps/deploy-web/src/utils/timer.ts (1)
wait(26-30)
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (2)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-74)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
bcd30d4 to
295e267
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (1)
117-149: Restart the stream when network or service set changesThis effect uses
networkStore.selectedNetworkIdand the fullserviceslist, but the dependency array omits both. After a network switch we keep streaming the previous chain, and if the provider changes the concrete service names while keeping the same count, the array length stays identical so we never resubscribe. Please add these dependencies so we tear down and recreate the stream whenever the network context or service set changes.- }, [providerCredentials.details, selectedLogsMode, selectedLease, selectedServices, services?.length, providerInfo?.owner, providerInfo?.hostUri]); + }, [ + providerCredentials.details, + selectedLogsMode, + selectedLease, + selectedServices, + services, + services?.length, + providerInfo?.owner, + providerInfo?.hostUri, + networkStore.selectedNetworkId + ]);apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (1)
77-99: AddnetworkStore.selectedNetworkIdto the dependency array.The
shellSessionmemo closes overnetworkStore.selectedNetworkId(line 88) but doesn't list it in the dependency array. When the user switches networks, the old session remains active, causing commands to run against the stale network connection.Apply this diff:
- }, [providerInfo, providerCredentials.details, selectedLease, selectedService]); + }, [providerInfo, providerCredentials.details, selectedLease, selectedService, networkStore.selectedNetworkId]);
🧹 Nitpick comments (1)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
149-229: Consider minor cleanup in error handling.Two small improvements:
Line 189: The
!non-null assertion is redundant since the ternary already checksfileContent:errorMessage = fileContent ? textDecoder.decode(fileContent).trim() : "Did not receive file content from server";Line 196:
session.disconnect()is not awaited before breaking. While this probably works since the function exits, awaiting would ensure proper cleanup:await session.disconnect();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (23)
apps/deploy-web/package.json(0 hunks)apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx(9 hunks)apps/deploy-web/src/components/deployments/DeploymentLogs.tsx(8 hunks)apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsx(1 hunks)apps/deploy-web/src/components/shared/SelectCheckbox.tsx(3 hunks)apps/deploy-web/src/hooks/useProviderApiActions.tsx(1 hunks)apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts(1 hunks)apps/deploy-web/src/hooks/useProviderWebsocket.ts(0 hunks)apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts(1 hunks)apps/deploy-web/src/lib/XTerm/XTerm.tsx(3 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.ts(1 hunks)apps/deploy-web/src/queries/useLeaseQuery.spec.tsx(2 hunks)apps/deploy-web/src/services/provider-proxy/logFormatters.ts(1 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts(14 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts(6 hunks)apps/deploy-web/src/utils/array.ts(1 hunks)apps/deploy-web/src/utils/timer.ts(1 hunks)apps/deploy-web/tests/unit/setup.ts(1 hunks)apps/deploy-web/tests/unit/websocketMock.ts(1 hunks)
💤 Files with no reviewable changes (2)
- apps/deploy-web/package.json
- apps/deploy-web/src/hooks/useProviderWebsocket.ts
🚧 Files skipped from review as they are similar to previous changes (12)
- apps/deploy-web/src/lib/XTerm/XTerm.tsx
- apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts
- apps/deploy-web/src/utils/array.ts
- apps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsx
- apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
- apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts
- apps/deploy-web/src/components/shared/SelectCheckbox.tsx
- apps/deploy-web/src/services/provider-proxy/logFormatters.ts
- apps/deploy-web/tests/unit/websocketMock.ts
- apps/deploy-web/src/lib/websocket/createWebsocket.ts
- apps/deploy-web/src/utils/timer.ts
- apps/deploy-web/src/hooks/useProviderApiActions.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.tsapps/deploy-web/src/components/deployments/ShellDownloadModal.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/tests/unit/setup.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/src/components/deployments/DeploymentLogs.tsxapps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.tsapps/deploy-web/src/components/deployments/ShellDownloadModal.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/tests/unit/setup.ts
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
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
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
🧠 Learnings (13)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:24:24.269Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-07-21T08:24:24.269Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` to mock dependencies in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function must be at the bottom of the root `describe` block in test files
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.spec.tsapps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx
📚 Learning: 2025-07-24T17:00:52.361Z
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
🧬 Code graph analysis (6)
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (3)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
ReceivedShellMessage(324-330)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (5)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
ProviderProxyMessage(412-415)LogEntryMessage(417-421)K8sEventMessage(423-436)apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
SelectCheckbox(67-124)
apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts (3)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (2)
createWebsocket(3-100)waitForEvent(113-136)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)apps/deploy-web/src/utils/timer.ts (1)
wait(26-30)
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (2)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-74)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (4)
WsEvents(102-105)createWebsocket(3-100)waitForEvent(113-136)CreateWebsocketInput(107-111)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: validate / validate-app
- GitHub Check: validate / validate-app
🔇 Additional comments (2)
apps/deploy-web/tests/unit/setup.ts (1)
4-11: LGTM! Clean consolidation of global polyfills.The refactoring removes the unnecessary alias and consolidates the global assignment into a single
Object.assigncall, making the code more consistent and maintainable.apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
1-84: Well-designed WebSocket abstraction.The
WebsocketSessionclass provides a clean abstraction for managing WebSocket lifecycle with lazy connection, message queuing, async iteration, and proper cleanup. The implementation correctly handles edge cases like queueing messages before the connection opens and filtering ping/pong messages.
295e267 to
6d5286b
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (1)
77-99: Include the network ID in the session memo dependencies
shellSessioncloses overnetworkStore.selectedNetworkId, but the memo’s dependency list omits it. After a network switch the shell stays bound to the old provider, which is incorrect. Add the network ID (and any other captured networkStore fields) so the memo recreates the session for the new chain.- }, [providerInfo, providerCredentials.details, selectedLease, selectedService]); + }, [providerInfo, providerCredentials.details, selectedLease, selectedService, networkStore.selectedNetworkId]);apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (1)
117-149: Restart the log stream when the network changesThe streaming effect captures
networkStore.selectedNetworkIdbut the dependency array omits it, so switching networks leaves the component subscribed to the old chain. Please include the network ID (and any other captured networkStore values) so the effect tears down and re-establishes the stream with the correct provider context.- }, [providerCredentials.details, selectedLogsMode, selectedLease, selectedServices, services?.length, providerInfo?.owner, providerInfo?.hostUri]); + }, [ + providerCredentials.details, + selectedLogsMode, + selectedLease, + selectedServices, + services?.length, + providerInfo?.owner, + providerInfo?.hostUri, + networkStore.selectedNetworkId + ]);apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
408-410: Removeanyfrom certificate helperProject guidelines forbid
any. Please switch the helper to acceptunknownand narrow at runtime so we stay type-safe.-function isInvalidProviderCertificate(event: Record<string, any>): boolean { - return "code" in event && "reason" in event && event.code === WS_ERRORS.VIOLATED_POLICY && event.reason.startsWith("invalidCertificate."); +function isInvalidProviderCertificate(event: unknown): boolean { + if (typeof event !== "object" || event === null) { + return false; + } + if (!("code" in event) || !("reason" in event)) { + return false; + } + const { code, reason } = event as { code: unknown; reason: unknown }; + return typeof code === "number" && typeof reason === "string" && code === WS_ERRORS.VIOLATED_POLICY && reason.startsWith("invalidCertificate."); }As per coding guidelines
🧹 Nitpick comments (1)
apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
77-77: Remove unnecessary optional chaining.Since
onSelectedChangeis a required prop (line 61), the optional chaining operator is unnecessary.Apply this diff:
- onSelectedChange?.(newValue); + onSelectedChange(newValue);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (23)
apps/deploy-web/package.json(0 hunks)apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx(9 hunks)apps/deploy-web/src/components/deployments/DeploymentLogs.tsx(8 hunks)apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx(1 hunks)apps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsx(1 hunks)apps/deploy-web/src/components/shared/SelectCheckbox.tsx(3 hunks)apps/deploy-web/src/hooks/useProviderApiActions.tsx(1 hunks)apps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.ts(1 hunks)apps/deploy-web/src/hooks/useProviderWebsocket.ts(0 hunks)apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts(1 hunks)apps/deploy-web/src/lib/XTerm/XTerm.tsx(3 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/WebsocketSession.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts(1 hunks)apps/deploy-web/src/lib/websocket/createWebsocket.ts(1 hunks)apps/deploy-web/src/queries/useLeaseQuery.spec.tsx(2 hunks)apps/deploy-web/src/services/provider-proxy/logFormatters.ts(1 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts(14 hunks)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts(6 hunks)apps/deploy-web/src/utils/array.ts(1 hunks)apps/deploy-web/src/utils/timer.ts(1 hunks)apps/deploy-web/tests/unit/setup.ts(1 hunks)apps/deploy-web/tests/unit/websocketMock.ts(1 hunks)
💤 Files with no reviewable changes (2)
- apps/deploy-web/package.json
- apps/deploy-web/src/hooks/useProviderWebsocket.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- apps/deploy-web/src/utils/timer.ts
- apps/deploy-web/src/hooks/useScopedFetchProviderUrl.ts
- apps/deploy-web/src/lib/websocket/createWebsocket.spec.ts
- apps/deploy-web/src/hooks/useProviderApiActions.tsx
- apps/deploy-web/src/lib/XTerm/XTerm.tsx
- apps/deploy-web/src/lib/websocket/WebsocketSession.ts
- apps/deploy-web/tests/unit/websocketMock.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
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
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
apps/{deploy-web,provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations in.spec.tsxfiles
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/components/deployments/ShellDownloadModal.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/utils/array.tsapps/deploy-web/src/lib/websocket/createWebsocket.tsapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/services/provider-proxy/logFormatters.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/tests/unit/setup.tsapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/src/components/deployments/DeploymentLogs.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/hooks/useProviderCredentials/useProviderCredentials.tsapps/deploy-web/src/components/deployments/ShellDownloadModal.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/utils/array.tsapps/deploy-web/src/lib/websocket/createWebsocket.tsapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.tsapps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/services/provider-proxy/logFormatters.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.tsapps/deploy-web/tests/unit/setup.tsapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsxapps/deploy-web/src/components/deployments/DeploymentLogs.tsx
🧠 Learnings (17)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-07-21T08:24:27.953Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-07-21T08:24:27.953Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-21T08:24:24.269Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-07-21T08:24:24.269Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` to mock dependencies in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test.
Applied to files:
apps/deploy-web/src/queries/useLeaseQuery.spec.tsxapps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsxapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function must be at the bottom of the root `describe` block in test files
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` function
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-21T08:25:07.474Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-07-21T08:25:07.474Z
Learning: Applies to **/*.spec.{ts,tsx} : `setup` function creates an object under test and returns it
Applied to files:
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.tsapps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
📚 Learning: 2025-07-03T14:40:49.886Z
Learnt from: jzsfkzm
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/lib/websocket/createWebsocket.ts
📚 Learning: 2025-07-24T17:00:52.361Z
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
📚 Learning: 2025-07-27T12:16:08.566Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-07-27T12:16:08.566Z
Learning: Applies to **/*.{ts,tsx} : Never use type any or cast to type any. Always define the proper TypeScript types.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 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.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsxapps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx
📚 Learning: 2025-10-17T10:04:00.940Z
Learnt from: jzsfkzm
Repo: akash-network/console PR: 1994
File: apps/deploy-web/src/hooks/useListSelection/useListSelection.spec.ts:58-64
Timestamp: 2025-10-17T10:04:00.940Z
Learning: In the Akash Console deployment list multi-select feature (PR #1994, apps/deploy-web/src/hooks/useListSelection), the requirement is for additive Shift+click behavior: subsequent Shift+clicks should expand/add to the existing selection rather than replacing the previous Shift range. This differs from canonical Gmail/Finder-style replacement behavior.
Applied to files:
apps/deploy-web/src/components/shared/SelectCheckbox.tsx
📚 Learning: 2025-08-20T11:41:36.039Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1740
File: apps/log-collector/src/services/pod-logs-collector/pod-logs-collector.service.ts:127-145
Timestamp: 2025-08-20T11:41:36.039Z
Learning: In log collection services like PodLogsCollectorService, write promises for continuous log streaming are intentionally long-running and expected to remain pending during normal operation. Using Promise.all to wait for both write and streaming promises ensures proper error propagation from either stream, which is the correct pattern for long-running log collection processes.
Applied to files:
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts
🧬 Code graph analysis (7)
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (2)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-74)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/lib/websocket/createWebsocket.ts (1)
apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
cleanup(45-49)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/lib/websocket/WebsocketSession.ts (1)
WebsocketSession(4-74)
apps/deploy-web/src/services/provider-proxy/logFormatters.ts (1)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (2)
LogEntryMessage(417-421)K8sEventMessage(423-436)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.spec.ts (2)
apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (4)
ProviderProxyService(17-317)LogEntryMessage(417-421)K8sEventMessage(423-436)WS_ERRORS(13-15)apps/deploy-web/tests/unit/websocketMock.ts (2)
dispatchWsEvent(5-13)createWebsocketMock(15-27)
apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (4)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-61)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (1)
ReceivedShellMessage(324-330)
apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (6)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(30-32)apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
services(25-61)apps/deploy-web/src/utils/array.ts (1)
forEachGeneratedItem(9-13)apps/deploy-web/src/services/provider-proxy/provider-proxy.service.ts (3)
ProviderProxyMessage(412-415)LogEntryMessage(417-421)K8sEventMessage(423-436)apps/deploy-web/src/services/provider-proxy/logFormatters.ts (2)
formatLogMessage(3-7)formatK8sEvent(9-12)apps/deploy-web/src/components/shared/SelectCheckbox.tsx (1)
SelectCheckbox(67-124)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: validate (apps/indexer) / validate-unsafe
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
🔇 Additional comments (10)
apps/deploy-web/src/components/shared/SelectCheckbox.tsx (3)
60-60: Good refactor to controlled component.Replacing
defaultValuewith theselectedprop makes this a proper controlled component, which addresses the state management issues flagged in previous reviews. The optionalplaceholderprop is a nice UX enhancement.Also applies to: 63-63
91-92: Placeholder implementation looks good.The
renderValueanddisplayEmptyprops correctly implement placeholder behavior when no items are selected.
116-116: Good use ofincludes()for readability.Using
includes()is cleaner and more readable than the previousindexOf()approach.apps/deploy-web/src/lib/websocket/createWebsocket.ts (2)
33-43: LGTM!The ping interval now properly checks
readyStatebefore sending and clears the timer when the socket is not open, preventing theInvalidStateErrorthat was flagged in previous reviews.
81-83: LGTM!Error handling now dispatches the full error object, ensuring consumers receive complete error context even when
error.causeis absent, addressing the previous review concern.apps/deploy-web/src/components/new-deployment/BidRow/BidRow.spec.tsx (1)
106-111: LGTM!The mock correctly reflects the refactored provider proxy API (
fetchProviderUrl→request), and the pending Promise is appropriate for this test scenario.apps/deploy-web/src/utils/array.ts (1)
9-13: LGTM!Clean utility function for processing async generators. The implementation correctly iterates and awaits each callback, with clear type signatures.
apps/deploy-web/src/components/deployments/ShellDownloadModal.tsx (1)
8-8: LGTM!Import consolidation aligns with the broader refactor removing
useProviderWebsocket. TheProviderInfotype is now correctly sourced fromuseProviderApiActionswhere it's defined.apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (1)
296-296: LGTM!The test correctly reflects the refactored provider proxy API (
fetchProviderUrl→request). Both mock setup and assertions are updated consistently.Also applies to: 319-325
apps/deploy-web/src/lib/websocket/WebsocketSession.spec.ts (1)
6-8: RemoveafterEachto follow coding guidelines.Per coding guidelines, avoid
beforeEachandafterEachin favor of thesetupfunction pattern. Movejest.useRealTimers()to module scope (outsidedescribeblocks) if timer cleanup is needed globally, or handle it within individual tests that use fake timers. As per coding guidelines.Apply this diff:
- afterEach(() => { - jest.useRealTimers(); - });And add at module scope if needed:
import { WebsocketSession } from "./WebsocketSession"; import { createWebsocketMock, dispatchWsEvent } from "@tests/unit/websocketMock"; +jest.useRealTimers(); describe(WebsocketSession.name, () => {⛔ Skipped due to learnings
Learnt from: CR Repo: akash-network/console PR: 0 File: .cursor/rules/setup-instead-of-before-each.mdc:0-0 Timestamp: 2025-07-21T08:25:07.474Z Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test filesLearnt from: CR Repo: akash-network/console PR: 0 File: .cursor/rules/setup-instead-of-before-each.mdc:0-0 Timestamp: 2025-07-21T08:25:07.474Z Learning: Applies to **/*.spec.{ts,tsx} : Don't use shared state in `setup` functionLearnt from: CR Repo: akash-network/console PR: 0 File: .cursor/rules/no-jest-mock.mdc:0-0 Timestamp: 2025-07-21T08:24:24.269Z Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` to mock dependencies in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test.Learnt from: CR Repo: akash-network/console PR: 0 File: .cursor/rules/setup-instead-of-before-each.mdc:0-0 Timestamp: 2025-07-21T08:25:07.474Z Learning: Applies to **/*.spec.{ts,tsx} : `setup` function must be at the bottom of the root `describe` block in test filesLearnt from: CR Repo: akash-network/console PR: 0 File: .cursor/rules/setup-instead-of-before-each.mdc:0-0 Timestamp: 2025-07-21T08:25:07.474Z Learning: Applies to **/*.spec.{ts,tsx} : Don't specify return type of `setup` functionLearnt from: CR Repo: akash-network/console PR: 0 File: .cursor/rules/setup-instead-of-before-each.mdc:0-0 Timestamp: 2025-07-21T08:25:07.474Z Learning: Applies to **/*.spec.{ts,tsx} : `setup` function should accept a single parameter with inline type definition
Why
Logic to format and get logs is currently in 2 different places (service layer and hook layer). This makes it hard to maintain code, write tests and report errors to sentry. Blocked by #2179
Summary by CodeRabbit