Skip to content

Comments

Fix copy ui#986

Merged
mattfidler merged 6 commits intomainfrom
985-rename
Feb 20, 2026
Merged

Fix copy ui#986
mattfidler merged 6 commits intomainfrom
985-rename

Conversation

@mattfidler
Copy link
Member

Fix the copy ui so that it does a deep copy for the $meta environment or other environments that show up.

Copy link
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 fixes a bug in .copyUi() where environment objects within the UI were being shallow-copied instead of deep-copied. When environments like $meta contained nested environments (such as sigma or thetaMat), modifications to a renamed copy would inadvertently affect the original UI object.

Changes:

  • Introduced recursive .copyEnv() function to deep copy environments and their nested environment contents
  • Updated .copyUi() to use .copyEnv() for environment items instead of shallow copying
  • Added comprehensive test case verifying that rxRename() no longer modifies the parent UI

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
R/piping.R Added .copyEnv() helper function for recursive environment copying and updated .copyUi() to deep copy nested environments
tests/testthat/test-ui-rename.R Added test case with complex model containing nested environments to verify deep copy behavior
R/ui-assign-parts.R Code style improvements: added braces to single-line if statements
R/ui-rename.R Removed obsolete comment and reformatted error message for better readability
man/reexports.Rd Removed %fin% and %!fin% reexports from fastmatch package
NEWS.md Added entry documenting the .copyUi() bug fix

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

@mattfidler
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 20, 2026

@mattfidler I've opened a new pull request, #987, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 20, 2026 19:41
Co-authored-by: mattfidler <514778+mattfidler@users.noreply.github.com>
Fix infinite recursion in `.copyEnv()` on circular environment references
@mattfidler mattfidler merged commit 98ba16a into main Feb 20, 2026
6 of 8 checks passed
@mattfidler mattfidler deleted the 985-rename branch February 20, 2026 21:43
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