Skip to content

Fix potentially uninitialized locals#2885

Open
hiradary wants to merge 1 commit intobasecamp:mainfrom
hiradary:fix-uninitialized-locals
Open

Fix potentially uninitialized locals#2885
hiradary wants to merge 1 commit intobasecamp:mainfrom
hiradary:fix-uninitialized-locals

Conversation

@hiradary
Copy link
Copy Markdown

Summary

Fixes #2845.

  • Rename the prompt command partial collection local to avoid shadowing itself during destructuring
  • Guard the rich text data transfer test helper cleanup so it only restores URL options after setup succeeds

Testing

  • bin/rails test test/models/account/data_transfer/action_text/rich_text_record_set_test.rb
  • bin/rails test

Copilot AI review requested due to automatic review settings April 25, 2026 23:35
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses #2845 by removing a self-shadowing local in a rendered collection partial and by preventing a test helper ensure block from referencing locals that may not have been assigned if setup fails.

Changes:

  • Render the prompt command partial with as: :prompt_command and rename the destructured locals to avoid self-shadowing.
  • Update with_default_url_host test helper to only restore default_url_options[:host] if it was successfully modified.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/models/account/data_transfer/action_text/rich_text_record_set_test.rb Guards URL host restoration so ensure doesn’t touch potentially uninitialized locals.
app/views/prompts/commands/index.html.erb Passes an explicit local name (prompt_command) when rendering the collection.
app/views/prompts/commands/_command.html.erb Destructures the passed-in local into non-shadowing variable names and updates references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Potentially uninitialized local variable

2 participants