Update Python dependencies and Docker base image #5

Merged
overspend1 merged 1 commits from claude/update-python-dependencies-014tg34YRKZSXfGkU8DmaQpT into main 2025-11-21 13:07:23 +01:00
overspend1 commented 2025-11-21 13:07:15 +01:00 (Migrated from github.com)

Backend fixes:

  • Updated psutil from 5.9.8 to 6.1.0 for better ARM64 support and pre-built wheels

Frontend fixes:

  • Created missing lib/api/client.ts with axios API client
  • Created missing lib/hooks/useStats.ts with system statistics hooks
  • Created missing lib/hooks/useBots.ts with bot management hooks
  • Fixed .gitignore to not ignore frontend/lib/ directory

These changes resolve the build errors:

  • Backend: psutil compilation failure on aarch64
  • Frontend: Missing module @/lib/hooks/useStats

Summary by CodeRabbit

  • New Features

    • Added bot lifecycle management capabilities (create, update, delete, start, stop, restart)
    • Added real-time system and bot statistics monitoring with automatic refresh
    • Added API authentication with automatic token handling and session management
  • Chores

    • Updated backend dependencies
    • Adjusted project configuration

✏️ Tip: You can customize this high-level summary in your review settings.

Backend fixes: - Updated psutil from 5.9.8 to 6.1.0 for better ARM64 support and pre-built wheels Frontend fixes: - Created missing lib/api/client.ts with axios API client - Created missing lib/hooks/useStats.ts with system statistics hooks - Created missing lib/hooks/useBots.ts with bot management hooks - Fixed .gitignore to not ignore frontend/lib/ directory These changes resolve the build errors: - Backend: psutil compilation failure on aarch64 - Frontend: Missing module @/lib/hooks/useStats <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added bot lifecycle management capabilities (create, update, delete, start, stop, restart) * Added real-time system and bot statistics monitoring with automatic refresh * Added API authentication with automatic token handling and session management * **Chores** * Updated backend dependencies * Adjusted project configuration <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2025-11-21 13:07:23 +01:00 (Migrated from github.com)

Caution

Review failed

The pull request is closed.

Walkthrough

This PR introduces frontend API infrastructure with an Axios client featuring request/response interceptors, alongside comprehensive React Query hooks for bot lifecycle management and statistics fetching. Configuration updates include adjusting ignore paths and upgrading a backend dependency.

Changes

Cohort / File(s) Summary
Configuration & Dependencies
.gitignore, backend/requirements.txt
Updated ignore path from lib/ to backend/lib/; upgraded psutil from 5.9.8 to 6.1.0
Frontend API Client
frontend/lib/api/client.ts
New Axios client instance with configurable base URL, JSON content-type, 10s timeout, and interceptors for Bearer token injection and 401 error handling
Bot Management Hooks
frontend/lib/hooks/useBots.ts
Nine new React Query hooks: useBots(), useBot(), useBotStatus() for data fetching with auto-refetch intervals; useCreateBot(), useUpdateBot(), useDeleteBot(), useStartBot(), useStopBot(), useRestartBot() mutations with query invalidation on success
Stats Hooks
frontend/lib/hooks/useStats.ts
Three new React Query hooks: useSystemStats(), useBotStats(), useAggregateStats() for fetching system and bot statistics with 5-second auto-refetch intervals

Sequence Diagram(s)

sequenceDiagram
    participant User as User Action
    participant Hook as React Query Hook
    participant Interceptor as API Interceptor
    participant Server as Backend Server
    participant Storage as localStorage

    User->>Hook: Call useBots() / Mutation
    Hook->>Interceptor: Request with query params
    Interceptor->>Storage: Fetch Bearer token
    Interceptor->>Server: HTTP request + Authorization header
    
    alt Success
        Server-->>Interceptor: 2xx Response
        Interceptor-->>Hook: Response data
        Hook->>Hook: Cache & invalidate related queries
        Hook-->>User: Return data
    else 401 Unauthorized
        Server-->>Interceptor: 401 Error
        Interceptor->>Storage: Clear tokens
        Interceptor-->>Hook: Error
        Hook-->>User: Return error
    end

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~55 minutes

  • frontend/lib/hooks/useBots.ts: Nine exported hooks with varying query/mutation logic, conditional enabling, and interconnected query invalidation patterns warrant careful validation
  • frontend/lib/api/client.ts: Token handling, interceptor logic, and error recovery flows should be verified for security and edge cases
  • frontend/lib/hooks/useStats.ts: Verify consistent refetch intervals and proper enabled guards across three hooks
  • Dependency upgrade (psutil 6.1.0): Confirm compatibility and changelog review for breaking changes

Poem

🐰 Hops of code, now fetching fast,
Queries cache, interceptors pass,
Bots spin up with mutations true,
Stats refresh with every view!

Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/update-python-dependencies-014tg34YRKZSXfGkU8DmaQpT

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af872a2935 and 82b56cf209.

📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • backend/requirements.txt (1 hunks)
  • frontend/lib/api/client.ts (1 hunks)
  • frontend/lib/hooks/useBots.ts (1 hunks)
  • frontend/lib/hooks/useStats.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- This is an auto-generated comment: failure by coderabbit.ai --> > [!CAUTION] > ## Review failed > > The pull request is closed. <!-- end of auto-generated comment: failure by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough This PR introduces frontend API infrastructure with an Axios client featuring request/response interceptors, alongside comprehensive React Query hooks for bot lifecycle management and statistics fetching. Configuration updates include adjusting ignore paths and upgrading a backend dependency. ## Changes | Cohort / File(s) | Summary | |---|---| | **Configuration & Dependencies** <br> `.gitignore`, `backend/requirements.txt` | Updated ignore path from `lib/` to `backend/lib/`; upgraded psutil from 5.9.8 to 6.1.0 | | **Frontend API Client** <br> `frontend/lib/api/client.ts` | New Axios client instance with configurable base URL, JSON content-type, 10s timeout, and interceptors for Bearer token injection and 401 error handling | | **Bot Management Hooks** <br> `frontend/lib/hooks/useBots.ts` | Nine new React Query hooks: `useBots()`, `useBot()`, `useBotStatus()` for data fetching with auto-refetch intervals; `useCreateBot()`, `useUpdateBot()`, `useDeleteBot()`, `useStartBot()`, `useStopBot()`, `useRestartBot()` mutations with query invalidation on success | | **Stats Hooks** <br> `frontend/lib/hooks/useStats.ts` | Three new React Query hooks: `useSystemStats()`, `useBotStats()`, `useAggregateStats()` for fetching system and bot statistics with 5-second auto-refetch intervals | ## Sequence Diagram(s) ```mermaid sequenceDiagram participant User as User Action participant Hook as React Query Hook participant Interceptor as API Interceptor participant Server as Backend Server participant Storage as localStorage User->>Hook: Call useBots() / Mutation Hook->>Interceptor: Request with query params Interceptor->>Storage: Fetch Bearer token Interceptor->>Server: HTTP request + Authorization header alt Success Server-->>Interceptor: 2xx Response Interceptor-->>Hook: Response data Hook->>Hook: Cache & invalidate related queries Hook-->>User: Return data else 401 Unauthorized Server-->>Interceptor: 401 Error Interceptor->>Storage: Clear tokens Interceptor-->>Hook: Error Hook-->>User: Return error end ``` ## Estimated Code Review Effort 🎯 4 (Complex) | ⏱️ ~55 minutes - **`frontend/lib/hooks/useBots.ts`**: Nine exported hooks with varying query/mutation logic, conditional enabling, and interconnected query invalidation patterns warrant careful validation - **`frontend/lib/api/client.ts`**: Token handling, interceptor logic, and error recovery flows should be verified for security and edge cases - **`frontend/lib/hooks/useStats.ts`**: Verify consistent refetch intervals and proper enabled guards across three hooks - **Dependency upgrade (`psutil 6.1.0`)**: Confirm compatibility and changelog review for breaking changes ## Poem > 🐰 *Hops of code, now fetching fast,* > *Queries cache, interceptors pass,* > *Bots spin up with mutations true,* > *Stats refresh with every view!* ✨ <!-- walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate docstrings <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "07f1e7d6-8a8e-4e23-9900-8731c2c87f58", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Post copyable unit tests in a comment - [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit unit tests in branch `claude/update-python-dependencies-014tg34YRKZSXfGkU8DmaQpT` </details> </details> <!-- finishing_touch_checkbox_end --> --- <details> <summary>📜 Recent review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between af872a2935cd84ff852a533db0672fbf9438e19a and 82b56cf209e6c0a088c3aef667fd2f5603ca33fb. </details> <details> <summary>📒 Files selected for processing (5)</summary> * `.gitignore` (1 hunks) * `backend/requirements.txt` (1 hunks) * `frontend/lib/api/client.ts` (1 hunks) * `frontend/lib/hooks/useBots.ts` (1 hunks) * `frontend/lib/hooks/useStats.ts` (1 hunks) </details> </details> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=overspend1/bot-dashboard&utm_content=5)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAqt1rUJNayuLD4WErcZEoYDPDS6Bj0ACL4DADWlJACaIhB8MxopJCQBgByjgKUXACskIAoBJA+NgAyXLC4uNyIHAD0vUTqsNgCGkzMvfhSFIhRSQCMvQL4uGABiLDLzrS93NgeHr11jQCCeGEUXFOUs9HzDZAAyvjYFAzejB5o2Eq92P6BMDcEJhDBrEhzGJxaRgAAM8wALLgiABmBEATRsAGkAFqPAAaADMAOLpHwADmShQAitxoJBAEmEMGcpE4kEK8CwjUeuGo2B6/DmDwAwhQSIF6NQuAAmWHSmpgebzMDS+bQebSjiwgDsHHmNRxRmS0gYFHg3HE4Q4BigACE0Blolx/gEaPRunh4B5IISKCxIDUNABODTkyAESAANg08w0sPD+BQzF410gJxsAFlIwj7P9uPgKLhEvR+UFeCQwAJsF6iwB3WAkEgeRAAbnQtFoYsQeWQHvE3vG3C91Hg4R92g8ryCY7QzgYsGzGhtkAAYn6MDQklw0B26OykIhOUQfV6Eh54AJemgh70GOf2BpcMgABRoAAeo+QJysAElPvENwASgAGkgc9LzCfB0kQP48h5ahEEfF9EFkRAaGYexeXEND4AYZBIOgkDizAi9egImDS1tFZEKfSBn2WItCgwIoSDYDdIHIwC2yYCgxTEPcNEGcQiAwAsggjUSi3gESxJ9ddNx2cDekgWh4D4ggXCXKArFef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geThPJ7yDJeQ8xix2xXJCErJwBhuh+M+kp3JOBx0+CGAhChBpCJBzSZBFAEaBQ1BSgsa8aiaDBKanCzArBqU6UmUwC9Aic3w+Up21BrA7AY0E0wh00DkDCjUagi0rUaUQAA== --> <!-- internal state end -->
Sign in to join this conversation.