Skip to content

Conversation

@pujitm
Copy link
Member

@pujitm pujitm commented Mar 28, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced the dependency installation process with proactive logging of warning messages to aid troubleshooting.
  • Refactor

    • Streamlined internal workflow and implemented minor formatting improvements for better clarity and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 28, 2025

Walkthrough

A new function, run_pnpm_install(), has been introduced to encapsulate the execution of the pnpm install command with production dependencies and offline preference. This function creates the necessary log directory, writes a warning note, and appends warning messages to /var/log/unraid-api/build-scripts.log when build scripts are ignored. The existing pnpm_install_unraid_api() function now calls this new function. Additionally, minor formatting improvements were made by removing unnecessary semicolons and blank lines to enhance code readability.

Changes

File Change Summary
plugin/.../rc.unraid-api - Added run_pnpm_install() to execute pnpm install with logging for build script warnings.
- Modified pnpm_install_unraid_api() to call run_pnpm_install().
- Minor formatting improvements: removed semicolons and blank lines in install(), uninstall(), and restore_pnpm_store().

Sequence Diagram(s)

sequenceDiagram
    participant API as pnpm_install_unraid_api()
    participant Runner as run_pnpm_install()
    participant Cmd as pnpm install Command
    participant Log as Build Scripts Log (/var/log/unraid-api/build-scripts.log)

    API->>Runner: Invoke run_pnpm_install()
    Runner->>Cmd: Execute "pnpm install --production --offline"
    Cmd-->>Runner: Return results & warnings
    Runner->>Log: Append warning messages
    Runner-->>API: Return final result
Loading

Poem

In the realm of code and command,
A new function takes its stand.
Logging warnings with a gentle hand,
Semicolons and blanks now banned.
Code’s melody refined and grand!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 0471f34 and 38239ac.

📒 Files selected for processing (1)
  • plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build API
  • GitHub Check: Build Web App
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@pujitm
Copy link
Member Author

pujitm commented Mar 28, 2025

since there isn't a native way to customize the pnpm reporter or suppress the 'ignored build scripts' warning message, i had chatgpt come up with a bash solution in the format of:

stdbuf -oL pnpm install --prod --ignore-workspace --store-dir=../.pnpm-store 2>&1 | sed $'/^╭ Warning/,/^╰/c\\\nSuppressed third-party scripts'

but we decided not to add it bc this is only a nice-to-have. adding a log message instead

@elibosley
Copy link
Member

Wait @pujitm didn't the build break on unraid anyway, any reason to add the deps in that case ?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (2)

15-15: Style improvement: removing unnecessary semicolon

Good cleanup of syntax by removing the unnecessary semicolon after true. In Bash, semicolons at the end of a line are optional when it's the last statement on the line.


18-18: Style improvement: removing unnecessary semicolon

Good cleanup of syntax by removing the unnecessary semicolon after true. This matches the change in line 15 and improves consistency.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between da342af and 0471f34.

📒 Files selected for processing (1)
  • plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test API
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api (2)

105-121: New function looks good with helpful logging for build scripts

The new run_pnpm_install() function effectively handles the pnpm install process while properly capturing and logging build script warnings. The implementation:

  1. Uses stdbuf -oL to ensure line-buffered output
  2. Creates log directories as needed
  3. Provides clear messaging about ignored build scripts

This addresses the PR objective of handling the warning message related to 'ignored build scripts' by logging them appropriately.

One suggestion to consider: The current implementation overwrites the log file each time. You might want to append the initial note rather than overwrite it to preserve historical logs:

-      echo "Note: The warning above is expected. Build scripts are intentionally ignored for security and performance reasons." > "$log_file"
+      echo "Note: The warning above is expected. Build scripts are intentionally ignored for security and performance reasons." >> "$log_file"

144-144: Good refactoring to use the new function

The code now properly calls the new run_pnpm_install function instead of directly running pnpm install. This maintains the same functionality while adding the enhanced logging capabilities.

@pujitm pujitm force-pushed the chore/install-warning branch from 0471f34 to 38239ac Compare March 28, 2025 17:31
@github-actions
Copy link
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1290/dynamix.unraid.net.plg

@pujitm pujitm changed the title chore(api): approve postinstall from deps fix(api): redirect benign pnpm postinstall warning to log file Mar 28, 2025
@pujitm pujitm merged commit 7fb7849 into main Mar 28, 2025
8 checks passed
@pujitm pujitm deleted the chore/install-warning branch March 28, 2025 17:50
elibosley pushed a commit that referenced this pull request Apr 2, 2025
🤖 I have created a release *beep* *boop*
---


## [4.5.0](v4.4.1...v4.5.0)
(2025-04-02)


### Features

* add webgui theme switcher component
([#1304](#1304))
([e2d00dc](e2d00dc))
* api plugin system & offline versioned dependency vendoring
([#1252](#1252))
([9f492bf](9f492bf))
* **api:** add `unraid-api --delete` command
([#1289](#1289))
([2f09445](2f09445))
* basic array controls
([#1291](#1291))
([61fe696](61fe696))
* basic docker controls
([#1292](#1292))
([12eddf8](12eddf8))
* copy to webgui repo script docs + wc build options
([#1285](#1285))
([e54f189](e54f189))


### Bug Fixes

* additional url fixes
([4b2763c](4b2763c))
* **api:** redirect benign pnpm postinstall warning to log file
([#1290](#1290))
([7fb7849](7fb7849))
* **deps:** update dependency chalk to v5
([#1296](#1296))
([6bed638](6bed638))
* **deps:** update dependency diff to v7
([#1297](#1297))
([3c6683c](3c6683c))
* disable all config watchers
([#1306](#1306))
([5c1b435](5c1b435))
* extract callbacks to library
([#1280](#1280))
([2266139](2266139))
* OEM plugin issues ([#1288](#1288))
([d5a3d0d](d5a3d0d))
* replace files lost during pruning
([d0d2ff6](d0d2ff6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants