Skip to content

feat: safe mode go script handling#2193

Merged
limetech merged 3 commits into
masterfrom
feat-safe-mode-go-script
May 20, 2025
Merged

feat: safe mode go script handling#2193
limetech merged 3 commits into
masterfrom
feat-safe-mode-go-script

Conversation

@ljm42

@ljm42 ljm42 commented May 9, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added support for running a "go.safemode" script when the system is in safe mode, providing enhanced flexibility during startup.
  • Bug Fixes
    • Improved diagnostics by including both "go" and "go.safemode" files, with sensitive information anonymized as needed.
    • Added a fallback to ensure the emhttp daemon starts if not already running after executing the startup script.

@coderabbitai

coderabbitai Bot commented May 9, 2025

Copy link
Copy Markdown
Contributor

"""

Walkthrough

The changes update the handling of the "go" and "go.safemode" scripts in both diagnostics collection and system initialization. Diagnostics now processes and anonymizes both files if present, while the system startup script dynamically selects which script to run based on whether safe mode is enabled, and ensures the emhttp daemon is running.

Changes

File(s) Change Summary
emhttp/plugins/dynamix/scripts/diagnostics Updated to process both /boot/config/go and /boot/config/go.safemode files for copying and anonymization during diagnostics; added safe mode status output.
etc/rc.d/rc.local Modified to select and execute either "go" or "go.safemode" script based on safe mode detection, and added emhttp daemon fallback.

Sequence Diagram(s)

sequenceDiagram
    participant System Startup
    participant rc.local
    participant /boot/config/go
    participant /boot/config/go.safemode
    participant emhttp

    System Startup->>rc.local: Start initialization
    rc.local->>rc.local: Check for safe mode
    alt Safe Mode Detected
        rc.local->>/boot/config/go.safemode: Check & prepare script
        rc.local->>/boot/config/go.safemode: Execute script if exists
    else Normal Mode
        rc.local->>/boot/config/go: Check & prepare script
        rc.local->>/boot/config/go: Execute script if exists
    end
    rc.local->>emhttp: Start emhttp if not running
Loading
sequenceDiagram
    participant Diagnostics
    participant /boot/config/go
    participant /boot/config/go.safemode
    participant config_dir

    loop For each of go, go.safemode
        Diagnostics->>File: Check if exists
        alt Exists
            Diagnostics->>config_dir: Copy file with .txt extension
            Diagnostics->>config_dir: Anonymize sensitive lines if needed
        end
    end
Loading

Possibly related PRs

  • Diagnostics: remove wireless username/password from diagnostics #2070: The main PR extends anonymization and copying logic to multiple "go" config files, while the retrieved PR enhances anonymization for wireless credentials and other sensitive data in different diagnostics files; both modify diagnostics anonymization but target different files and data, so they are related but not overlapping in code.

Suggested labels

7.1

Poem

A rabbit hopped through scripts anew,
Now safe mode gets its moment too!
Diagnostics check both, not just one,
Anonymizing secrets before they're done.
Startup picks the right path to go,
Ensuring emhttp's always in tow—
Hooray for code that helps us grow! 🐇✨
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 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 9bd0658 and b6280ef.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/scripts/diagnostics (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/scripts/diagnostics
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@ljm42 ljm42 added the 7.2 label May 9, 2025
@ljm42 ljm42 force-pushed the feat-safe-mode-go-script branch from 13bb54e to 31e50e5 Compare May 10, 2025 16:21
@limetech limetech merged commit a420335 into master May 20, 2025
3 checks passed
@limetech limetech deleted the feat-safe-mode-go-script branch May 20, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants