Skip to content

Conversation

@CLHatch
Copy link
Contributor

@CLHatch CLHatch commented Jan 27, 2026

Pull request

Purpose
Describe the problem or feature in addition to a link to the issues.

Approach
How does this change address the problem?

Open Questions and Pre-Merge TODOs
Check all boxes as they are completed

  • Use github checklists. When solved, check the box and explain the answer.

Learning
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem

Requirements
Check all boxes as they are completed

Summary by Sourcery

Add a dedicated helper for safely setting file ownership and permissions and integrate it with the existing script runner.

New Features:

  • Introduce a set_permissions helper script to manage ownership and permissions for target paths with basic safety checks.

Enhancements:

  • Integrate the new set_permissions script with the existing run_script mechanism for consistent invocation across the project.

@CLHatch CLHatch requested a review from a team as a code owner January 27, 2026 19:52
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 27, 2026

Reviewer's Guide

Refactors script organization by introducing a dedicated .scripts directory with a new set_permissions helper script and a small cleanup in run_script.sh, adding permission-setting logic with safety checks and a test hook.

Sequence diagram for invoking the new set_permissions script via test_set_permissions

sequenceDiagram
    actor User
    participant Shell
    participant test_set_permissions
    participant run_script
    participant set_permissions

    User ->> Shell: execute DockSTARTer tests
    Shell ->> test_set_permissions: call function
    test_set_permissions ->> run_script: run_script set_permissions
    run_script ->> set_permissions: source and execute function
    set_permissions ->> set_permissions: validate CH_PATH safety
    set_permissions ->> set_permissions: optionally chown and chmod CH_PATH
    set_permissions ->> set_permissions: ensure SCRIPTNAME is executable
    set_permissions -->> run_script: return
    run_script -->> test_set_permissions: return
    test_set_permissions -->> Shell: return
Loading

File-Level Changes

Change Details Files
Introduce a reusable set_permissions helper script with safety checks around which paths can be modified and how ownership/permissions are applied.
  • Create .scripts/set_permissions.sh with set_permissions function that validates target path against system directories and home directory
  • Add logic to warn when changing permissions outside the detected home directory and to skip known system paths
  • Apply chown and chmod recursively to the target path when non-root PUID/PGID are detected, and ensure the main script is executable with proper error handling
  • Define a test_set_permissions function that delegates to run_script 'set_permissions'
.scripts/set_permissions.sh
Minor cleanup in run_script to prepare or align with new script layout.
  • Remove an unnecessary blank line before the script existence check to keep formatting consistent
includes/run_script.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@CLHatch CLHatch merged commit 92684f4 into main Jan 27, 2026
15 checks passed
@CLHatch CLHatch deleted the FolderStructure branch January 27, 2026 19:52
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new set_permissions helper is placed under .scripts, but run_script still looks only in scripts/, so test_set_permissions calling run_script 'set_permissions' will fail unless you either move the script into scripts/ or update run_script to also search .scripts.
  • Having set_permissions unconditionally invoke sudo makes it harder to reuse in non-interactive or constrained environments; consider honoring an existing SUDO/DS_SUDO wrapper or adding a way to disable sudo for callers that already run with appropriate privileges.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `set_permissions` helper is placed under `.scripts`, but `run_script` still looks only in `scripts/`, so `test_set_permissions` calling `run_script 'set_permissions'` will fail unless you either move the script into `scripts/` or update `run_script` to also search `.scripts`.
- Having `set_permissions` unconditionally invoke `sudo` makes it harder to reuse in non-interactive or constrained environments; consider honoring an existing `SUDO`/`DS_SUDO` wrapper or adding a way to disable `sudo` for callers that already run with appropriate privileges.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

2 participants